fix(接口测试): 修复测试计划全选UI用例环境数据丢失问题

--bug=1029146 --user=郭雨琦
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001029146
This commit is contained in:
guoyuqi 2023-08-22 18:13:49 +08:00 committed by Yuki Guo
parent a4291470d0
commit 487abd81bc
3 changed files with 28 additions and 23 deletions

View File

@ -6,6 +6,10 @@ export function getUiScenarioEnvByProjectId(id) {
return get(BASE_URL + `env-project-ids/${id}`);
}
export function getUiScenarioIdProject(param) {
return post(BASE_URL + `id-project`, param);
}
export function uiAutomationReduction(param) {
return post(BASE_URL + 'reduction', param);
}

View File

@ -132,7 +132,7 @@ import {
import {getCustomTableWidth} from "metersphere-frontend/src/utils/tableUtils";
import MsTableColumn from "metersphere-frontend/src/components/table/MsTableColumn";
import EnvGroupPopover from "@/business/plan/env/EnvGroupPopover";
import {getUiScenarioEnvByProjectId} from "@/api/remote/ui/ui-automation";
import {getUiScenarioEnvByProjectId, getUiScenarioIdProject} from "@/api/remote/ui/ui-automation";
export default {
name: "RelevanceUiScenarioList",
@ -301,35 +301,36 @@ export default {
showReport() {
},
async initProjectIds() {
initProjectIds() {
this.projectIds.clear();
this.map.clear();
this.map = new Map();
if (!this.selectAll) {
let selectIds = [];
this.selectRows.forEach((row) => {
getUiScenarioEnvByProjectId(row.id).then((res) => {
let data = res.data;
data.projectIds.forEach((d) => this.projectIds.add(d));
this.map.set(row.id, data.projectIds);
selectIds.push(row.id);
});
getUiScenarioIdProject(selectIds).then((res) => {
this.map = res.data || {};
let newProjectIds = [];
for (let key of Object.keys(this.map)) {
newProjectIds.push(...this.map[key])
}
this.projectIds = new Set(newProjectIds)
});
} else {
this.selectAllIds = await this.getAllId(this.condition);
this.selectAllIds.forEach((row) => {
getUiScenarioEnvByProjectId(row).then((res) => {
let data = res.data;
data.projectIds.forEach((d) => this.projectIds.add(d));
this.map.set(row, data.projectIds);
testPlanUiScenarioRelevanceListIds(this.condition).then((res) => {
this.selectAllIds = res.data;
getUiScenarioIdProject(this.selectAllIds).then((res) => {
this.map = res.data || {};
let newProjectIds = [];
for (let key of Object.keys(this.map)) {
newProjectIds.push(...this.map[key])
}
this.projectIds = new Set(newProjectIds)
});
});
}
},
getAllId(param) {
return new Promise((resolve) => {
testPlanUiScenarioRelevanceListIds(param).then((r) => {
resolve(r.data);
});
});
},
closeEnv() {
if (this.$refs.envPopover) {
this.$refs.envPopover.close();

View File

@ -124,7 +124,7 @@ export default {
}
let param = {};
param.planId = this.planId;
param.mapping = strMapToObj(map);
param.mapping = map;
param.envMap = strMapToObj(envMap);
param.environmentType = envType;
param.envGroupId = envGroupId;
@ -163,7 +163,7 @@ export default {
let param = {};
param.planId = this.planId;
param.mapping = strMapToObj(map);
param.mapping = map;
param.envMap = strMapToObj(envMap);
param.envGroupId = envGroupId;
param.selectIds = selectIds;