zhangjie hace 4 años
padre
commit
289ce7a646

+ 1 - 1
src/modules/exam-center/components/BusinessData.vue

@@ -29,7 +29,7 @@
       ></el-table-column>
     </el-table>
     <div class="table-tips">
-      将导入 <span>{{ total }}</span> 数据
+      将导入 <span>{{ total }}</span> 数据
     </div>
     <div class="part-page">
       <el-pagination

+ 21 - 16
src/modules/exam-center/views/DoneTaskDetail.vue

@@ -22,20 +22,18 @@
         >
           <td>{{ attachment.name }}卷</td>
           <td class="td-link" v-if="task.examPaper">
-            <span
-              @click="downloadPaper(attachment, 'paper')"
-              title="点击下载试卷"
-            >
+            <span @click="downloadPaper(attachment)" title="点击下载试卷">
               <i class="icon icon-download-act"></i>{{ attachment.filename }}
             </span>
           </td>
-          <td class="td-link" v-if="task.examPaper">
-            <span
-              @click="downloadPaper(attachment, 'paperConfirm')"
-              title="点击下载确认书文件"
-            >
+          <td
+            class="td-link"
+            :rowspan="pTypeEnable ? paperAttachments.length : 1"
+            v-if="index === 0 && task.examPaper"
+          >
+            <span @click="downloadPaperConfirm" title="点击下载确认书文件">
               <i class="icon icon-download-act"></i
-              >{{ attachment.paperConfirmFilename }}
+              >{{ paperConfirmAttachmentId.filename }}
             </span>
           </td>
           <td
@@ -86,6 +84,7 @@ export default {
       taskId: this.$route.params.taskId,
       task: {},
       pTypeEnable: false,
+      paperConfirmAttachmentId: {},
       paperAttachments: [],
       curAttachment: {}
     };
@@ -103,6 +102,9 @@ export default {
       });
       this.pTypeEnable = this.task.enablePaperType.split(",").length > 1;
       this.parsePaperAttachment();
+      this.paperConfirmAttachmentId = this.task.paperConfirmAttachmentId
+        ? JSON.parse(this.task.paperConfirmAttachmentId)
+        : { attachmentId: "", filename: "" };
     },
     parsePaperAttachment() {
       const paperAttachment =
@@ -121,12 +123,15 @@ export default {
         this.goback();
       });
     },
-    async downloadPaper(attachment, downloadType) {
-      const attachmentId =
-        downloadType === "paper"
-          ? attachment.attachmentId
-          : attachment.paperConfirmAttachmentId;
-      const data = await attachmentPreview(attachmentId);
+    async downloadPaper(attachment) {
+      const data = await attachmentPreview(attachment.attachmentId);
+      window.open(data.path);
+    },
+    async downloadPaperConfirm() {
+      if (!this.paperConfirmAttachmentId.attachmentId) return;
+      const data = await attachmentPreview(
+        this.paperConfirmAttachmentId.attachmentId
+      );
       window.open(data.path);
     },
     toPreviewCard() {

+ 11 - 2
src/modules/exam-center/views/ExamModify.vue

@@ -18,7 +18,7 @@
       <el-form-item prop="examPlanCodeTemp" label="考试计划表:">
         <upload-file-view
           :upload-url="uploadExamPlanUrl"
-          :upload-data="uploadData"
+          :upload-data="uploadExamPlanData"
           :disabled="!canEdit"
           @upload-error="uplaodError"
           @upload-success="uploadExamPlanSuccess"
@@ -41,6 +41,7 @@
         <upload-file-view
           :upload-url="uploadExamBusinessUrl"
           :upload-data="uploadData"
+          :disabled="!modalForm.examPlanAttachmentId"
           @upload-error="uplaodError"
           @upload-success="uploadExamBusinessSuccess"
           ref="ExamBusinessUploadFileView"
@@ -333,8 +334,12 @@ export default {
       // import
       uploadExamPlanUrl: "/api/print/exam/exam/impExamPlanData",
       uploadExamBusinessUrl: "/api/print/exam/exam/impExamData",
-      uploadData: {
+      uploadExamPlanData: {
         examId: ""
+      },
+      uploadData: {
+        examId: "",
+        examPlanCodeTemp: ""
       }
     };
   },
@@ -350,6 +355,7 @@ export default {
     if (this.isEdit) {
       this.getExamDetail();
       this.uploadData.examId = this.examId;
+      this.uploadExamPlanData.examId = this.examId;
     }
   },
   methods: {
@@ -449,13 +455,16 @@ export default {
       const data = res.data;
 
       this.modalForm.examPlanCodeTemp = data.examPlanCodeTemp;
+      this.uploadData.examPlanCodeTemp = data.examPlanCodeTemp;
       this.modalForm.examPlanAttachmentId = data.attachmentId;
       this.$refs["ModalForm"].validateField("examPlanCodeTemp");
 
       this.courses = data.userCourses.map(item => {
+        item.canEdit = item.status === "未开始";
         item.teacherId = item.users.length === 1 ? item.users[0].id + "" : "";
         return item;
       });
+      this.canEdit = !this.courses.some(item => !item.canEdit);
     },
     uploadExamBusinessSuccess(res) {
       this.$message.success("上传成功!");

+ 14 - 2
src/modules/exam-center/views/TopicTaskManage.vue

@@ -121,12 +121,23 @@
           label="考试时间"
           min-width="160"
         ></el-table-column>
-        <el-table-column prop="status" label="状态"> </el-table-column>
+        <el-table-column prop="status" label="状态">
+          <span slot-scope="scope">
+            {{ TASK_TYPES[scope.row.status] }}
+          </span>
+        </el-table-column>
         <el-table-column prop="printStatus" label="提交印刷">
           <span slot-scope="scope">
             {{ BOOLEAN_TYPE[scope.row.printStatus] }}
           </span>
         </el-table-column>
+        <el-table-column prop="enable" label="是否启用">
+          <span
+            :class="{ 'color-danger': !scope.row.enable }"
+            slot-scope="scope"
+            >{{ BOOLEAN_TYPE[scope.row.enable] }}</span
+          >
+        </el-table-column>
         <el-table-column
           label="操作"
           align="center"
@@ -143,7 +154,7 @@
                   : 'icon icon-circle-caret-right'
               "
               @click="toEnable(scope.row)"
-              :title="scope.row.enable ? '禁用' : '启用'"
+              :title="scope.row.enable ? '取消' : '启用'"
               v-if="!scope.row.printStatus"
             ></el-button>
             <el-button
@@ -151,6 +162,7 @@
               type="text"
               icon="icon icon-edit"
               @click="toEdit(scope.row)"
+              v-if="scope.row.status === 0 || scope.row.status === 1"
               title="编辑"
             ></el-button>
           </template>

+ 55 - 42
src/modules/exam-center/views/WaitTaskDetail.vue

@@ -26,7 +26,7 @@
         <tr v-for="(attachment, index) in curPaperAttachments" :key="index">
           <td>{{ attachment.name }}卷</td>
           <td class="td-link" v-if="task.examPaper">
-            <span @click="toUpload(attachment, 'paper')" title="点击上传试卷">
+            <span @click="toUpload(attachment)" title="点击上传试卷">
               <i
                 :class="[
                   'icon',
@@ -40,22 +40,23 @@
               }}
             </span>
           </td>
-          <td class="td-link" v-if="task.examPaper">
-            <span
-              @click="toUpload(attachment, 'paperConfirm')"
-              title="点击上传确认书文件"
-            >
+          <td
+            class="td-link"
+            :rowspan="pTypeEnable ? curPaperAttachments.length : 1"
+            v-if="index === 0 && task.examPaper"
+          >
+            <span @click="toUploadPaperConfirm" title="点击上传确认书文件">
               <i
                 :class="[
                   'icon',
-                  attachment.paperConfirmAttachmentId
+                  paperConfirmAttachmentId.attachmentId
                     ? 'icon-files-act'
                     : 'icon-files'
                 ]"
               ></i
               >{{
-                attachment.paperConfirmAttachmentId
-                  ? attachment.paperConfirmFilename
+                paperConfirmAttachmentId.attachmentId
+                  ? paperConfirmAttachmentId.filename
                   : "点击上传确认书文件"
               }}
             </span>
@@ -92,10 +93,19 @@
       </div>
 
       <div class="task-action">
-        <el-button type="primary" style="width:105px;" @click="toSubmit"
+        <el-button
+          type="primary"
+          style="width:105px;"
+          @click="toSubmit"
+          :disabled="!curPaperAttachments.length"
           >确认提交</el-button
         >
-        <el-button style="width:88px;" @click="toSave">暂存</el-button>
+        <el-button
+          style="width:88px;"
+          @click="toSave"
+          :disabled="!curPaperAttachments.length"
+          >暂存</el-button
+        >
         <el-button @click="goback" style="width:88px;">取消</el-button>
       </div>
     </div>
@@ -173,6 +183,7 @@ export default {
         auditStatus: 0,
         remark: ""
       },
+      paperConfirmAttachmentId: { attachmentId: "", filename: "" },
       paperAttachments: [],
       curPaperAttachments: [],
       curAttachment: {},
@@ -224,10 +235,13 @@ export default {
 
       const paperAttachment =
         this.task.paperAttachmentId && JSON.parse(this.task.paperAttachmentId);
-      this.paperAttachments = paperAttachment && paperAttachment.paper;
+      this.paperAttachments = paperAttachment ? paperAttachment.paper : [];
       this.curPaperAttachments = this.paperAttachments.map(item => {
         return { ...item };
       });
+      this.paperConfirmAttachmentId = this.task.paperConfirmAttachmentId
+        ? JSON.parse(this.task.paperConfirmAttachmentId)
+        : { attachmentId: "", filename: "" };
       this.task.enablePaperType = this.getEnablePaperType();
 
       if (this.task.review && this.task.auditStatus === 2)
@@ -242,9 +256,7 @@ export default {
       const newAttachment = {
         name: this.abc[this.curPaperAttachments.length],
         attachmentId: "",
-        filename: "",
-        paperConfirmAttachmentId: "",
-        paperConfirmFilename: ""
+        filename: ""
       };
       this.curPaperAttachments.push(newAttachment);
     },
@@ -258,38 +270,32 @@ export default {
         item.name = this.abc[itemIndex];
       });
     },
-    toUpload(attachment, uploadType) {
-      this.curUploadType = uploadType;
+    toUpload(attachment) {
+      this.curUploadType = "paper";
       this.curAttachment = {
-        name: attachment.name,
-        attachmentId:
-          uploadType === "paper"
-            ? attachment.attachmentId
-            : attachment.paperConfirmAttachmentId,
-        filename:
-          uploadType === "paper"
-            ? attachment.filename
-            : attachment.paperConfirmFilename
+        ...attachment
+      };
+      this.$refs.UploadPaperDialog.open();
+    },
+    toUploadPaperConfirm() {
+      this.curUploadType = "paperConfirm";
+      this.curAttachment = {
+        ...this.paperConfirmAttachmentId
       };
       this.$refs.UploadPaperDialog.open();
     },
     uploadConfirm(attachment, uploadType) {
-      if (uploadType !== "paper")
-        attachment = {
-          name: attachment.name,
-          paperConfirmAttachmentId: attachment.attachmentId,
-          paperConfirmFilename: attachment.filename
-        };
-      const index = this.curPaperAttachments.findIndex(
-        item => item.name === attachment.name
-      );
-      const curAttachment = Object.assign(
-        this.curPaperAttachments[index],
-        attachment
-      );
-      this.curPaperAttachments.splice(index, 1, { ...curAttachment });
+      if (uploadType === "paper") {
+        const index = this.curPaperAttachments.findIndex(
+          item => item.name === attachment.name
+        );
+        this.curPaperAttachments.splice(index, 1, { ...attachment });
+      } else {
+        this.paperConfirmAttachmentId = { ...attachment };
+      }
     },
     toCreateCard() {
+      this.task = this.getTaskData().tcPExamTaskDetail;
       if (this.task.cardId) {
         if (this.task.cardSource === 0) {
           this.$refs.CardOptionDialog.open();
@@ -336,15 +342,22 @@ export default {
       datas.paperAttachmentId = JSON.stringify({
         paper: this.curPaperAttachments
       });
+      datas.paperConfirmAttachmentId = JSON.stringify(
+        this.paperConfirmAttachmentId
+      );
       datas.enablePaperType = this.getEnablePaperType();
       return { tcPExamTaskDetail: datas };
     },
     checkDataValid() {
       const attachmentValid = !this.curPaperAttachments.some(
-        item => !item.attachmentId || !item.paperConfirmAttachmentId
+        item => !item.attachmentId
       );
       if (this.task.examPaper && !attachmentValid) {
-        this.$message.error("请完成试卷文件和试卷审核确认书上传!");
+        this.$message.error("请完成试卷文件上传!");
+        return;
+      }
+      if (this.task.examPaper && !this.paperConfirmAttachmentId.attachmentId) {
+        this.$message.error("请完成试卷审核确认书上传!");
         return;
       }
 

+ 13 - 0
src/router.js

@@ -13,6 +13,19 @@ import scorePaper from "./modules/score-paper/router";
 import analyze from "./modules/analyze/router";
 import card from "./modules/card/router";
 
+// ignore NavigationDuplicated. https://github.com/vuejs/vue-router/issues/2881
+const originalPush = Router.prototype.push;
+Router.prototype.push = function push(location, onResolve, onReject) {
+  if (onResolve || onReject)
+    return originalPush.call(this, location, onResolve, onReject);
+  try {
+    return originalPush.call(this, location).catch(err => err);
+  } catch (error) {
+    console.log(error);
+  }
+};
+// end ignore
+
 Vue.use(Router);
 
 export default new Router({