zhangjie 1 year ago
parent
commit
d2866f5149
2 changed files with 14 additions and 11 deletions
  1. 1 3
      src/modules/record/api.js
  2. 13 8
      src/modules/record/components/DocumentDetailDialog.vue

+ 1 - 3
src/modules/record/api.js

@@ -87,9 +87,7 @@ export const documentDetialListPage = (datas) => {
   return $postParam("/api/admin/paper/document/detail", datas);
 };
 export const documentDetialDownload = (datas) => {
-  return $postParam("/api/admin/paper/document/download", datas, {
-    responseType: "blob",
-  });
+  return $postParam("/api/admin/paper/document/download", datas);
 };
 export const documentOtherDetialListPage = (datas) => {
   return $postParam("/api/admin/paper/document/other_detail", datas);

+ 13 - 8
src/modules/record/components/DocumentDetailDialog.vue

@@ -143,6 +143,7 @@
             @click="toDownload"
             >批量下载</el-button
           >
+          <el-button type="success" @click="viewResult">下载结果</el-button>
         </div>
       </div>
 
@@ -215,6 +216,11 @@
       ref="ArchivesDetailStudentDialog"
       :student="curRow"
     ></archives-detail-student-dialog>
+    <!-- DataTaskDialog -->
+    <data-task-dialog
+      ref="DataTaskDialog"
+      task-type="PAPER_DOWNLOAD"
+    ></data-task-dialog>
   </div>
 </template>
 
@@ -222,11 +228,11 @@
 import { documentDetialListPage, documentDetialDownload } from "../api";
 import { BOUND_TYPE } from "@/constants/enumerate";
 import ArchivesDetailStudentDialog from "./ArchivesDetailStudentDialog.vue";
-import { downloadByApi } from "@/plugins/download";
+import DataTaskDialog from "../../base/components/DataTaskDialog.vue";
 
 export default {
   name: "document-detail-dialog",
-  components: { ArchivesDetailStudentDialog },
+  components: { ArchivesDetailStudentDialog, DataTaskDialog },
   props: {
     task: {
       type: Object,
@@ -296,15 +302,11 @@ export default {
       if (this.loading) return;
       this.loading = true;
 
-      const res = await downloadByApi(() => {
-        return documentDetialDownload(this.filter);
-      }).catch((e) => {
-        this.$message.error(e || "下载失败,请重新尝试!");
-      });
+      const res = await documentDetialDownload(this.filter).catch(() => {});
       this.loading = false;
 
       if (!res) return;
-      this.$message.success("下载成功!");
+      this.$message.success("任务提交成功,结果请在下载结果中查看!");
     },
     toDetail(row) {
       if (!row.bindCount) return;
@@ -316,6 +318,9 @@ export default {
       };
       this.$refs.ArchivesDetailStudentDialog.open();
     },
+    viewResult() {
+      this.$refs.DataTaskDialog.open();
+    },
   },
 };
 </script>