PushSetDialog.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <el-dialog
  3. class="push-set-dialog"
  4. :visible.sync="modalIsShow"
  5. title="推送云阅卷设置"
  6. top="10vh"
  7. width="600px"
  8. :close-on-click-modal="false"
  9. :close-on-press-escape="false"
  10. append-to-body
  11. @open="visibleChange"
  12. >
  13. <el-form label-width="150px">
  14. <el-form-item label="是否推送客观分:">
  15. <el-radio-group v-model="modalForm.objectiveScorePush">
  16. <el-radio :label="true">是</el-radio>
  17. <el-radio :label="false">否</el-radio>
  18. </el-radio-group>
  19. </el-form-item>
  20. <el-form-item label="是否推送违纪考生:">
  21. <el-radio-group v-model="modalForm.examStudentBreachPush">
  22. <el-radio :label="true">是</el-radio>
  23. <el-radio :label="false">否</el-radio>
  24. </el-radio-group>
  25. </el-form-item>
  26. </el-form>
  27. <div slot="footer">
  28. <el-button type="primary" :disabled="isSubmit" @click="submit"
  29. >确认</el-button
  30. >
  31. <el-button @click="cancel">取消</el-button>
  32. </div>
  33. </el-dialog>
  34. </template>
  35. <script>
  36. import { pushCloudMarkExam } from "@/api/examwork-exam";
  37. const initModalForm = {
  38. examId: null,
  39. objectiveScorePush: false,
  40. examStudentBreachPush: false,
  41. };
  42. export default {
  43. name: "PushSetDialog",
  44. props: {
  45. exam: {
  46. type: Object,
  47. default() {
  48. return;
  49. },
  50. },
  51. },
  52. data() {
  53. return {
  54. modalIsShow: false,
  55. isSubmit: false,
  56. modalForm: { ...initModalForm },
  57. };
  58. },
  59. methods: {
  60. visibleChange() {
  61. this.modalForm = {
  62. examId: this.exam.id,
  63. objectiveScorePush: !!this.exam.objectiveScorePush,
  64. examStudentBreachPush: !!this.exam.examStudentBreachPush,
  65. };
  66. },
  67. cancel() {
  68. this.modalIsShow = false;
  69. },
  70. open() {
  71. this.modalIsShow = true;
  72. },
  73. async submit() {
  74. if (this.exam.cloudMarkPushDataStatus === "FINISH") {
  75. const confirm = await this.$confirm(
  76. `当前批次已经推送过,确定要重新推送吗?`,
  77. "提示",
  78. {
  79. type: "warning",
  80. }
  81. ).catch(() => {});
  82. if (confirm !== "confirm") return;
  83. }
  84. if (this.isSubmit) return;
  85. this.isSubmit = true;
  86. const data = await pushCloudMarkExam(this.modalForm).catch(() => {});
  87. this.isSubmit = false;
  88. if (!data) return;
  89. this.$message.success("操作成功!");
  90. this.$emit("modified");
  91. this.cancel();
  92. },
  93. },
  94. };
  95. </script>