ExamTaskAuditEdit.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <template>
  2. <div class="exam-task-audit-edit task-detail">
  3. <div class="task-title">
  4. <h2>
  5. <span>考试名称: {{ task.examName }} </span>
  6. <span>科目名称:{{ task.courseName }}</span>
  7. </h2>
  8. </div>
  9. <div class="task-body">
  10. <table class="table">
  11. <tr>
  12. <th>试卷类型</th>
  13. <th v-if="task.examPaper">试卷文件</th>
  14. <th v-if="task.examPaper">试卷审核确认书</th>
  15. <th v-if="task.answerSheet">答题卡</th>
  16. </tr>
  17. <tr v-for="(attachment, index) in paperAttachments" :key="index">
  18. <td>{{ attachment.name }}卷</td>
  19. <td class="td-link" v-if="task.examPaper">
  20. <span @click="downloadPaper(attachment)" title="点击下载试卷">
  21. <i class="icon icon-download-act"></i>{{ attachment.filename }}
  22. </span>
  23. </td>
  24. <td
  25. class="td-link"
  26. :rowspan="pTypeEnable ? paperAttachments.length : 1"
  27. v-if="index === 0 && task.examPaper"
  28. >
  29. <span @click="downloadPaperConfirm" title="点击下载确认书文件">
  30. <i class="icon icon-download-act"></i
  31. >{{ paperConfirmAttachmentId.filename }}
  32. </span>
  33. </td>
  34. <td
  35. class="td-link"
  36. :rowspan="pTypeEnable ? paperAttachments.length : 1"
  37. v-if="index === 0 && task.answerSheet"
  38. >
  39. <span @click="toPreviewCard" title="点击预览答题卡内容">{{
  40. task.cardName
  41. }}</span>
  42. </td>
  43. </tr>
  44. </table>
  45. <!-- task-form -->
  46. <el-form
  47. ref="ModalForm"
  48. :model="modalForm"
  49. :rules="rules"
  50. label-width="180px"
  51. style="min-width:800px;"
  52. >
  53. <el-form-item prop="status" label="审核结果:">
  54. <el-radio-group v-model="modalForm.status" :disabled="hasAudited">
  55. <el-radio
  56. v-for="item in AUDIT_TYPE"
  57. :key="item.key"
  58. :label="item.key"
  59. >{{ item.name }}</el-radio
  60. >
  61. </el-radio-group>
  62. </el-form-item>
  63. <el-form-item
  64. prop="remark"
  65. label="审核意见:"
  66. v-if="modalForm.status === 2"
  67. >
  68. <el-input
  69. type="textarea"
  70. style="width: 439px;"
  71. v-model.trim="modalForm.remark"
  72. :disabled="hasAudited"
  73. :maxlength="200"
  74. :rows="5"
  75. show-word-limit
  76. placeholder="请输入审核意见"
  77. clearable
  78. ></el-input>
  79. </el-form-item>
  80. <el-form-item>
  81. <el-button
  82. type="primary"
  83. :disabled="isSubmit"
  84. @click="save"
  85. v-if="!hasAudited"
  86. >提交</el-button
  87. >
  88. <el-button @click="goback">{{
  89. hasAudited ? "返回" : "取消"
  90. }}</el-button>
  91. </el-form-item>
  92. </el-form>
  93. </div>
  94. </div>
  95. </template>
  96. <script>
  97. import { waitTaskDetail, auditExamTask } from "../api";
  98. import { attachmentPreview } from "../../login/api";
  99. export default {
  100. name: "exam-task-audit-edit",
  101. data() {
  102. return {
  103. taskId: this.$route.params.taskId,
  104. task: {},
  105. pTypeEnable: false,
  106. paperConfirmAttachmentId: {},
  107. paperAttachments: [],
  108. curAttachment: {},
  109. isSubmit: false,
  110. hasAudited: false,
  111. AUDIT_TYPE: [
  112. {
  113. key: 1,
  114. name: "通过"
  115. },
  116. {
  117. key: 2,
  118. name: "不通过"
  119. }
  120. ],
  121. modalForm: { status: 1, remark: "" },
  122. rules: {
  123. status: [
  124. {
  125. required: true,
  126. message: "请选择审核结果",
  127. trigger: "change"
  128. }
  129. ],
  130. remark: [
  131. {
  132. required: true,
  133. message: "请输入审核意见",
  134. trigger: "change"
  135. }
  136. ]
  137. }
  138. };
  139. },
  140. mounted() {
  141. this.getData();
  142. },
  143. methods: {
  144. async getData() {
  145. const data = await waitTaskDetail(this.taskId);
  146. const nameCode = data.courseNameCode.split(/\(|\)/);
  147. this.task = Object.assign(this.task, data, {
  148. courseName: nameCode[0],
  149. courseCode: nameCode[1]
  150. });
  151. this.pTypeEnable = this.task.enablePaperType.split(",").length > 1;
  152. this.parsePaperAttachment();
  153. this.paperConfirmAttachmentId = this.task.paperConfirmAttachmentId
  154. ? JSON.parse(this.task.paperConfirmAttachmentId)
  155. : { attachmentId: "", filename: "" };
  156. this.hasAudited = this.task.auditStatus !== 0;
  157. this.modalForm = {
  158. status: this.hasAudited ? data.auditStatus : 1,
  159. remark: data.remark
  160. };
  161. },
  162. parsePaperAttachment() {
  163. const paperAttachment =
  164. this.task.paperAttachmentId && JSON.parse(this.task.paperAttachmentId);
  165. if (!paperAttachment) return;
  166. this.paperAttachments = paperAttachment.paper;
  167. },
  168. async downloadPaper(attachment) {
  169. const data = await attachmentPreview(attachment.attachmentId);
  170. window.open(data.path);
  171. },
  172. async downloadPaperConfirm() {
  173. if (!this.paperConfirmAttachmentId.attachmentId) return;
  174. const data = await attachmentPreview(
  175. this.paperConfirmAttachmentId.attachmentId
  176. );
  177. window.open(data.path);
  178. },
  179. toPreviewCard() {
  180. window.open(
  181. this.getRouterPath({
  182. name: "CardPreview",
  183. params: {
  184. cardId: this.task.cardId,
  185. viewType: "view"
  186. }
  187. })
  188. );
  189. },
  190. async save() {
  191. const valid = await this.$refs["ModalForm"].validate().catch(() => {});
  192. if (!valid) return;
  193. if (this.isSubmit) return;
  194. this.isSubmit = true;
  195. const datas = {
  196. ...this.modalForm,
  197. taskId: this.taskId,
  198. examId: this.task.examId
  199. };
  200. const result = await auditExamTask(datas).catch(() => {});
  201. this.isSubmit = false;
  202. if (!result) return;
  203. this.$message.success("审核成功!");
  204. this.goback();
  205. }
  206. }
  207. };
  208. </script>