fix(接口测试): 未保存数据源切换丢失问题修复

--bug=1021914 --user=赵勇 【接口测试】场景中的http请求添加的前后置sql手动修改数据源不生效 https://www.tapd.cn/55049933/s/1326880
This commit is contained in:
fit2-zhao 2023-01-12 11:54:42 +08:00 committed by 刘瑞斌
parent dbffccd559
commit 02feb6893e
1 changed files with 7 additions and 3 deletions

View File

@ -147,7 +147,7 @@ export default {
};
},
created() {
this.getEnvironments();
this.getEnvironments(null, 'created');
},
computed: {
projectId() {
@ -235,7 +235,7 @@ export default {
this.initDataSource(undefined, undefined, targetDataSourceName);
});
},
getEnvironments(environmentId) {
getEnvironments(environmentId, isCreated) {
let envId = '';
let id = this.request.projectId ? this.request.projectId : this.projectId;
let scenarioEnvId = this.scenarioId !== '' ? this.scenarioId + '_' + id : id;
@ -262,7 +262,11 @@ export default {
envId = this.request.refEevMap.get(id);
}
}
if (envId === this.request.originalEnvironmentId && this.request.originalDataSourceId) {
if (
envId === this.request.originalEnvironmentId &&
this.request.originalDataSourceId &&
isCreated !== 'created'
) {
this.request.dataSourceId = this.request.originalDataSourceId;
}
let targetDataSourceName = '';