fix(接口测试): 修复自定义sql切换环境,数据源没有切换的缺陷

--bug=1034716 --user=王孝刚 【接口测试】github#28534,接口自动化,编辑场景 sql请求 切换同名数据源,能够生效,保存后关闭,再次进入页面切换环境的数据源,同名数据源没有切换过去 https://www.tapd.cn/55049933/s/1463369
This commit is contained in:
wxg0103 2024-02-21 15:29:01 +08:00 committed by Craftsman
parent 88c993e46f
commit 059db90dda
1 changed files with 3 additions and 1 deletions

View File

@ -2216,6 +2216,7 @@ export default {
if (typeArray.indexOf(stepArray[i].type) !== -1) { if (typeArray.indexOf(stepArray[i].type) !== -1) {
stepArray[i].originalDataSourceId = stepArray[i].dataSourceId; stepArray[i].originalDataSourceId = stepArray[i].dataSourceId;
stepArray[i].originalEnvironmentId = stepArray[i].environmentId; stepArray[i].originalEnvironmentId = stepArray[i].environmentId;
console.log(stepArray[i].originalDataSourceId);
} }
if (!stepArray[i].hashTree) { if (!stepArray[i].hashTree) {
stepArray[i].hashTree = []; stepArray[i].hashTree = [];
@ -2408,7 +2409,7 @@ export default {
let currentEnvironment = {}; let currentEnvironment = {};
this.environments.forEach((environment) => { this.environments.forEach((environment) => {
// //
if (environment.id === request.environmentId && environment.id === envId) { if (environment.id === request.originalEnvironmentId !== envId) {
parseEnvironment(environment); parseEnvironment(environment);
if (environment.config && environment.config.databaseConfigs) { if (environment.config && environment.config.databaseConfigs) {
environment.config.databaseConfigs.forEach((item) => { environment.config.databaseConfigs.forEach((item) => {
@ -2436,6 +2437,7 @@ export default {
} }
} }
} }
parseEnvironment(currentEnvironment);
let flag = false; let flag = false;
if (currentEnvironment && currentEnvironment.config && currentEnvironment.config.databaseConfigs) { if (currentEnvironment && currentEnvironment.config && currentEnvironment.config.databaseConfigs) {
currentEnvironment.config.databaseConfigs.forEach((item) => { currentEnvironment.config.databaseConfigs.forEach((item) => {