From c4f393cde5319ba4c1ae6cbd83a80519ccd0bb3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=81=93=E7=94=AB?= Date: Sun, 12 Dec 2021 13:22:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=89=B9=E9=87=8F=E6=93=8D?= =?UTF-8?q?=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../node/node-layout/project/project-list.vue | 88 ++++++++++++++++--- 1 file changed, 75 insertions(+), 13 deletions(-) diff --git a/web-vue/src/pages/node/node-layout/project/project-list.vue b/web-vue/src/pages/node/node-layout/project/project-list.vue index fe845a26c..28fcfda0f 100644 --- a/web-vue/src/pages/node/node-layout/project/project-list.vue +++ b/web-vue/src/pages/node/node-layout/project/project-list.vue @@ -688,17 +688,37 @@ export default { this.$notification.warning({ message: "请选中要启动的项目", }); + return; } + let $global_loading = this.$loading.service({ + lock: true, + text: "批量启动中,请稍候...", + spinner: "el-icon-loading", + background: "rgba(0, 0, 0, 0.7)", + }); + let count = 0; this.selectedRows.forEach((value) => { - if (value.status == false && value.runMode !== "File") { + if (value.status === undefined && value.runMode !== "File") { + count++; const params = { nodeId: this.node.id, id: value.id, }; - //console.log(this.list[value]); - startProject(params).then(() => { - this.loadData(); - }); + startProject(params) + .then(() => { + count--; + if (count == 0) { + this.loadData(); + $global_loading.close(); + } + }) + .catch(() => { + count--; + if (count == 0) { + this.loadData(); + $global_loading.close(); + } + }); } }); }, @@ -708,16 +728,37 @@ export default { this.$notification.warning({ message: "请选中要重启的项目", }); + return; } + let $global_loading = this.$loading.service({ + lock: true, + text: "批量重启中,请稍候...", + spinner: "el-icon-loading", + background: "rgba(0, 0, 0, 0.7)", + }); + let count = 0; this.selectedRows.forEach((value) => { - if (value.runMode != "File") { + if (value.status === true && value.runMode != "File") { const params = { nodeId: this.node.id, id: value.id, }; - restartProject(params).then(() => { - this.loadData(); - }); + count++; + restartProject(params) + .then(() => { + count--; + if (count == 0) { + this.loadData(); + $global_loading.close(); + } + }) + .catch(() => { + count--; + if (count == 0) { + this.loadData(); + $global_loading.close(); + } + }); } }); }, @@ -727,16 +768,37 @@ export default { this.$notification.warning({ message: "请选中要关闭的项目", }); + return; } + let $global_loading = this.$loading.service({ + lock: true, + text: "批量关闭中,请稍候...", + spinner: "el-icon-loading", + background: "rgba(0, 0, 0, 0.7)", + }); + let count = 0; this.selectedRows.forEach((value) => { - if (value.status == true && value.runMode != "File") { + if (value.status === true && value.runMode != "File") { + count++; const params = { nodeId: this.node.id, id: value.id, }; - stopProject(params).then(() => { - this.loadData(); - }); + stopProject(params) + .then(() => { + count--; + if (count == 0) { + this.loadData(); + $global_loading.close(); + } + }) + .catch(() => { + count--; + if (count == 0) { + this.loadData(); + $global_loading.close(); + } + }); } }); },