diff --git a/resources/assets/js/pages/manage/components/TaskDetail.vue b/resources/assets/js/pages/manage/components/TaskDetail.vue index 29214922a..f6f94acde 100644 --- a/resources/assets/js/pages/manage/components/TaskDetail.vue +++ b/resources/assets/js/pages/manage/components/TaskDetail.vue @@ -246,9 +246,9 @@
- - {{$L('截止时间')}} - + {{$L('截止时间')}} + + {{$L('截止时间')}}
@@ -278,7 +278,8 @@ @on-ok="timeOk" transfer>
- +
{{taskDetail.end_at ? cutTime : '--'}}
+
{{taskDetail.end_at ? cutTime : '--'}}
@@ -494,13 +495,12 @@ width: '90%', maxWidth: '450px' }" - @on-ok="onDelay" >
@@ -508,6 +508,10 @@
+
+ + +
@@ -621,10 +625,10 @@ export default { updateParams: {}, - delayTaskLoading: false, delayTaskShow: false, + delayTaskLoading: false, delayTaskForm: { - time: 12, + time: "24", remark: '' }, delayTaskRule: { @@ -1689,22 +1693,33 @@ export default { } }, - onDeforeClose(){ - return new Promise((resolve, reject) => {}) - }, - onDelay(){ - this.delayTaskShow = true - // this.delayTaskLoading = true; this.$refs['formDelayTaskRef'].validate((valid) => { - if (valid) { - this.$Message.success('Success!'); - } else { - this.$Message.error('Fail!'); + if (!valid) { + return; } - // this.delayTaskLoading = false; + this.delayTaskLoading = true; + var date = new Date(this.taskDetail.end_at); + date.setHours(date.getHours() + Number(this.delayTaskForm.time)); + this.$store.dispatch("taskUpdate", { + task_id: this.taskDetail.id, + times: [ + this.taskDetail.start_at, + $A.formatDate('Y-m-d H:i:s', date), + this.delayTaskForm.remark, + ], + }).then(({msg}) => { + $A.messageSuccess(msg); + this.delayTaskLoading = false; + this.delayTaskShow = false; + this.delayTaskForm.time = '24'; + this.delayTaskForm.remark = ''; + this.$store.dispatch("getTaskOne", this.taskDetail.id).catch(() => {}) + }).catch(({msg}) => { + $A.modalError(msg); + this.delayTaskLoading = false; + }) }) - return true }, updateVisible() { diff --git a/resources/assets/js/pages/manage/file.vue b/resources/assets/js/pages/manage/file.vue index a6e46b6ce..d484e34a0 100644 --- a/resources/assets/js/pages/manage/file.vue +++ b/resources/assets/js/pages/manage/file.vue @@ -247,13 +247,16 @@
- 打包列表 ({{packList.length}}) - 清空已完成 + {{$L('打包列表')}}({{packList.length}}) + {{$L('清空已完成')}}
  • - {{packName(item)}} - {{item.response.msg}} + + {{item.name}} + {{item.name}} + + {{item.response.msg}}
  • @@ -765,7 +768,7 @@ export default { }, computed: { - ...mapState(['systemConfig', 'userIsAdmin', 'userInfo', 'fileLists', 'wsOpenNum', 'windowWidth']), + ...mapState(['systemConfig', 'userIsAdmin', 'userInfo', 'fileLists', 'wsOpenNum', 'windowWidth', 'filePackLists']), pid() { const {folderId} = this.$route.params; @@ -960,7 +963,15 @@ export default { this.wsOpenTimeout = setTimeout(() => { this.$route.name == 'manage-file' && this.getFileList(); }, 5000) - } + }, + + + filePackLists: { + handler() { + this.updatePackProgress() + }, + deep: true + }, }, methods: { @@ -1446,11 +1457,6 @@ export default { }, /********************文件打包下载部分************************/ - - packName(item) { - return item.name; - }, - packPercentageParse(val) { return parseInt(val, 10); }, @@ -1465,44 +1471,31 @@ export default { this.packList.push(file); this.uploadShow = false; // 隐藏上传列表 this.packShow = true; // 显示打包列表 + }, - const downloadInterval = setInterval(async () => { - const pack = this.$store.state.packLists.find(({name}) => name == filePackName) + updatePackProgress () { + this.packList.forEach(file=>{ + const pack = this.filePackLists.find(({name}) => name == file.name) file.percentage = Math.max(1, pack.progress); - if (file.percentage >= 100) { + if (file.status != 'finished' && file.percentage >= 100) { file.status = 'finished'; - clearInterval(downloadInterval); // 下载文件 - await this.downloadPackFile(filePackName); + this.downloadPackFile(file.name); } - }, 1000); + }) }, async downloadPackFile(filePackName) { - // 延时 1 秒,等待服务器打包完成 - await new Promise(resolve => setTimeout(resolve, 1000)); const downloadUrl = $A.apiUrl(`file/download/confirm?name=${filePackName}&token=${this.userToken}`); - try { - const response = await axios({ - url: downloadUrl, - method: 'GET', - responseType: 'blob', - }); - - if (!response.data) { - console.error('No data received from server'); - return; - } - - const blob = new Blob([response.data], { type: response.data.type }); - const url = window.URL.createObjectURL(blob); + if (!$A.Electron && !$A.isEEUiApp) { const link = document.createElement('a'); - link.href = url; + link.setAttribute('href', downloadUrl); link.setAttribute('download', `${filePackName}`); document.body.appendChild(link); link.click(); document.body.removeChild(link); - } catch (error) { + }else{ + this.$store.dispatch('downUrl', downloadUrl) } }, @@ -1522,7 +1515,7 @@ export default { okText: '确定', onOk: async () => { try { - const { msg } = await this.$store.dispatch("call", { + await this.$store.dispatch("call", { url: 'file/download/check', data: { ids }, }); diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js index 6e94b4d22..f17a0eb63 100644 --- a/resources/assets/js/store/actions.js +++ b/resources/assets/js/store/actions.js @@ -929,12 +929,12 @@ export default { packProgress({state, dispatch}, data) { $A.execMainDispatch("packProgress", data) // - const index = state.packLists.findIndex(({name}) => name == data.name); + const index = state.filePackLists.findIndex(({name}) => name == data.name); if (index > -1) { - state.packLists[index].progress = data.progress; + state.filePackLists[index].progress = data.progress; } else { - state.packLists.push(data); - $A.IDBSave("packLists", state.packLists, 600) + state.filePackLists.push(data); + $A.IDBSave("filePackLists", state.filePackLists, 600) } }, diff --git a/resources/assets/js/store/state.js b/resources/assets/js/store/state.js index 2917228ec..3d61f88df 100644 --- a/resources/assets/js/store/state.js +++ b/resources/assets/js/store/state.js @@ -118,7 +118,7 @@ export default { // 文件 fileLists: [], fileLinks: [], - packLists: [], + filePackLists: [], // 项目任务 projectId: 0,