GradingRuleSet.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <div class="grading-rule-set part-box">
  3. <Form
  4. ref="modalFormComp"
  5. :model="modalForm"
  6. :rules="rules"
  7. :label-width="200"
  8. style="width: 400px;"
  9. >
  10. <FormItem prop="deviation" label="仲裁档位差:">
  11. <InputNumber
  12. v-model="modalForm.deviation"
  13. :min="1"
  14. :max="100"
  15. :disabled="!modalFormCanEdit"
  16. style="width: 160px;"
  17. ></InputNumber>
  18. </FormItem>
  19. <FormItem
  20. prop="cumulativeError"
  21. label="打回累计误差:"
  22. v-if="modalForm.autoCallback"
  23. >
  24. <InputNumber
  25. v-model="modalForm.cumulativeError"
  26. :min="1"
  27. :max="100"
  28. :disabled="!modalFormCanEdit"
  29. style="width: 160px;"
  30. ></InputNumber>
  31. </FormItem>
  32. <FormItem prop="examNumber" label="系统自动打回:">
  33. <Select
  34. v-model="modalForm.autoCallback"
  35. :disabled="!modalFormCanEdit"
  36. placeholder="系统自动打回"
  37. >
  38. <Option
  39. v-for="(val, key) in BOOLEAN_TYPE"
  40. :key="key"
  41. :value="key * 1"
  42. :label="val"
  43. ></Option>
  44. </Select>
  45. </FormItem>
  46. <FormItem prop="examNumber" label="是否过半定档:">
  47. <Select
  48. v-model="modalForm.majority"
  49. :disabled="!modalFormCanEdit"
  50. placeholder="是否过半定档"
  51. >
  52. <Option
  53. v-for="(val, key) in BOOLEAN_TYPE"
  54. :key="key"
  55. :value="key * 1"
  56. :label="val"
  57. ></Option>
  58. </Select>
  59. </FormItem>
  60. <FormItem prop="examNumber" label="阅卷员是否显示所有试卷:">
  61. <Select
  62. v-model="modalForm.levelShowAllPaper"
  63. :disabled="!modalFormCanEdit"
  64. placeholder="阅卷员是否显示所有试卷"
  65. >
  66. <Option
  67. v-for="(val, key) in BOOLEAN_TYPE"
  68. :key="key"
  69. :value="key * 1"
  70. :label="val"
  71. ></Option>
  72. </Select>
  73. </FormItem>
  74. <FormItem>
  75. <Button
  76. shape="circle"
  77. style="width: 80px;"
  78. @click="modalFormCanEdit = true"
  79. >编辑</Button
  80. >
  81. <Button
  82. type="primary"
  83. shape="circle"
  84. style="width: 80px;"
  85. :disabled="isSubmit"
  86. @click="submit"
  87. >保存</Button
  88. >
  89. </FormItem>
  90. </Form>
  91. </div>
  92. </template>
  93. <script>
  94. import { getParamsSet, updateLevelParams } from "@/api";
  95. import { BOOLEAN_TYPE } from "@/constants/enumerate";
  96. import { numberValidator } from "@/plugins/formRules";
  97. export default {
  98. name: "grading-rule-set",
  99. data() {
  100. return {
  101. isSubmit: false,
  102. workId: this.$route.params.workId,
  103. BOOLEAN_TYPE,
  104. initModalForm: {
  105. workId: "",
  106. deviation: 3,
  107. cumulativeError: null,
  108. autoCallback: 0,
  109. majority: 0,
  110. levelShowAllPaper: 0
  111. },
  112. modalFormCanEdit: false,
  113. modalForm: {},
  114. rules: {
  115. deviation: numberValidator("请输入仲裁档位差"),
  116. cumulativeError: numberValidator("请输入打回累计误差")
  117. }
  118. };
  119. },
  120. mounted() {
  121. this.modalForm = { ...this.initModalForm };
  122. this.getParamsSetInfo();
  123. },
  124. methods: {
  125. async getParamsSetInfo() {
  126. const data = await getParamsSet(this.workId);
  127. this.modalForm = this.$objAssign(this.modalForm, data);
  128. },
  129. async submit() {
  130. const valid = await this.$refs.modalFormComp.validate();
  131. if (!valid) return;
  132. if (this.isSubmit) return;
  133. this.isSubmit = true;
  134. let result = true;
  135. await updateLevelParams(this.modalForm).catch(() => {
  136. result = false;
  137. });
  138. this.isSubmit = false;
  139. if (!result) return;
  140. this.modalFormCanEdit = false;
  141. this.$Message.success("保存成功!");
  142. }
  143. }
  144. };
  145. </script>