fix(接口定义): 修复sql接口和用例,保存的环境被删除后,运行环境显示了ID的缺陷

--bug=1023102 --user=王孝刚 【接口测试】sql接口和用例,保存的环境被删除后,运行环境显示了ID
https://www.tapd.cn/55049933/s/1336062
This commit is contained in:
wxg0103 2023-02-16 11:04:35 +08:00 committed by 刘瑞斌
parent 77f97c940a
commit 01ccfde3e6
1 changed files with 17 additions and 0 deletions

View File

@ -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);
});
},