ResetDialog.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <a-modal
  3. v-model:open="visible"
  4. :width="456"
  5. style="top: 10vh"
  6. title="重新生成缺考数据"
  7. >
  8. <div class="reset-tips">
  9. <h3>生成条件</h3>
  10. <p>1.客观题未作答+主观题有作答的考生;</p>
  11. <p>2.客观题未作答+主观题没有作答+卡1或卡2任一题卡考号</p>
  12. <p>
  13. 填涂≧
  14. <a-input-number
  15. v-model:value="examNumberFillCount"
  16. :min="1"
  17. :max="999"
  18. :precision="0"
  19. :controls="false"
  20. style="width: 50px; margin: 0 5px; vertical-align: middle"
  21. ></a-input-number>
  22. 位+有条码的考生。
  23. </p>
  24. </div>
  25. <template #footer>
  26. <div class="box-justify">
  27. <div></div>
  28. <div>
  29. <a-button type="text" @click="close">取消</a-button>
  30. <a-button type="primary" @click="confirm">确认</a-button>
  31. </div>
  32. </div>
  33. </template>
  34. </a-modal>
  35. <!-- TaskProgressDialog -->
  36. <TaskProgressDialog ref="taskProgressDialogRef" :task="curExportTask" />
  37. </template>
  38. <script setup lang="ts">
  39. import { computed, ref, watch } from "vue";
  40. import useModal from "@/hooks/useModal";
  41. import { absentReset } from "@/ap/absentCheck";
  42. import { absentTemplateDownload } from "@/ap/absentCheck";
  43. import useLoading from "@/hooks/useLoading";
  44. import { useUserStore } from "@/store";
  45. import { message } from "@qmth/ui";
  46. import TaskProgressDialog from "../ResultExport/TaskProgressDialog.vue";
  47. defineOptions({
  48. name: "ImportTypeDialog",
  49. });
  50. /* modal */
  51. const { visible, open, close } = useModal();
  52. defineExpose({ open, close });
  53. const userStore = useUserStore();
  54. const examNumberFillCount = ref<number>();
  55. const { loading, setLoading } = useLoading();
  56. const curExportTask = ref({ id: "", name: "" });
  57. const taskProgressDialogRef = ref();
  58. async function confirm() {
  59. if (!examNumberFillCount.value) {
  60. message.error("请输入位数");
  61. return;
  62. }
  63. if (loading.value) return;
  64. setLoading(true);
  65. const res = await absentReset({
  66. examId: userStore.curExam.id,
  67. examNumberFillCount: examNumberFillCount.value,
  68. }).catch(() => {});
  69. setLoading(false);
  70. if (!res) return;
  71. curExportTask.value = {
  72. id: res.taskId,
  73. name: "缺考校验重新生成",
  74. };
  75. taskProgressDialogRef.value?.open();
  76. }
  77. watch(
  78. () => visible.value,
  79. (val) => {
  80. if (val) {
  81. examNumberFillCount.value = undefined;
  82. }
  83. },
  84. {
  85. immediate: true,
  86. }
  87. );
  88. </script>
  89. <style lang="less" scoped>
  90. .reset-tips {
  91. h3 {
  92. height: 24px;
  93. font-weight: 500;
  94. font-size: 15px;
  95. color: @text-color1;
  96. line-height: 24px;
  97. margin-bottom: 8px;
  98. }
  99. p {
  100. height: 22px;
  101. font-weight: 400;
  102. font-size: 14px;
  103. color: @text-color2;
  104. line-height: 22px;
  105. margin-bottom: 8px;
  106. }
  107. }
  108. </style>