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 {