From 01ccfde3e6e8ac9a6d4860d3f642e4b8919cd21b Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Thu, 16 Feb 2023 11:04:35 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8Dsql=E6=8E=A5=E5=8F=A3=E5=92=8C=E7=94=A8?= =?UTF-8?q?=E4=BE=8B=EF=BC=8C=E4=BF=9D=E5=AD=98=E7=9A=84=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E8=A2=AB=E5=88=A0=E9=99=A4=E5=90=8E=EF=BC=8C=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E6=98=BE=E7=A4=BA=E4=BA=86ID=E7=9A=84?= =?UTF-8?q?=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1023102 --user=王孝刚 【接口测试】sql接口和用例,保存的环境被删除后,运行环境显示了ID https://www.tapd.cn/55049933/s/1336062 --- .../request/database/BasisParameters.vue | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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 6927082046..75de434846 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 @@ -341,6 +341,7 @@ export default { this.environments = response.data; let targetDataSourceName = undefined; let currentEnvironment = undefined; + let hasEnvironment = false; this.environments.forEach((environment) => { parseEnvironment(environment); // 找到原始环境和数据源名称 @@ -348,6 +349,7 @@ export default { currentEnvironment = environment; } if (environment.id === this.request.environmentId) { + hasEnvironment = true; if (environment.config && environment.config.databaseConfigs) { environment.config.databaseConfigs.forEach((item) => { if (item.id === this.request.dataSourceId) { @@ -357,6 +359,21 @@ export default { } } }); + if (!hasEnvironment) { + this.request.environmentId = store.useEnvironment; + this.environments.forEach((environment) => { + if (environment.id === store.useEnvironment) { + currentEnvironment = environment; + } + if (environment.config && environment.config.databaseConfigs) { + environment.config.databaseConfigs.forEach((item) => { + if (item.id === this.request.dataSourceId) { + targetDataSourceName = item.name; + } + }); + } + }); + } this.initDataSource(environmentId, currentEnvironment, targetDataSourceName); }); },