Bladeren bron

exam export add

zhangjie 4 jaren geleden
bovenliggende
commit
2ae558189c
3 gewijzigde bestanden met toevoegingen van 66 en 16 verwijderingen
  1. 34 8
      src/constants/enumerate.js
  2. 1 1
      src/modules/card/components/SavePage.vue
  3. 31 7
      src/modules/exam-center/views/ExamManage.vue

+ 34 - 8
src/constants/enumerate.js

@@ -16,14 +16,40 @@ export const BOOLEAN_TYPE = {
 };
 
 // 打印状态
-export const PRINT_STATUS = {
-  0: "未开始",
-  1: "命题中",
-  2: "待打印",
-  3: "打印中",
-  4: "已打印",
-  9: "无"
-};
+// export const PRINT_STATUS = {
+//   "3": "未开始",
+//   "4": "命题中",
+//   "0": "待打印",
+//   "1": "打印中",
+//   "2": "已打印",
+//   "9": "无"
+// };
+export const PRINT_STATUS = [
+  {
+    key: "3",
+    name: "未开始"
+  },
+  {
+    key: "4",
+    name: "命题中"
+  },
+  {
+    key: "0",
+    name: "待打印"
+  },
+  {
+    key: "1",
+    name: "打印中"
+  },
+  {
+    key: "2",
+    name: "已打印"
+  },
+  {
+    key: "9",
+    name: "无"
+  }
+];
 // 撤回状态
 export const REVOKE_STATUS = {
   0: "待确认",

+ 1 - 1
src/modules/card/components/SavePage.vue

@@ -176,7 +176,7 @@ export default {
           horizontal: false,
           items: listInfos
         });
-      } else if (element.examNumberStyle === "auto") {
+      } else {
         // barcode
         barcode.push({
           field: "examNumber",

+ 31 - 7
src/modules/exam-center/views/ExamManage.vue

@@ -25,10 +25,10 @@
             clearable
           >
             <el-option
-              v-for="(val, key) in PRINT_STATUS"
-              :key="key"
-              :value="key"
-              :label="val"
+              v-for="item in PRINT_STATUS"
+              :key="item.key"
+              :value="item.key"
+              :label="item.name"
             ></el-option>
           </el-select>
           <el-popover
@@ -105,13 +105,13 @@
               @click="toDelete(scope.row)"
               title="删除"
             ></el-button>
-            <!-- TODO:打印状态为已打印时可见 -->
             <el-button
               class="btn-table-icon"
               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"
@@ -141,6 +141,7 @@
 <script>
 import { PRINT_STATUS } from "@/constants/enumerate";
 import { examListPage, examList, deleteExam } from "../api";
+import { download } from "@/plugins/utils";
 
 export default {
   name: "exam-manage",
@@ -163,6 +164,9 @@ export default {
   created() {
     this.init();
   },
+  mounted() {
+    console.log(this);
+  },
   methods: {
     init() {
       this.getList();
@@ -230,8 +234,28 @@ export default {
         }
       });
     },
-    toExport(row) {
+    async toExport(row) {
       console.log(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/expPrintCount?examId=1267628105772736513`,
+        url: `/api/print/exam/exam/expPrintCount?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({