zhangjie 5 năm trước cách đây
mục cha
commit
f9dafa423b

+ 3 - 3
src/components/UploadButton.vue

@@ -78,9 +78,9 @@ export default {
         .split(".")
         .pop()
         .toLocaleLowerCase();
-      return this.format.some(
-        item => item.toLocaleLowerCase() === _file_format
-      );
+      return this.format.length
+        ? this.format.some(item => item.toLocaleLowerCase() === _file_format)
+        : true;
     },
     async handleBeforeUpload(file) {
       this.uploadDataDict = {

+ 7 - 4
src/modules/base/components/BusinessFields.vue

@@ -22,6 +22,7 @@
         <upload-button
           btn-icon="icon icon-share-gray"
           btn-content="导入考务扩展字段"
+          :upload-data="examExtendColumn"
           :upload-url="uploadUrl"
           :format="['xls', 'xlsx']"
           @upload-error="uplaodError"
@@ -55,6 +56,11 @@ export default {
         this.GLOBAL.domain + "/api/print/basic/cardRule/impExtendColums"
     };
   },
+  computed: {
+    examExtendColumn() {
+      return { examExtendColumn: JSON.stringify(this.extendColumns) };
+    }
+  },
   mounted() {
     this.mustColumns = CARD_BUSINESS_FIELDS.must.map(item => {
       item.select = true;
@@ -75,10 +81,7 @@ export default {
     },
     uploadSuccess(response) {
       this.$message.success("导入成功!");
-      this.extendColumns = response.data.map(item => {
-        item.select = false;
-        return item;
-      });
+      this.extendColumns = response.data;
     },
     getSelectColumns() {
       return {

+ 7 - 2
src/modules/base/views/UserEdit.vue

@@ -50,7 +50,7 @@
           <el-option
             v-for="item in courses"
             :key="item.id"
-            :label="item.courseName"
+            :label="item.name"
             :value="item.id"
           >
           </el-option>
@@ -137,7 +137,12 @@ export default {
     },
     async getCourseList() {
       const data = await courseList();
-      this.courses = data.records;
+      this.courses = data.records.map(course => {
+        return {
+          id: course.id,
+          name: `${course.courseName}(${course.courseCode})`
+        };
+      });
     },
     async submit(name) {
       const valid = await this.$refs[name].validate().catch(() => {});

+ 29 - 24
src/modules/card/views/CardDesign.vue

@@ -238,7 +238,6 @@ import {
   saveCard,
   submitCard
 } from "../api";
-import { saveWaitTask } from "@/modules/exam-center/api";
 import {
   getElementModel,
   getCardHeadModel,
@@ -386,7 +385,15 @@ export default {
     // 操作
     async toPreview() {
       await this.toSave(this.$refs.SavePage.getPageModel());
-      window.open(`/#/card/preview/${this.cardId}/view`);
+      window.open(
+        this.getRouterPath({
+          name: "CardPreview",
+          params: {
+            cardId: this.cardId,
+            viewType: "view"
+          }
+        })
+      );
     },
     swithPage(pindex) {
       if (this.curPageNo === pindex) return;
@@ -422,39 +429,29 @@ export default {
       };
       if (this.cardDetailId) data.tcPCardDetail.id = this.cardDetailId;
       if (contentTemp) data.tcPCardDetail.contentTemp = contentTemp;
+
+      if (this.prepareTcPCard.taskId && this.prepareTcPCard.cardSource === "1")
+        data.tcPExamTaskDetail = {
+          ...this.prepareTcPCard,
+          cardId: this.cardId
+        };
       return data;
     },
     async save() {
       if (!this.cardConfig.cardName) {
         this.$message.error("题卡标题不能为空!");
-        return Promise.reject("error:题卡标题不能为空");
+        return false;
       }
       const result = await saveCard(this.getCardData());
       this.cardDetailId = result.cardDetailId;
       this.cardId = result.cardId;
       this.$ls.set("cardDetailId", this.cardDetailId);
       this.$ls.set("cardId", this.cardId);
+      return true;
     },
     async toSave() {
-      await this.save();
-      this.$message.success("保存成功!");
-
-      // 自助创建时暂存任务
-      if (
-        this.prepareTcPCard.taskId &&
-        this.prepareTcPCard.cardSource === "1"
-      ) {
-        saveWaitTask({
-          tcPExamTaskDetail: { ...this.prepareTcPCard, cardId: this.cardId }
-        });
-      }
-    },
-    registWindowSubmit() {
-      window.submitCardTemp = async cardContentTemp => {
-        await submitCard(this.getCardData(cardContentTemp));
-        this.$message.success("提交成功!");
-        this.cardPreviewUrl = "";
-      };
+      const result = await this.save();
+      if (result) this.$message.success("保存成功!");
     },
     toSubmit() {
       this.$confirm("确定要提交当前题卡吗?", "提示", {
@@ -463,10 +460,18 @@ export default {
         type: "warning"
       })
         .then(async () => {
-          await this.save();
-          this.cardPreviewUrl = `/#/card/preview/${this.cardId}/frame`;
+          const result = await this.save();
+          if (result)
+            this.cardPreviewUrl = `/#/card/preview/${this.cardId}/frame`;
         })
         .catch(() => {});
+    },
+    registWindowSubmit() {
+      window.submitCardTemp = async cardContentTemp => {
+        await submitCard(this.getCardData(cardContentTemp));
+        this.$message.success("提交成功!");
+        this.cardPreviewUrl = "";
+      };
     }
   },
   beforeDestroy() {

+ 20 - 4
src/modules/exam-center/components/CardOptionDialog.vue

@@ -57,7 +57,7 @@
               v-for="item in courses"
               :key="item.courseCode"
               :value="item.courseCode"
-              :label="item.courseName"
+              :label="item.name"
             ></el-option>
           </el-select>
         </div>
@@ -70,7 +70,7 @@
 
     <!-- upload-sample-paper-dialog -->
     <upload-sample-paper-dialog
-      @confirm="cancel"
+      @confirm="uploadSampleOver"
       :data="modalForm"
       ref="UploadSamplePaperDialog"
     ></upload-sample-paper-dialog>
@@ -99,6 +99,7 @@ export default {
       modalForm: {
         taskId: "",
         examId: "",
+        courseNameCode: "",
         enablePaperType: "",
         paperAttachmentId: "",
         courseName: "",
@@ -160,7 +161,10 @@ export default {
     async getCourseByUser() {
       const data = await courseByUser();
       if (data && data.length) {
-        this.courses = data;
+        this.courses = data.map(item => {
+          item.name = `${item.courseName}(${item.courseCode})`;
+          return item;
+        });
         this.modalForm.courseCode = this.courses[0].courseCode;
         this.modalForm.courseName = this.courses[0].courseName;
       }
@@ -171,6 +175,10 @@ export default {
     open() {
       this.modalIsShow = true;
     },
+    uploadSampleOver() {
+      this.cancel();
+      this.$emit("upload-sample-over");
+    },
     confirm() {
       if (this.modalForm.cardSource !== "0" && !this.modalForm.courseCode) {
         this.$message.error("请选择科目!");
@@ -203,7 +211,15 @@ export default {
       this.cancel();
     },
     toPreview() {
-      window.open(`/#/card/preview/${this.modalForm.refCardId}/view`);
+      window.open(
+        this.getRouterPath({
+          name: "CardPreview",
+          params: {
+            cardId: this.modalForm.refCardId,
+            viewType: "view"
+          }
+        })
+      );
     }
   }
 };

+ 7 - 15
src/modules/exam-center/components/UploadSamplePaperDialog.vue

@@ -15,7 +15,7 @@
         ref="ModalForm"
         :model="modalForm"
         :rules="rules"
-        label-width="85px"
+        label-width="90px"
         label-position="left"
       >
         <el-form-item prop="title" label="文件标题:">
@@ -55,7 +55,7 @@
 
 <script>
 import UploadButton from "@/components/UploadButton";
-import { createCard, saveWaitTask } from "../api";
+import { createCard } from "../api";
 
 export default {
   name: "upload-sample-paper-dialog",
@@ -132,20 +132,12 @@ export default {
       const datas = {
         tcPCard: this.modalForm
       };
-      const data = await createCard(datas).catch(() => {});
-      this.isSubmit = false;
-      if (!data) return;
+      if (this.data.taskId && this.data.cardSource === "2")
+        datas.tcPExamTaskDetail = this.data;
 
-      // 自助创建时暂存任务
-      if (this.data.taskId && this.data.cardSource === "2") {
-        await saveWaitTask({
-          tcPExamTaskDetail: {
-            ...this.data,
-            cardId: data.cardId,
-            paperAttachmentId: this.modalForm.paperAttachmentId
-          }
-        });
-      }
+      const res = await createCard(datas).catch(() => {});
+      this.isSubmit = false;
+      if (!res) return;
 
       this.$message.success("申请成功!");
       this.$emit("confirm");

+ 1 - 1
src/modules/exam-center/views/CardAudit.vue

@@ -147,13 +147,13 @@ export default {
     };
   },
   created() {
-    this.filter.schId = this.$ls.get("schoolId");
     this.getList();
     this.getSchoolList();
   },
   methods: {
     async getSchoolList() {
       this.schools = await schoolList();
+      this.filter.schId = this.$ls.get("schoolId");
     },
     async getList() {
       const datas = {

+ 7 - 1
src/modules/exam-center/views/CardManage.vue

@@ -50,7 +50,12 @@
         <el-table-column prop="id" label="题卡ID"></el-table-column>
         <el-table-column label="科目(代码)">
           <template slot-scope="scope">
-            <span>{{ scope.row.courseName }}({{ scope.row.courseCode }})</span>
+            <span
+              >{{ scope.row.courseName
+              }}<i v-if="scope.row.courseCode"
+                >({{ scope.row.courseCode }})</i
+              ></span
+            >
           </template>
         </el-table-column>
         <el-table-column prop="title" label="标题"></el-table-column>
@@ -129,6 +134,7 @@
     <!-- card-option-dialog -->
     <card-option-dialog
       ref="CardOptionDialog"
+      @upload-sample-over="getList"
       @confirm="cardConfirm"
     ></card-option-dialog>
   </div>

+ 9 - 1
src/modules/exam-center/views/DoneTaskDetail.vue

@@ -114,7 +114,15 @@ export default {
       window.open(data.path);
     },
     toPreviewCard() {
-      window.open(`/#/card/preview/${this.task.cardId}/view`);
+      window.open(
+        this.getRouterPath({
+          name: "CardPreview",
+          params: {
+            cardId: this.task.cardId,
+            viewType: "view"
+          }
+        })
+      );
     },
     downloadStdAns(attachment) {
       // TODO:

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

@@ -66,6 +66,7 @@
     <card-option-dialog
       :data="task"
       ref="CardOptionDialog"
+      @upload-sample-over="getData"
       @confirm="cardConfirm"
     ></card-option-dialog>
   </div>
@@ -136,7 +137,6 @@ export default {
         this.task.enablePaperType.split(",").length > 1;
       this.parsePaperAttachment();
       this.pTypeEnableChange(this.pTypeEnable);
-      this.task.enablePaperType = this.getEnablePaperType();
     },
     parsePaperAttachment() {
       const paperAttachment =
@@ -161,6 +161,7 @@ export default {
       this.curPaperAttachments = val
         ? this.paperAttachments
         : [this.paperAttachments[0]];
+      this.task.enablePaperType = this.getEnablePaperType();
     },
     toUpload(attachment) {
       this.curAttachment = { ...attachment };
@@ -194,7 +195,15 @@ export default {
               }
             });
           } else {
-            window.open(`/#/card/preview/${this.task.cardId}/view`);
+            window.open(
+              this.getRouterPath({
+                name: "CardPreview",
+                params: {
+                  cardId: this.task.cardId,
+                  viewType: "view"
+                }
+              })
+            );
           }
         }
         return;

+ 1 - 2
src/plugins/axios.js

@@ -43,13 +43,12 @@ const errorDataCallback = error => {
   let message = error.message || "数据错误";
   message = message.indexOf("###") !== -1 ? "参数错误" : message;
 
-  // TODO:自定义处理逻辑,以下为epcc实例
   if (error.code === "106") {
     message = "身份验证失效,请重新登录";
     MessageBox.confirm(message, "重新登陆?", {
       cancelButtonClass: "el-button--primary",
       confirmButtonClass: "el-button--default-act",
-      type: "error",
+      type: "warning",
       callback: action => {
         if (action !== "confirm") return;
         Vue.ls.clear();

+ 4 - 0
src/plugins/mixins.js

@@ -9,6 +9,10 @@ export default {
     },
     goback() {
       window.history.back();
+    },
+    getRouterPath(location) {
+      const { href } = this.$router.resolve(location);
+      return href;
     }
   }
 };