From e71f4de9a089818c51f2061a3d305fce542bbf95 Mon Sep 17 00:00:00 2001 From: "xinxin.wu" Date: Fri, 20 Dec 2024 19:15:17 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=B7=A5=E4=BD=9C=E5=8F=B0):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=B7=A5=E4=BD=9C=E5=8F=B0=E6=B5=8B=E8=AF=95=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E5=8D=A1=E7=89=87bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/models/workbench/homePage.ts | 1 + .../homePage/components/cardSettingDrawer.vue | 1 + .../homePage/components/testPlanOverview.vue | 41 ++++++++++++++++--- .../src/views/workbench/homePage/index.vue | 1 + 4 files changed, 39 insertions(+), 5 deletions(-) diff --git a/frontend/src/models/workbench/homePage.ts b/frontend/src/models/workbench/homePage.ts index ce7a2d5eb0..aca7f99e79 100644 --- a/frontend/src/models/workbench/homePage.ts +++ b/frontend/src/models/workbench/homePage.ts @@ -31,6 +31,7 @@ export interface SelectedCardItem { handleUsers: string[]; selectAll: boolean; // 是否全选项目 planId: string; // 测试计划id + groupId: string; // 测试计划组id } // 查询入参 diff --git a/frontend/src/views/workbench/homePage/components/cardSettingDrawer.vue b/frontend/src/views/workbench/homePage/components/cardSettingDrawer.vue index 367fb55cc0..c7b3bf1816 100644 --- a/frontend/src/views/workbench/homePage/components/cardSettingDrawer.vue +++ b/frontend/src/views/workbench/homePage/components/cardSettingDrawer.vue @@ -147,6 +147,7 @@ handleUsers: [], selectAll: !![WorkCardEnum.PROJECT_VIEW, WorkCardEnum.CREATE_BY_ME].includes(item.value), planId: '', + groupId: '', }; selectedCardList.value.push(newCard); } diff --git a/frontend/src/views/workbench/homePage/components/testPlanOverview.vue b/frontend/src/views/workbench/homePage/components/testPlanOverview.vue index fd890d7fd1..ff77e4ffb4 100644 --- a/frontend/src/views/workbench/homePage/components/testPlanOverview.vue +++ b/frontend/src/views/workbench/homePage/components/testPlanOverview.vue @@ -126,6 +126,10 @@ required: true, }); + const innerGroupPlanId = defineModel('groupId', { + required: true, + }); + const innerProjectIds = defineModel('projectIds', { required: true, }); @@ -353,9 +357,17 @@ } } - async function changeHandler(value: string) { + async function changeHandler(value: string[]) { + selectValue.value = value; innerPlanId.value = value[value.length - 1]; innerProjectIds.value = [value[0]]; + const planLevel = 3; + if (value.length === planLevel) { + innerGroupPlanId.value = value[value.length - 2]; + } else { + innerGroupPlanId.value = ''; + } + await nextTick(); labelPath.value = getLabelPath(innerPlanId.value); initOverViewDetail(); @@ -407,27 +419,46 @@ } } + function getSelectedParams() { + const [newProjectId] = innerProjectIds.value; + const selectedData = [newProjectId, innerGroupPlanId.value, innerPlanId.value]; + selectValue.value = []; + const tempArr: string[] = []; + selectedData.forEach((e) => { + if (e) { + tempArr.push(e); + } + }); + return tempArr; + } + async function handleRefreshKeyChange() { await nextTick(() => { innerProjectIds.value = [...props.item.projectIds]; }); const [newProjectId] = innerProjectIds.value; - selectValue.value = [newProjectId, props.item.planId]; - + selectValue.value = getSelectedParams(); refreshHandler(newProjectId); labelPath.value = getLabelPath(innerPlanId.value); } const defaultValue = computed(() => { const [newProjectId] = innerProjectIds.value; - return [newProjectId, innerPlanId.value]; + const selectedData = [newProjectId, props.item.groupId, props.item.planId]; + const tempArr: string[] = []; + selectedData.forEach((e) => { + if (e) { + tempArr.push(e); + } + }); + return tempArr; }); onMounted(() => { projectOptions.value = appStore.projectList.map((e) => ({ value: e.id, label: e.name })); const [newProjectId] = props.item.projectIds; if (props.item.planId) { - selectValue.value = [newProjectId, props.item.planId]; + selectValue.value = getSelectedParams(); } refreshHandler(newProjectId); }); diff --git a/frontend/src/views/workbench/homePage/index.vue b/frontend/src/views/workbench/homePage/index.vue index 4a563bb152..306556b342 100644 --- a/frontend/src/views/workbench/homePage/index.vue +++ b/frontend/src/views/workbench/homePage/index.vue @@ -150,6 +150,7 @@