From 29ae426d6d4d324b2f37ce5d4ea571419d5d19ba Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Wed, 7 Feb 2024 13:24:15 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):=20?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E5=9C=A8=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E9=85=8D=E7=BD=AE=E6=97=B6=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E4=BC=9A=E5=BD=B1=E5=93=8D=E5=88=B0=E5=85=B6=E5=AE=83=E7=9A=84?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/plan/components/TestPlanList.vue | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/test-track/frontend/src/business/plan/components/TestPlanList.vue b/test-track/frontend/src/business/plan/components/TestPlanList.vue index 081a57adc6..c01061e430 100644 --- a/test-track/frontend/src/business/plan/components/TestPlanList.vue +++ b/test-track/frontend/src/business/plan/components/TestPlanList.vue @@ -1133,25 +1133,27 @@ export default { this.haveOtherExecCase = false; this.currentPlanId = row.id; - let haveApiCase = row.testPlanApiCaseCount > 0; - let haveScenarioCase = row.testPlanApiScenarioCount > 0; - let haveLoadCase = row.testPlanLoadCaseCount > 0; - this.haveUICase = row.testPlanUiScenarioCount > 0; - - if (!this.haveUICase && !haveApiCase && !haveScenarioCase && haveLoadCase) { - //只有性能测试,则直接执行 - this.$refs.runMode.handleCommand("run"); - } else if (haveApiCase || haveScenarioCase) { - // 有接口或场景测试, 需选择资源池 - this.haveOtherExecCase = true; - this.$refs.runMode.open("API", row.runModeConfig); - } else if (this.haveUICase) { - // UI测试不需要选择资源池 - this.$refs.runMode.open("", row.runModeConfig); - } else { - //没有可执行的资源,则直接跳转到计划里 - this.$router.push("/track/plan/view/" + row.id); - } + //组件里的id不会及时变动,会影响到后续的操作,所以需要在下一个tick里执行 + this.$nextTick(() => { + let haveApiCase = row.testPlanApiCaseCount > 0; + let haveScenarioCase = row.testPlanApiScenarioCount > 0; + let haveLoadCase = row.testPlanLoadCaseCount > 0; + this.haveUICase = row.testPlanUiScenarioCount > 0; + if (!this.haveUICase && !haveApiCase && !haveScenarioCase && haveLoadCase) { + //只有性能测试,则直接执行 + this.$refs.runMode.handleCommand("run"); + } else if (haveApiCase || haveScenarioCase) { + // 有接口或场景测试, 需选择资源池 + this.haveOtherExecCase = true; + this.$refs.runMode.open("API", row.runModeConfig); + } else if (this.haveUICase) { + // UI测试不需要选择资源池 + this.$refs.runMode.open("", row.runModeConfig); + } else { + //没有可执行的资源,则直接跳转到计划里 + this.$router.push("/track/plan/view/" + row.id); + } + }); }, _handleRun(config) { let defaultPlanEnvMap = config.testPlanDefaultEnvMap;