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 @@