From 132604b1fd026b71e346eb4ff915698f76254048 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Wed, 2 Nov 2022 14:51:59 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E4=BB=BB=E5=8A=A1=E4=B8=AD=E5=BF=83):?= =?UTF-8?q?=20=E4=BB=BB=E5=8A=A1=E7=BB=9F=E8=AE=A1=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=8F=AA=E7=BB=9F=E8=AE=A1=E5=B7=B2=E7=BB=8F=E5=BC=80=E5=A7=8B?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E7=9A=84=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/task/TaskCenter.vue | 42 ++++++++----------- .../base/mapper/ext/BaseTaskMapper.xml | 6 +-- 2 files changed, 21 insertions(+), 27 deletions(-) diff --git a/framework/sdk-parent/frontend/src/components/task/TaskCenter.vue b/framework/sdk-parent/frontend/src/components/task/TaskCenter.vue index 61d76e924b..65e66e24c8 100644 --- a/framework/sdk-parent/frontend/src/components/task/TaskCenter.vue +++ b/framework/sdk-parent/frontend/src/components/task/TaskCenter.vue @@ -43,7 +43,7 @@ - @@ -51,7 +51,8 @@ - @@ -62,7 +63,7 @@ + style="margin-right: 10px" @change="init(true)" :disabled="isDebugHistory"> - + {{ tab.label }} - {{ tab.label }} + {{ tab.label }} { this.$success(this.$t('report.test_stop_success')); - this.init(); + this.init(true); }); } else { let array = []; @@ -241,7 +241,7 @@ export default { array.push({type: 'UI_SCENARIO', projectId: getCurrentProjectID(), userId: getCurrentUser().id}); stopBatchTask(array).then(response => { this.$success(this.$t('report.test_stop_success')); - this.init(); + this.init(true); }); } }, @@ -266,13 +266,12 @@ export default { onMessage(e) { this.loading = false; this.runningData = JSON.parse(e.data); + if (this.runningData) { + this.setActiveName(); + } this.runningTotal = this.runningData.total; - this.initIndex++; - if (this.taskVisible && this.initEnd) { - setTimeout(() => { - this.initEnd = false; - this.init(); - }, 3000); + if (this.runningTotal > 0) { + this.init(false); } }, onClose(e) { @@ -280,7 +279,7 @@ export default { showTaskCenter() { this.getTaskRunning(); this.getMaintainerOptions(); - this.init(); + this.init(true); this.taskVisible = true; }, close() { @@ -296,7 +295,6 @@ export default { this.activeName = activeName; } this.showTaskCenter(); - this.initIndex = 0; }, getPercentage(status) { if (status) { @@ -384,24 +382,20 @@ export default { nextPage(currentPage, pageSize) { this.currentPage = currentPage; this.pageSize = pageSize; - this.init(); + this.init(true); }, - init() { + init(loading) { if (this.showType === "CASE" || this.showType === "SCENARIO") { return; } this.condition.projectId = getCurrentProjectID(); this.condition.userId = getCurrentUser().id; - if (this.runningData) { - this.setActiveName(); - } this.condition.activeName = this.activeName; - this.loading = true; + this.loading = loading; this.result = getTaskList(this.condition, this.currentPage, this.pageSize) .then(response => { this.total = response.data.itemCount; this.taskData = response.data.listObject; - this.initEnd = true; this.loading = false; }); }, @@ -594,7 +588,7 @@ export default { .ms-badge-item { margin-top: 0px; margin-right: 0px; - font-size: 12px; + font-size: 13px; } :deep(.el-badge__content.is-fixed) { diff --git a/framework/sdk-parent/sdk/src/main/java/io/metersphere/base/mapper/ext/BaseTaskMapper.xml b/framework/sdk-parent/sdk/src/main/java/io/metersphere/base/mapper/ext/BaseTaskMapper.xml index 68c3655d91..01abf67853 100644 --- a/framework/sdk-parent/sdk/src/main/java/io/metersphere/base/mapper/ext/BaseTaskMapper.xml +++ b/framework/sdk-parent/sdk/src/main/java/io/metersphere/base/mapper/ext/BaseTaskMapper.xml @@ -165,7 +165,7 @@ AND t.user_id = #{request.executor} - AND t.status IN ("running","starting","pending") + AND t.status IN ("running","starting") ) as scenarioTotal , (SELECT @@ -199,7 +199,7 @@ AND t.user_id = #{request.executor} - AND t.status IN ("running","starting","pending") + AND t.status IN ("running","starting") ), (SELECT @@ -262,7 +262,7 @@ AND t.user_id = #{request.executor} - AND t.status IN ("running","starting","pending") + AND t.status IN ("running","starting") ) as perfTotal