|
@@ -89,7 +89,8 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
beforeDestroy() {
|
|
beforeDestroy() {
|
|
|
- clearTimeout(this._timout);
|
|
|
|
|
|
|
+ this._timout && clearTimeout(this._timout);
|
|
|
|
|
+ this._checkTimeout && clearTimeout(this._checkTimeout);
|
|
|
this.$store.commit("SET_TASK_OPEND_STATUS", false);
|
|
this.$store.commit("SET_TASK_OPEND_STATUS", false);
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
@@ -110,6 +111,9 @@ export default {
|
|
|
* @param fileType 文件类型
|
|
* @param fileType 文件类型
|
|
|
*/
|
|
*/
|
|
|
checkTaskId(yearAndMonth, fileType) {
|
|
checkTaskId(yearAndMonth, fileType) {
|
|
|
|
|
+ if (this._checkTimeout) {
|
|
|
|
|
+ clearTimeout(this._checkTimeout);
|
|
|
|
|
+ }
|
|
|
let storeTaskId = getStore({ name: this.taskStoreName }) || undefined;
|
|
let storeTaskId = getStore({ name: this.taskStoreName }) || undefined;
|
|
|
generateTaskId({ yearAndMonth, type: fileType, id: storeTaskId }).then(taskRes => {
|
|
generateTaskId({ yearAndMonth, type: fileType, id: storeTaskId }).then(taskRes => {
|
|
|
if (taskRes.data.code == 200) {
|
|
if (taskRes.data.code == 200) {
|
|
@@ -124,9 +128,13 @@ export default {
|
|
|
this.downloadZip(yearAndMonth, taskId, fileType, fileSize);
|
|
this.downloadZip(yearAndMonth, taskId, fileType, fileSize);
|
|
|
} else if (status == 3) {
|
|
} else if (status == 3) {
|
|
|
removeStore({ name: this.taskStoreName });
|
|
removeStore({ name: this.taskStoreName });
|
|
|
- this.checkTaskId(yearAndMonth, fileType);
|
|
|
|
|
|
|
+ this._checkTimeout = setTimeout(() => {
|
|
|
|
|
+ this.checkTaskId(yearAndMonth, fileType);
|
|
|
|
|
+ }, 3000)
|
|
|
} else {
|
|
} else {
|
|
|
- this.checkTaskId(yearAndMonth, fileType);
|
|
|
|
|
|
|
+ this._checkTimeout = setTimeout(() => {
|
|
|
|
|
+ this.checkTaskId(yearAndMonth, fileType);
|
|
|
|
|
+ }, 3000)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -149,15 +157,14 @@ export default {
|
|
|
const progress = Math.round((progressEvent.loaded * 100) / fileSize);
|
|
const progress = Math.round((progressEvent.loaded * 100) / fileSize);
|
|
|
this.downPercent = progress;
|
|
this.downPercent = progress;
|
|
|
}).then(res => {
|
|
}).then(res => {
|
|
|
- this.$message.success('文件下载成功!');
|
|
|
|
|
- downloadXls(res.data, `${this.downloadTitle}.zip`);
|
|
|
|
|
-
|
|
|
|
|
this._timout = setTimeout(() => {
|
|
this._timout = setTimeout(() => {
|
|
|
|
|
+ this.$message.success('文件下载成功!');
|
|
|
|
|
+ downloadXls(res.data, `${this.downloadTitle}.zip`);
|
|
|
this.downPercent = 0;
|
|
this.downPercent = 0;
|
|
|
this.showDownLoading = false;
|
|
this.showDownLoading = false;
|
|
|
this.showSucc = true;
|
|
this.showSucc = true;
|
|
|
this.$store.commit("SET_TASK_OPEND_STATUS", false);
|
|
this.$store.commit("SET_TASK_OPEND_STATUS", false);
|
|
|
- }, 500)
|
|
|
|
|
|
|
+ }, 800)
|
|
|
}).catch(() => {
|
|
}).catch(() => {
|
|
|
this.$message.error("文件下载失败!");
|
|
this.$message.error("文件下载失败!");
|
|
|
this.showError = true;
|
|
this.showError = true;
|