diff --git a/src/views/taskManagement/aiList/taskList.vue b/src/views/taskManagement/aiList/taskList.vue index 6f3429f..7238e09 100644 --- a/src/views/taskManagement/aiList/taskList.vue +++ b/src/views/taskManagement/aiList/taskList.vue @@ -286,32 +286,80 @@ export default { dangerouslyUseHTMLString: true, confirmButtonText: '确认', center: true, - cancelButtonText: '取消' - }).then(() => { - type === 1 ? startDeployInstance(data).then(e => { - this.$message.success(this.$t('message.success')) - this.freshAllList() - }) - : startAllInstance(allId).then(e => { - this.$message.success(this.$t('message.success')) - this.freshAllList() - }) + cancelButtonText: '取消', + beforeClose: (action, instance, done) => { + if (action === 'confirm') { + instance.showCancelButton = false + instance.confirmButtonLoading = true + instance.confirmButtonText = '执行中...' + type === 1 ? startDeployInstance(data).then(e => { + this.$message.success(this.$t('message.success')) + instance.confirmButtonLoading = false + instance.confirmButtonText = '确认' + instance.showCancelButton = true + done() + this.freshAllList() + }).catch(e => { + instance.confirmButtonLoading = false + instance.confirmButtonText = '确认' + instance.showCancelButton = true + }) + : startAllInstance(allId).then(e => { + this.$message.success(this.$t('message.success')) + instance.confirmButtonLoading = false + instance.confirmButtonText = '确认' + instance.showCancelButton = true + done() + this.freshAllList() + }).catch(e => { + instance.confirmButtonLoading = false + instance.confirmButtonText = '确认' + instance.showCancelButton = true + }) + } else { + done() + } + } }) } else { this.$confirm('

确定要停止么?

', '温馨提示', { dangerouslyUseHTMLString: true, confirmButtonText: '确认', center: true, - cancelButtonText: '取消' - }).then(() => { - type === 2 ? stopDeployInstance(data).then(e => { - this.$message.success(this.$t('message.success')) - this.freshAllList() - }) - : stopAllInstance(allId).then(e => { - this.$message.success(this.$t('message.success')) - this.freshAllList() - }) + cancelButtonText: '取消', + beforeClose: (action, instance, done) => { + if (action === 'confirm') { + instance.showCancelButton = false + instance.confirmButtonLoading = true + instance.confirmButtonText = '执行中...' + type === 2 ? stopDeployInstance(data).then(e => { + this.$message.success(this.$t('message.success')) + instance.confirmButtonLoading = false + instance.confirmButtonText = '确认' + instance.showCancelButton = true + done() + this.freshAllList() + }).catch(e => { + instance.confirmButtonLoading = false + instance.confirmButtonText = '确认' + instance.showCancelButton = true + }) + : stopAllInstance(allId).then(e => { + this.$message.success(this.$t('message.success')) + instance.confirmButtonLoading = false + instance.confirmButtonText = '确认' + instance.showCancelButton = true + done() + this.freshAllList() + }).catch(e => { + instance.confirmButtonLoading = false + instance.confirmButtonText = '确认' + instance.showCancelButton = true + }) + } else { + done() + } + } }) } }