From 81f508da6e98941e98041fbd87e626b87dfc9022 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Fri, 31 Mar 2023 18:37:11 +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=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?sql=E8=AF=B7=E6=B1=82=E7=8E=AF=E5=A2=83=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=BAid=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1025017 --user=王孝刚 【接口测试】场景导出导入后-运行环境显示错误 https://www.tapd.cn/55049933/s/1358378 --- .../automation/scenario/common/JDBCProcessorContent.vue | 5 +++++ .../src/business/definition/components/MsCodeEdit.vue | 4 +--- .../components/request/database/BasisParameters.vue | 5 +++++ framework/sdk-parent/frontend/src/components/MsCodeEdit.vue | 4 +--- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/api-test/frontend/src/business/automation/scenario/common/JDBCProcessorContent.vue b/api-test/frontend/src/business/automation/scenario/common/JDBCProcessorContent.vue index 383cf91b79..76225d7b99 100644 --- a/api-test/frontend/src/business/automation/scenario/common/JDBCProcessorContent.vue +++ b/api-test/frontend/src/business/automation/scenario/common/JDBCProcessorContent.vue @@ -273,10 +273,12 @@ export default { let currentEnvironment = {}; this.result = getEnvironmentByProjectId(id).then((response) => { this.environments = response.data; + let hasEnvironment = false; this.environments.forEach((environment) => { parseEnvironment(environment); // 找到原始环境和数据源名称 if (environment.id === this.request.environmentId && environment.id !== envId) { + hasEnvironment = true; if (environment.config && environment.config.databaseConfigs) { environment.config.databaseConfigs.forEach((item) => { if (item.id === this.request.dataSourceId) { @@ -290,6 +292,9 @@ export default { this.environments = [currentEnvironment]; } }); + if (!hasEnvironment) { + this.request.environmentId = ""; + } this.initDataSource(envId, currentEnvironment, targetDataSourceName); }); }, diff --git a/api-test/frontend/src/business/definition/components/MsCodeEdit.vue b/api-test/frontend/src/business/definition/components/MsCodeEdit.vue index d9c5c5a2c1..13a8d495af 100644 --- a/api-test/frontend/src/business/definition/components/MsCodeEdit.vue +++ b/api-test/frontend/src/business/definition/components/MsCodeEdit.vue @@ -113,7 +113,5 @@ export default { diff --git a/api-test/frontend/src/business/definition/components/request/database/BasisParameters.vue b/api-test/frontend/src/business/definition/components/request/database/BasisParameters.vue index fb18206699..15d081906b 100644 --- a/api-test/frontend/src/business/definition/components/request/database/BasisParameters.vue +++ b/api-test/frontend/src/business/definition/components/request/database/BasisParameters.vue @@ -415,10 +415,12 @@ export default { } getEnvironmentByProjectId(id).then((response) => { this.environments = response.data; + let hasEnvironment = false; this.environments.forEach((environment) => { parseEnvironment(environment); // 找到原始环境和数据源名称 if (environment.id === this.request.environmentId && environment.id !== envId) { + hasEnvironment = true; if (environment.config && environment.config.databaseConfigs) { environment.config.databaseConfigs.forEach((item) => { if (item.id === this.request.dataSourceId) { @@ -434,6 +436,9 @@ export default { } } }); + if (!hasEnvironment) { + this.request.environmentId = ""; + } this.initDataSource(envId, currentEnvironment, targetDataSourceName); }); }, diff --git a/framework/sdk-parent/frontend/src/components/MsCodeEdit.vue b/framework/sdk-parent/frontend/src/components/MsCodeEdit.vue index 69af04d284..82d35897da 100644 --- a/framework/sdk-parent/frontend/src/components/MsCodeEdit.vue +++ b/framework/sdk-parent/frontend/src/components/MsCodeEdit.vue @@ -115,7 +115,5 @@ export default {