123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- <template>
- <div class="grading-rule-set part-box">
- <Form
- ref="modalFormComp"
- :model="modalForm"
- :rules="rules"
- :label-width="200"
- style="width: 400px;"
- >
- <FormItem prop="deviation" label="仲裁档位差:">
- <InputNumber
- v-model="modalForm.deviation"
- :min="1"
- :max="100"
- :disabled="!modalFormCanEdit"
- style="width: 160px;"
- ></InputNumber>
- </FormItem>
- <FormItem
- prop="cumulativeError"
- label="打回累计误差:"
- v-if="modalForm.autoCallback"
- >
- <InputNumber
- v-model="modalForm.cumulativeError"
- :min="1"
- :max="100"
- :disabled="!modalFormCanEdit"
- style="width: 160px;"
- ></InputNumber>
- </FormItem>
- <FormItem prop="examNumber" label="系统自动打回:">
- <Select
- v-model="modalForm.autoCallback"
- :disabled="!modalFormCanEdit"
- placeholder="系统自动打回"
- >
- <Option
- v-for="(val, key) in BOOLEAN_TYPE"
- :key="key"
- :value="key * 1"
- :label="val"
- ></Option>
- </Select>
- </FormItem>
- <FormItem prop="examNumber" label="是否过半定档:">
- <Select
- v-model="modalForm.majority"
- :disabled="!modalFormCanEdit"
- placeholder="是否过半定档"
- >
- <Option
- v-for="(val, key) in BOOLEAN_TYPE"
- :key="key"
- :value="key * 1"
- :label="val"
- ></Option>
- </Select>
- </FormItem>
- <FormItem prop="examNumber" label="阅卷员是否显示所有试卷:">
- <Select
- v-model="modalForm.levelShowAllPaper"
- :disabled="!modalFormCanEdit"
- placeholder="阅卷员是否显示所有试卷"
- >
- <Option
- v-for="(val, key) in BOOLEAN_TYPE"
- :key="key"
- :value="key * 1"
- :label="val"
- ></Option>
- </Select>
- </FormItem>
- <FormItem>
- <Button
- shape="circle"
- style="width: 80px;"
- @click="modalFormCanEdit = true"
- >编辑</Button
- >
- <Button
- type="primary"
- shape="circle"
- style="width: 80px;"
- :disabled="isSubmit"
- @click="submit"
- >保存</Button
- >
- </FormItem>
- </Form>
- </div>
- </template>
- <script>
- import { getParamsSet, updateLevelParams } from "@/api";
- import { BOOLEAN_TYPE } from "@/constants/enumerate";
- import { numberValidator } from "@/plugins/formRules";
- export default {
- name: "grading-rule-set",
- data() {
- return {
- isSubmit: false,
- workId: this.$route.params.workId,
- BOOLEAN_TYPE,
- initModalForm: {
- workId: "",
- deviation: 3,
- cumulativeError: null,
- autoCallback: 0,
- majority: 0,
- levelShowAllPaper: 0
- },
- modalFormCanEdit: false,
- modalForm: {},
- rules: {
- deviation: numberValidator("请输入仲裁档位差"),
- cumulativeError: numberValidator("请输入打回累计误差")
- }
- };
- },
- mounted() {
- this.modalForm = { ...this.initModalForm };
- this.getParamsSetInfo();
- },
- methods: {
- async getParamsSetInfo() {
- const data = await getParamsSet(this.workId);
- this.modalForm = this.$objAssign(this.modalForm, data);
- },
- async submit() {
- const valid = await this.$refs.modalFormComp.validate();
- if (!valid) return;
- if (this.isSubmit) return;
- this.isSubmit = true;
- let result = true;
- await updateLevelParams(this.modalForm).catch(() => {
- result = false;
- });
- this.isSubmit = false;
- if (!result) return;
- this.modalFormCanEdit = false;
- this.$Message.success("保存成功!");
- }
- }
- };
- </script>
|