From 487abd81bc6ae1e22e0437fe29e8693a5281c683 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Tue, 22 Aug 2023 18:13:49 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E5=85=A8?= =?UTF-8?q?=E9=80=89UI=E7=94=A8=E4=BE=8B=E7=8E=AF=E5=A2=83=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=B8=A2=E5=A4=B1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1029146 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001029146 --- .../src/api/remote/ui/ui-automation.js | 4 ++ .../comonents/ui/RelevanceUiScenarioList.vue | 43 ++++++++++--------- .../ui/TestCaseUiScenarioRelevance.vue | 4 +- 3 files changed, 28 insertions(+), 23 deletions(-) diff --git a/test-track/frontend/src/api/remote/ui/ui-automation.js b/test-track/frontend/src/api/remote/ui/ui-automation.js index dfba3d5842..4c6cdc1e86 100644 --- a/test-track/frontend/src/api/remote/ui/ui-automation.js +++ b/test-track/frontend/src/api/remote/ui/ui-automation.js @@ -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); } diff --git a/test-track/frontend/src/business/plan/view/comonents/ui/RelevanceUiScenarioList.vue b/test-track/frontend/src/business/plan/view/comonents/ui/RelevanceUiScenarioList.vue index a6e2515c81..f578c142df 100644 --- a/test-track/frontend/src/business/plan/view/comonents/ui/RelevanceUiScenarioList.vue +++ b/test-track/frontend/src/business/plan/view/comonents/ui/RelevanceUiScenarioList.vue @@ -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(); diff --git a/test-track/frontend/src/business/plan/view/comonents/ui/TestCaseUiScenarioRelevance.vue b/test-track/frontend/src/business/plan/view/comonents/ui/TestCaseUiScenarioRelevance.vue index f033b527e3..25247d6155 100644 --- a/test-track/frontend/src/business/plan/view/comonents/ui/TestCaseUiScenarioRelevance.vue +++ b/test-track/frontend/src/business/plan/view/comonents/ui/TestCaseUiScenarioRelevance.vue @@ -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;