fix(接口测试): 修复场景环境二次点击,前后置sql执行出现数据源错误的缺陷

--bug=1033276 --user=王孝刚 【接口测试】github#27761,接口自动化场景环境二次点击,前后置SQL查询执行时出现数据源错误 https://www.tapd.cn/55049933/s/1445822
This commit is contained in:
wxg0103 2023-12-19 19:16:45 +08:00 committed by 刘瑞斌
parent d065f461f3
commit 6117ba28a4
1 changed files with 6 additions and 2 deletions

View File

@ -666,6 +666,8 @@ import { ENV_TYPE } from 'metersphere-frontend/src/utils/constants';
import { mergeRequestDocumentData } from '@/business/definition/api-definition';
import { useApiStore } from '@/store';
import { getDefaultVersion, setLatestVersionById } from 'metersphere-frontend/src/api/version';
import { getEnvironmentByProjectId } from 'metersphere-frontend/src/api/environment';
import { parseEnvironment } from '@/business/environment/model/EnvironmentModel';
const store = useApiStore();
@ -895,7 +897,8 @@ export default {
this.getPlugins().then(() => {
this.initPlugins();
});
this.result = getEnvironmentByProjectId(this.projectId).then((response) => {
this.environments = response.data;});
this.getDefaultVersion();
},
mounted() {
@ -2398,7 +2401,8 @@ export default {
let currentEnvironment = {};
this.environments.forEach((environment) => {
//
if (environment.id === request.environmentId && environment.id !== envId) {
if (environment.id === request.environmentId && environment.id === envId) {
parseEnvironment(environment);
if (environment.config && environment.config.databaseConfigs) {
environment.config.databaseConfigs.forEach((item) => {
if (item.id === request.dataSourceId) {