|
@@ -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("导出失败,请重新尝试!");
|
|
|
+ }
|
|
|
},
|
|
|
},
|
|
|
};
|