Pārlūkot izejas kodu

档案中心下载调整

ljb 8 mēneši atpakaļ
vecāks
revīzija
58bedae5f9
1 mainītis faili ar 14 papildinājumiem un 13 dzēšanām
  1. 14 13
      src/views/archive-manage/archive-list.vue

+ 14 - 13
src/views/archive-manage/archive-list.vue

@@ -248,23 +248,24 @@ export default window.$crudCommon({
       };
       if (type) {}
       let storeName = `taskType${type}`;
-      let taskId = getStore({ name: storeName });
-      if (taskId) {
-        exportBlob(`${downUrl}?${this.website.tokenHeader}=${getToken()}`, { taskId }).then(res => {
-          downloadXls(res.data, `${this.params.year}年${fileNameObj[type]}.zip`);
-        });
-      } else {
-        generateTaskId({ yearAndMonth: this.params.year, type: 0 }).then(res => {
-          if (res.data.code == 200) {
-            let taskId = res.data.data.id;
-            setStore({ name: storeName, content: taskId });
+      let taskId = getStore({ name: storeName }) || undefined;
+
+      generateTaskId({ yearAndMonth: this.params.year, type, id: taskId }).then(res => {
+        if (res.data.code == 200) {
+          const { id, status } = res.data.data;
+          let taskId = id;
+          setStore({ name: storeName, content: taskId });
+
+          if (status == 2) {
             exportBlob(`${downUrl}?${this.website.tokenHeader}=${getToken()}`, { taskId }).then(res => {
               downloadXls(res.data, `${this.params.year}年${fileNameObj[type]}.zip`);
             });
+          } else {
+            this.$message.warning("下载任务正在生成中,请您耐心等待...");
           }
-          
-        })
-      }
+        }
+        
+      })
     },
     handleRowDown() {
       this.$message.warning("功能建设中...");