fix(接口测试): 修复场景自定义sql请求环境显示为id的缺陷

--bug=1025017 --user=王孝刚 【接口测试】场景导出导入后-运行环境显示错误
https://www.tapd.cn/55049933/s/1358378
This commit is contained in:
wxg0103 2023-03-31 18:37:11 +08:00 committed by fit2-zhao
parent 2539a81e4d
commit 1ab2cacac7
4 changed files with 12 additions and 6 deletions

View File

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

View File

@ -113,7 +113,5 @@ export default {
</script>
<style scoped>
:deep(.ace_text-layer){
padding:0px !important;
}
</style>

View File

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

View File

@ -115,7 +115,5 @@ export default {
</script>
<style scoped>
:deep(.ace_text-layer){
padding:0px !important;
}
</style>