Sfoglia il codice sorgente

新增导出试卷题卡操作

zhangjie 4 anni fa
parent
commit
eab2ab0584
2 ha cambiato i file con 37 aggiunte e 1 eliminazioni
  1. 3 0
      src/modules/exam/api.js
  2. 34 1
      src/modules/exam/views/TaskPaperManage.vue

+ 3 - 0
src/modules/exam/api.js

@@ -103,6 +103,9 @@ export const downloadPaper = examTaskId => {
     { responseType: "blob" }
   );
 };
+export const paperAndCardBatchExport = datas => {
+  return $postParam("/api/admin/exam/task/paper_card_download_pdf", datas);
+};
 
 // card
 export const cardForSelectList = datas => {

+ 34 - 1
src/modules/exam/views/TaskPaperManage.vue

@@ -38,6 +38,16 @@
           >
         </el-form-item>
       </el-form>
+      <div class="part-box-action">
+        <el-button
+          icon="el-icon-download"
+          type="primary"
+          :loading="loading"
+          @click="toBatchExport"
+        >
+          批量下载试卷题卡
+        </el-button>
+      </div>
     </div>
 
     <div class="part-box">
@@ -160,7 +170,12 @@
 </template>
 
 <script>
-import { taskPaperListPage, ableTaskPaper, downloadPaper } from "../api";
+import {
+  taskPaperListPage,
+  ableTaskPaper,
+  downloadPaper,
+  paperAndCardBatchExport
+} from "../api";
 import pickerOptions from "@/constants/datePickerOptions";
 import { downloadBlob } from "@/plugins/utils";
 import ModifyTaskPaper from "../components/ModifyTaskPaper";
@@ -287,6 +302,24 @@ export default {
       } else {
         this.$message.error("文件下载失败,请重新尝试!");
       }
+    },
+    async toBatchExport() {
+      // 异步导出
+      if (this.loading) return;
+
+      this.loading = true;
+      const res = await paperAndCardBatchExport({
+        ...this.filter
+      }).catch(() => {});
+      this.loading = false;
+
+      if (res) {
+        this.$message.success(
+          "导出任务已提交,请在数据管理-任务管理中下载文件!"
+        );
+      } else {
+        this.$message.error("导出任务提交失败,请重新尝试!");
+      }
     }
   },
   beforeRouteLeave(to, from, next) {