fix(接口测试): 修复测试计划全选UI用例环境数据丢失问题
--bug=1029146 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001029146
This commit is contained in:
parent
5123e14315
commit
e9e2f1e5ce
|
@ -125,7 +125,10 @@ import {TEST_PLAN_RELEVANCE_UI_SCENARIO_CONFIGS} from "metersphere-frontend/src/
|
||||||
import {ENV_TYPE} from "metersphere-frontend/src/utils/constants";
|
import {ENV_TYPE} from "metersphere-frontend/src/utils/constants";
|
||||||
import MsTable from "metersphere-frontend/src/components/table/MsTable";
|
import MsTable from "metersphere-frontend/src/components/table/MsTable";
|
||||||
import {getOwnerProjects, getVersionFilters} from "@/business/utils/sdk-utils";
|
import {getOwnerProjects, getVersionFilters} from "@/business/utils/sdk-utils";
|
||||||
import {testPlanUiScenarioRelevanceList} from "@/api/remote/ui/test-plan-ui-scenario-case";
|
import {
|
||||||
|
testPlanUiScenarioRelevanceList,
|
||||||
|
testPlanUiScenarioRelevanceListIds
|
||||||
|
} from "@/api/remote/ui/test-plan-ui-scenario-case";
|
||||||
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";
|
||||||
|
@ -165,6 +168,7 @@ export default {
|
||||||
currentScenario: {},
|
currentScenario: {},
|
||||||
schedule: {},
|
schedule: {},
|
||||||
selectAll: false,
|
selectAll: false,
|
||||||
|
selectAllIds: [],
|
||||||
tableData: [],
|
tableData: [],
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
@ -290,15 +294,17 @@ export default {
|
||||||
},
|
},
|
||||||
selectCountChange(data) {
|
selectCountChange(data) {
|
||||||
this.selectRows = this.$refs.scenarioTable.selectRows;
|
this.selectRows = this.$refs.scenarioTable.selectRows;
|
||||||
|
this.selectAll = this.$refs.scenarioTable.showSelectAll;
|
||||||
this.$emit("selectCountChange", data);
|
this.$emit("selectCountChange", data);
|
||||||
this.initProjectIds();
|
this.initProjectIds();
|
||||||
},
|
},
|
||||||
showReport() {
|
showReport() {
|
||||||
|
|
||||||
},
|
},
|
||||||
initProjectIds() {
|
async initProjectIds() {
|
||||||
this.projectIds.clear();
|
this.projectIds.clear();
|
||||||
this.map.clear();
|
this.map.clear();
|
||||||
|
if (!this.selectAll) {
|
||||||
this.selectRows.forEach((row) => {
|
this.selectRows.forEach((row) => {
|
||||||
getUiScenarioEnvByProjectId(row.id).then((res) => {
|
getUiScenarioEnvByProjectId(row.id).then((res) => {
|
||||||
let data = res.data;
|
let data = res.data;
|
||||||
|
@ -306,11 +312,30 @@ export default {
|
||||||
this.map.set(row.id, data.projectIds);
|
this.map.set(row.id, data.projectIds);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
} 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);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getAllId(param) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
testPlanUiScenarioRelevanceListIds(param).then((r) => {
|
||||||
|
resolve(r.data);
|
||||||
|
});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
closeEnv() {
|
closeEnv() {
|
||||||
|
if (this.$refs.envPopover) {
|
||||||
this.$refs.envPopover.close();
|
this.$refs.envPopover.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,6 @@ import {strMapToObj} from "metersphere-frontend/src/utils";
|
||||||
import {ENV_TYPE} from "metersphere-frontend/src/utils/constants";
|
import {ENV_TYPE} from "metersphere-frontend/src/utils/constants";
|
||||||
import RelevanceUiScenarioList from "@/business/plan/view/comonents/ui/RelevanceUiScenarioList";
|
import RelevanceUiScenarioList from "@/business/plan/view/comonents/ui/RelevanceUiScenarioList";
|
||||||
import {testPlanAutoCheck} from "@/api/remote/plan/test-plan";
|
import {testPlanAutoCheck} from "@/api/remote/plan/test-plan";
|
||||||
import {testPlanUiScenarioRelevanceListIds} from "@/api/remote/ui/test-plan-ui-scenario-case";
|
|
||||||
import UiScenarioModule from "@/business/plan/view/comonents/ui/UiScenarioModule";
|
import UiScenarioModule from "@/business/plan/view/comonents/ui/UiScenarioModule";
|
||||||
import {uiAutomationRelevance} from "@/api/remote/ui/api-scenario";
|
import {uiAutomationRelevance} from "@/api/remote/ui/api-scenario";
|
||||||
|
|
||||||
|
@ -139,14 +138,8 @@ export default {
|
||||||
this.$refs.baseRelevance.close();
|
this.$refs.baseRelevance.close();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getAllId(param) {
|
|
||||||
return new Promise((resolve) => {
|
saveCaseRelevance() {
|
||||||
testPlanUiScenarioRelevanceListIds(param).then((r) => {
|
|
||||||
resolve(r.data);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
async saveCaseRelevance() {
|
|
||||||
this.isSaving = true;
|
this.isSaving = true;
|
||||||
let selectIds = [];
|
let selectIds = [];
|
||||||
let selectRows = this.$refs.apiScenarioList.selectRows;
|
let selectRows = this.$refs.apiScenarioList.selectRows;
|
||||||
|
@ -154,9 +147,14 @@ export default {
|
||||||
let map = this.$refs.apiScenarioList.map;
|
let map = this.$refs.apiScenarioList.map;
|
||||||
let envGroupId = this.$refs.apiScenarioList.envGroupId;
|
let envGroupId = this.$refs.apiScenarioList.envGroupId;
|
||||||
|
|
||||||
|
if (!this.$refs.apiScenarioList.selectAll) {
|
||||||
selectRows.forEach((row) => {
|
selectRows.forEach((row) => {
|
||||||
selectIds.push(row.id);
|
selectIds.push(row.id);
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
selectIds = this.$refs.apiScenarioList.selectAllIds;
|
||||||
|
}
|
||||||
|
|
||||||
if (selectIds.length < 1) {
|
if (selectIds.length < 1) {
|
||||||
this.isSaving = false;
|
this.isSaving = false;
|
||||||
this.$warning(this.$t("test_track.plan_view.please_choose_test_case"));
|
this.$warning(this.$t("test_track.plan_view.please_choose_test_case"));
|
||||||
|
@ -169,13 +167,6 @@ export default {
|
||||||
param.envMap = strMapToObj(envMap);
|
param.envMap = strMapToObj(envMap);
|
||||||
param.envGroupId = envGroupId;
|
param.envGroupId = envGroupId;
|
||||||
param.selectIds = selectIds;
|
param.selectIds = selectIds;
|
||||||
|
|
||||||
//查找所有数据
|
|
||||||
let params = this.$refs.apiScenarioList.condition;
|
|
||||||
if (params.selectAll) {
|
|
||||||
let result = await this.getAllId(params);
|
|
||||||
param.selectIds = result;
|
|
||||||
}
|
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
uiAutomationRelevance(param)
|
uiAutomationRelevance(param)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|
Loading…
Reference in New Issue