From bd82d0bba82cbe3e58f7de319b5c62fe9170e85b Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Tue, 1 Jun 2021 15:46:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E3=80=81=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96=E5=88=B7=E6=96=B0=E6=A8=A1=E5=9D=97=E6=A0=91=E9=A2=91?= =?UTF-8?q?=E7=B9=81=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在接口定义、接口自动化页面增加表格刷新动作参数,用来修复接口定义、接口自动化刷新模块树频繁的问题。如果是树模块引起的表格数据变化,不再回调更新树函数。 --- .../components/api/automation/ApiAutomation.vue | 11 ++++++++++- .../api/automation/scenario/ApiScenarioList.vue | 15 +++++++++++++-- .../components/api/definition/ApiDefinition.vue | 12 +++++++++++- .../api/definition/components/list/ApiList.vue | 15 +++++++++++++-- .../common/components/table/MsTable.vue | 2 ++ 5 files changed, 49 insertions(+), 6 deletions(-) diff --git a/frontend/src/business/components/api/automation/ApiAutomation.vue b/frontend/src/business/components/api/automation/ApiAutomation.vue index b5d4e44dd1..6b3097575c 100644 --- a/frontend/src/business/components/api/automation/ApiAutomation.vue +++ b/frontend/src/business/components/api/automation/ApiAutomation.vue @@ -33,6 +33,8 @@ @edit="editScenario" @changeSelectDataRangeAll="changeSelectDataRangeAll" :custom-num="customNum" + :init-api-table-opretion="initApiTableOpretion" + @updateInitApiTableOpretion="updateInitApiTableOpretion" ref="apiScenarioList"/> @@ -123,7 +125,9 @@ export default { selectNodeIds: [], nodeTree: [], currentModulePath: "", - customNum: false + customNum: false, + //影响API表格刷新的操作。 为了防止高频率刷新模块列表用。如果是模块更新而造成的表格刷新,则不回调模块刷新方法 + initApiTableOpretion: 'init', }; }, mounted() { @@ -341,6 +345,7 @@ export default { }, nodeChange(node, nodeIds, pNodes) { + this.initApiTableOpretion = "nodeChange"; this.selectNodeIds = nodeIds; }, setModuleOptions(data) { @@ -354,6 +359,7 @@ export default { }, enableTrash(data) { this.activeName = "default"; + this.initApiTableOpretion = "enableTrash"; this.trashEnable = data; }, getProject() { @@ -363,6 +369,9 @@ export default { this.customNum = data.scenarioCustomNum; } }); + }, + updateInitApiTableOpretion(param){ + this.initApiTableOpretion = param; } } }; diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue index 76a0a0f2b7..7d35baa0c2 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue @@ -275,7 +275,8 @@ export default { customNum: { type: Boolean, default: false - } + }, + initApiTableOpretion: String, }, data() { return { @@ -426,7 +427,9 @@ export default { this.search(); }, search(projectId) { - this.$emit('refreshTree'); + if(this.needRefreshModule()){ + this.$emit('refreshTree'); + } this.selectRows = new Set(); this.condition.moduleIds = this.selectNodeIds; if (this.trashEnable) { @@ -866,6 +869,14 @@ export default { }, getConditions() { return this.condition; + }, + needRefreshModule(){ + if(this.initApiTableOpretion === '0'){ + return true; + }else { + this.$emit('updateInitApiTableOpretion','0'); + return false; + } } } }; diff --git a/frontend/src/business/components/api/definition/ApiDefinition.vue b/frontend/src/business/components/api/definition/ApiDefinition.vue index f6173ef1f8..fa9ba38755 100644 --- a/frontend/src/business/components/api/definition/ApiDefinition.vue +++ b/frontend/src/business/components/api/definition/ApiDefinition.vue @@ -55,6 +55,8 @@ @handleCase="handleCase" @showExecResult="showExecResult" @refreshTable="refresh" + :init-api-table-opretion="initApiTableOpretion" + @updateInitApiTableOpretion="updateInitApiTableOpretion" ref="apiList"/> diff --git a/frontend/src/business/components/common/components/table/MsTable.vue b/frontend/src/business/components/common/components/table/MsTable.vue index 8cb719e1d5..450db8a55b 100644 --- a/frontend/src/business/components/common/components/table/MsTable.vue +++ b/frontend/src/business/components/common/components/table/MsTable.vue @@ -12,6 +12,7 @@ class="test-content adjust-table ms-table" :class="{'ms-select-all-fixed':showSelectAll}" :height="screenHeight" + v-loading="result.loading" ref="table" @row-click="handleRowClick"> @@ -79,6 +80,7 @@ export default { return { selectDataCounts: 0, selectRows: new Set(), + result: {}, selectIds: [] }; },