zhangjie hai 1 ano
pai
achega
0e9fedae8c

+ 12 - 3
src/api/invigilation.js

@@ -377,7 +377,10 @@ export function exportReportStatisticsData(datas) {
   const data = pickBy(datas, paramFilter);
   return httpApp.post(
     "/api/admin/report/exam_view_count/export?" + object2QueryString(data),
-    {}
+    {},
+    {
+      responseType: "blob",
+    }
   );
 }
 // report-absent
@@ -392,7 +395,10 @@ export function exportReportAbsentData(datas) {
   const data = pickBy(datas, paramFilter);
   return httpApp.post(
     "/api/admin/report/exam_deficiency_list/export?" + object2QueryString(data),
-    {}
+    {},
+    {
+      responseType: "blob",
+    }
   );
 }
 // report-exception
@@ -438,7 +444,10 @@ export function exportReportBreachData(datas) {
   const data = pickBy(datas, paramFilter);
   return httpApp.post(
     "/api/admin/report/exam_breach_list/export?" + object2QueryString(data),
-    {}
+    {},
+    {
+      responseType: "blob",
+    }
   );
 }
 // report-cancel-breach

+ 17 - 4
src/features/invigilation/ExamReport/ReportAbsent.vue

@@ -4,6 +4,7 @@
       type="primary"
       icon="el-icon-download"
       style="margin: 0 0 10px"
+      :loading="isDownload"
       @click="exportData"
       >导出数据</el-button
     >
@@ -44,6 +45,7 @@
 
 <script>
 import { reportAbsentData, exportReportAbsentData } from "@/api/invigilation";
+import { downloadBlob } from "@/utils/utils";
 
 export default {
   name: "report-absent",
@@ -61,6 +63,7 @@ export default {
       total: 0,
       size: 10,
       dataList: [],
+      isDownload: false,
     };
   },
   mounted() {
@@ -87,10 +90,20 @@ export default {
       this.toPage(1);
     },
     async exportData() {
-      await exportReportAbsentData({
-        ...this.filter,
-      });
-      this.$notify({ title: "导入任务已成功启动", type: "success" });
+      this.isDownload = true;
+      const res = await downloadBlob(() => {
+        return exportReportAbsentData({
+          ...this.filter,
+        });
+      }).catch(() => {});
+
+      this.isDownload = false;
+
+      if (res) {
+        this.$message.success("导出成功!");
+      } else {
+        this.$message.error("导出失败,请重新尝试!");
+      }
     },
   },
 };

+ 17 - 4
src/features/invigilation/ExamReport/ReportBreach.vue

@@ -4,6 +4,7 @@
       type="primary"
       icon="el-icon-download"
       style="margin: 0 0 10px"
+      :loading="isDownload"
       @click="exportData"
       >导出数据</el-button
     >
@@ -62,6 +63,7 @@
 <script>
 import { reportBreachData, exportReportBreachData } from "@/api/invigilation";
 import BreachDetailDialog from "./BreachDetailDialog";
+import { downloadBlob } from "@/utils/utils";
 
 export default {
   name: "report-breach",
@@ -81,6 +83,7 @@ export default {
       size: 10,
       dataList: [],
       detailId: "",
+      isDownload: false,
     };
   },
   mounted() {
@@ -111,10 +114,20 @@ export default {
       this.$refs.BreachDetailDialog.open();
     },
     async exportData() {
-      await exportReportBreachData({
-        ...this.filter,
-      });
-      this.$notify({ title: "导入任务已成功启动", type: "success" });
+      this.isDownload = true;
+      const res = await downloadBlob(() => {
+        return exportReportBreachData({
+          ...this.filter,
+        });
+      }).catch(() => {});
+
+      this.isDownload = false;
+
+      if (res) {
+        this.$message.success("导出成功!");
+      } else {
+        this.$message.error("导出失败,请重新尝试!");
+      }
     },
   },
 };

+ 17 - 4
src/features/invigilation/ExamReport/ReportStatistics.vue

@@ -4,6 +4,7 @@
       type="primary"
       icon="el-icon-download"
       style="margin: 0 0 10px"
+      :loading="isDownload"
       @click="exportData"
       >导出数据</el-button
     >
@@ -62,6 +63,7 @@ import {
   reportStatisticsData,
   exportReportStatisticsData,
 } from "@/api/invigilation";
+import { downloadBlob } from "@/utils/utils";
 
 export default {
   name: "report-statistics",
@@ -82,6 +84,7 @@ export default {
       actualExamTotal: 0,
       deficiencyExamTotal: 0,
       dataList: [],
+      isDownload: false,
     };
   },
   mounted() {
@@ -120,10 +123,20 @@ export default {
       this.getTotalCount();
     },
     async exportData() {
-      await exportReportStatisticsData({
-        ...this.filter,
-      });
-      this.$notify({ title: "导入任务已成功启动", type: "success" });
+      this.isDownload = true;
+      const res = await downloadBlob(() => {
+        return exportReportStatisticsData({
+          ...this.filter,
+        });
+      }).catch(() => {});
+
+      this.isDownload = false;
+
+      if (res) {
+        this.$message.success("导出成功!");
+      } else {
+        this.$message.error("导出失败,请重新尝试!");
+      }
     },
   },
 };