From 7713be6f96010943ba9e93512e53655769ea3191 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Thu, 2 Jun 2022 18:31:52 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=BA=E6=99=AF=E6=8A=A5=E5=91=8A=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2link=E8=BF=9B=E5=85=A5=E5=9C=BA=E6=99=AF=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E4=BF=A1=E6=81=AF=E7=BC=BA=E5=A4=B1=E7=9A=84=E7=BC=BA?= =?UTF-8?q?=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1013398 --user=王孝刚 【接口测试】github#13809. 切换项目后,从报告中点击场景用例link进入场景用例页面,页面显示模块信息丢失 https://www.tapd.cn/55049933/s/1172963 --- .../api/automation/ApiAutomation.vue | 6 ++-- .../automation/scenario/ApiScenarioModule.vue | 29 ++++++++++--------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/frontend/src/business/components/api/automation/ApiAutomation.vue b/frontend/src/business/components/api/automation/ApiAutomation.vue index 8942417f2f..02ae9190ef 100644 --- a/frontend/src/business/components/api/automation/ApiAutomation.vue +++ b/frontend/src/business/components/api/automation/ApiAutomation.vue @@ -219,12 +219,12 @@ export default { let scenarioId = selectParamArr[1]; //查找单条数据,跳转修改页面 let url = "/api/automation/list/" + 1 + "/" + 1; - this.$post(url, {id: scenarioId}, response => { + this.$post(url, {id: scenarioId}, async response => { let data = response.data; if (data != null) { //如果树未加载 - if (this.moduleOptions && JSON.stringify(this.moduleOptions) === '{}') { - this.$refs.nodeTree.list(); + if (this.moduleOptions && this.moduleOptions.length === 0) { + await this.$refs.nodeTree.list(); } if (data.listObject && data.listObject.length > 0) { let row = data.listObject[0]; diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioModule.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioModule.vue index 246bb16fab..a369bf1671 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioModule.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioModule.vue @@ -182,20 +182,23 @@ return; } } - this.result = this.$get(url, response => { - if (response.data != undefined && response.data != null) { - this.data = response.data; - this.data.forEach(node => { - node.name = node.name === '未规划场景' ? this.$t('api_test.automation.unplanned_scenario') : node.name - buildTree(node, {path: ''}); - }); - this.$emit('setModuleOptions', this.data); - this.$emit('setNodeTree', this.data); - if (this.$refs.nodeTree) { - this.$refs.nodeTree.filter(this.condition.filterText); + return new Promise((resolve) => { + this.result = this.$get(url, response => { + if (response.data != undefined && response.data != null) { + this.data = response.data; + this.data.forEach(node => { + node.name = node.name === '未规划场景' ? this.$t('api_test.automation.unplanned_scenario') : node.name + buildTree(node, {path: ''}); + }); + this.$emit('setModuleOptions', this.data); + this.$emit('setNodeTree', this.data); + if (this.$refs.nodeTree) { + this.$refs.nodeTree.filter(this.condition.filterText); + } } - } - }); + }); + resolve(); + }) }, edit(param) { param.projectId = this.projectId;