zhangjie пре 2 година
родитељ
комит
1219fa9254

+ 11 - 42
src/modules/base/components/DataTaskDialog.vue

@@ -48,19 +48,19 @@
         >
           <template slot-scope="scope">
             <el-button
-              v-if="scope.row.hasReportFile"
+              v-if="scope.row.reportFile"
               class="btn-primary"
               type="text"
               :disabled="loading"
-              @click="toDonwloadLog(scope.row)"
+              @click="toDonwload(scope.row.reportFile)"
               >导出日志</el-button
             >
             <el-button
-              v-if="!scope.row.resetCreatePdf"
+              v-if="scope.row.resultFile"
               class="btn-primary"
               type="text"
               :disabled="loading"
-              @click="toDonwloadFile(scope.row)"
+              @click="toDonwload(scope.row.resultFile)"
               >下载文件</el-button
             >
           </template>
@@ -85,7 +85,6 @@
 
 <script>
 import { dataTaskList } from "../api";
-import { attachmentDownload } from "../../login/api";
 import { downloadByUrl } from "@/plugins/download";
 
 export default {
@@ -129,55 +128,25 @@ export default {
         pageSize: this.size
       };
       const data = await dataTaskList(datas);
-      this.dataList = data.records;
+      this.dataList = data.records.map(item => {
+        item.reportFile = item.txtFilePath;
+        item.resultFile = item.importFilePath || item.exportFilePath || "";
+        return item;
+      });
       this.total = data.total;
     },
     toPage(page) {
       this.current = page;
       this.getList();
     },
-    async toDonwloadLog(row) {
-      if (this.loading) return;
-
-      this.loading = true;
-      const res = await attachmentDownload({
-        id: row.id,
-        type: "TASK_REPORT"
-      }).catch(() => {});
-      this.loading = false;
-
-      if (!res) {
-        this.$message.error("文件下载失败,请重新尝试!");
-        return;
-      }
-
-      const url = res.url;
+    toDonwload(url) {
       if (url.endsWith(".txt")) {
         window.open(url);
         return;
       }
 
       downloadByUrl(url);
-      this.$message.success("文件下载成功!");
-    },
-    async toDonwloadFile(row) {
-      if (this.loading) return;
-
-      this.loading = true;
-      const type = row.hasResultFile ? "RESULT" : "IMPORT_FILE";
-      const res = await attachmentDownload({
-        id: row.id,
-        type
-      }).catch(() => {});
-      this.loading = false;
-
-      if (!res) {
-        this.$message.error("文件下载失败,请重新尝试!");
-        return;
-      }
-
-      downloadByUrl(res.url);
-      this.$message.success("文件下载成功!");
+      this.$message.success("文件开始成功!");
     }
   }
 };

+ 1 - 1
src/modules/base/views/OrganizationManage.vue

@@ -202,7 +202,7 @@ export default {
       this.$message.error(errorData.message);
     },
     uploadSuccess() {
-      this.getList();
+      this.$message.success("任务提交成功,结果请在导入结果中查看!");
     },
     viewResult() {
       this.$refs.DataTaskDialog.open();

+ 1 - 2
src/modules/base/views/StudentManage.vue

@@ -245,8 +245,7 @@ export default {
     },
     // import
     uploadSuccess() {
-      this.$message.success("文件上传成功,后台正在导入!");
-      this.getList();
+      this.$message.success("任务提交成功,结果请在导入结果中查看!");
     },
     viewResult() {
       this.$refs.DataTaskDialog.open();

+ 1 - 2
src/modules/base/views/UserManage.vue

@@ -321,8 +321,7 @@ export default {
     // },
     // import
     uploadSuccess() {
-      this.$message.success("导入成功!");
-      this.getList();
+      this.$message.success("任务提交成功,结果请在导入结果中查看!");
     },
     viewResult() {
       this.$refs.DataTaskDialog.open();

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

@@ -44,6 +44,9 @@ export const archivesListPage = datas => {
 export const archivesDetailListPage = datas => {
   return $postParam("/api/admin/paper/archives/page_detail", datas);
 };
+export const archivesDetailDownloadPaper = datas => {
+  return $postParam("/api/admin/paper/archives/paper_download", datas);
+};
 export const updateArchives = datas => {
   return $post("/api/admin/paper/archives/save", datas);
 };

+ 9 - 5
src/modules/record/views/ArchivesDetail.vue

@@ -155,7 +155,7 @@
 </template>
 
 <script>
-import { archivesDetailListPage } from "../api";
+import { archivesDetailListPage, archivesDetailDownloadPaper } from "../api";
 import { BOUND_TYPE } from "../../../constants/enumerate";
 import ArchivesDetailStudentDialog from "../components/ArchivesDetailStudentDialog.vue";
 import DataTaskDialog from "../../base/components/DataTaskDialog.vue";
@@ -215,11 +215,15 @@ export default {
       this.curRow = row;
       this.$refs.ArchivesDetailStudentDialog.open();
     },
-    toBatchDownload() {
-      if (!this.multipleSelection.length) {
-        this.$message.error("请选择要下载的数据!");
-        return;
+    async toBatchDownload() {
+      let datas = {};
+      if (this.multipleSelection.length) {
+        datas.ids = this.multipleSelection.join();
+      } else {
+        datas = { ...this.filter };
       }
+      await archivesDetailDownloadPaper(datas);
+      this.$message.success("下载任务提交成功,请在下载结果中查看任务进度!");
     },
     viewResult() {
       this.$refs.DataTaskDialog.open();

+ 1 - 2
src/modules/record/views/ScanTaskManage.vue

@@ -380,8 +380,7 @@ export default {
       return this.$refs.modalFormComp.validate();
     },
     uploadSuccess() {
-      this.$message.error("导入操作提交成功!");
-      this.getList();
+      this.$message.success("任务提交成功,结果请在导入结果中查看!");
     },
     viewResult() {
       this.$refs.DataTaskDialog.open();