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}`); return get(BASE_URL + `env-project-ids/${id}`);
} }
export function getUiScenarioIdProject(param) {
return post(BASE_URL + `id-project`, param);
}
export function uiAutomationReduction(param) { export function uiAutomationReduction(param) {
return post(BASE_URL + 'reduction', param); return post(BASE_URL + 'reduction', param);
} }

View File

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

View File

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