Procházet zdrojové kódy

新增试卷数量统计导出功能

zhangjie před 4 roky
rodič
revize
49358df338

+ 4 - 2
src/modules/exam-center/components/UploadPaperDialog.vue

@@ -89,10 +89,12 @@ export default {
     },
     uploadSuccess(res) {
       this.$message.success("上传成功!");
-      this.attachment = Object.assign(this.attachment, {
+      let infos = {
         attachmentId: res.data.id,
         filename: `${res.data.name}${res.data.type}`
-      });
+      };
+      if (this.uploadType === "paper") infos.pages = res.data.pages;
+      this.attachment = Object.assign(this.attachment, infos);
     },
     cancel() {
       this.modalIsShow = false;

+ 39 - 3
src/modules/exam-center/views/ExamManage.vue

@@ -110,9 +110,22 @@
               type="text"
               icon="icon icon-download-act"
               @click="toExport(scope.row)"
-              title="导出"
+              title="导出打印数量"
               v-if="scope.row.printStatus === '已打印'"
             ></el-button>
+            <el-button
+              class="btn-table-icon"
+              type="text"
+              icon="icon icon-circle-share"
+              @click="toExportPaper(scope.row)"
+              title="导出试卷数量统计"
+              v-if="
+                IS_SUPER_ADMIN &&
+                  (scope.row.printStatus === '待打印' ||
+                    scope.row.printStatus === '打印中' ||
+                    scope.row.printStatus === '已打印')
+              "
+            ></el-button>
             <el-button
               class="btn-table-icon"
               type="text"
@@ -158,7 +171,8 @@ export default {
       visible: false,
       PRINT_STATUS,
       exams: [],
-      examPages: []
+      examPages: [],
+      IS_SUPER_ADMIN: false
     };
   },
   created() {
@@ -166,6 +180,8 @@ export default {
   },
   methods: {
     init() {
+      const roleCode = this.$ls.get("user", { roleCode: "" }).roleCode;
+      this.IS_SUPER_ADMIN = roleCode.includes("SUPER_ADMIN");
       this.getList();
       this.getExamList();
     },
@@ -232,7 +248,6 @@ export default {
     //   });
     // },
     async toExport(row) {
-      console.log(row);
       let load = this.$message({
         iconClass: "el-message__icon el-icon-loading",
         message: "Loading...",
@@ -254,6 +269,27 @@ export default {
       if (!data) return;
       this.$message.success("文件已开始下载!");
     },
+    async toExportPaper(row) {
+      let load = this.$message({
+        iconClass: "el-message__icon el-icon-loading",
+        message: "Loading...",
+        duration: 0
+      });
+      const data = await download({
+        type: "get",
+        url: `/api/print/exam/exam/expPrePrintCount?examId=${row.id}`,
+        fileName: `${row.examName}_试卷数量统计.xls`,
+        header: {
+          token: this.$ls.get("token")
+        }
+      }).catch(error => {
+        this.$message.error(error);
+      });
+
+      load.close();
+      if (!data) return;
+      this.$message.success("文件已开始下载!");
+    },
     toDetail(row) {
       this.$router.push({
         name: "ExamRomeDetail",

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

@@ -257,7 +257,8 @@ export default {
       const newAttachment = {
         name: this.abc[this.curPaperAttachments.length],
         attachmentId: "",
-        filename: ""
+        filename: "",
+        pages: 0
       };
       this.curPaperAttachments.push(newAttachment);
     },