From 73f0404d907976707b78659f800afc5f277f8ed3 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Fri, 10 May 2024 18:59:37 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E9=A1=B9=E7=9B=AE=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ms-message/MessageCenterDrawer.vue | 17 ++++++++++++++-- frontend/src/hooks/useOpenNewPage.ts | 20 +++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/business/ms-message/MessageCenterDrawer.vue b/frontend/src/components/business/ms-message/MessageCenterDrawer.vue index 074e38bc26..6bcb4f99c5 100644 --- a/frontend/src/components/business/ms-message/MessageCenterDrawer.vue +++ b/frontend/src/components/business/ms-message/MessageCenterDrawer.vue @@ -198,6 +198,7 @@ BugManagementRouteEnum, CaseManagementRouteEnum, ProjectManagementRouteEnum, + TestPlanRouteEnum, } from '@/enums/routeEnum'; const props = defineProps<{ @@ -211,7 +212,7 @@ const userStore = useUserStore(); const router = useRouter(); const { t } = useI18n(); - const { openNewPage } = useOpenNewPage(); + const { openNewPage, openNewPageWidthSingleParam } = useOpenNewPage(); const innerVisible = useVModel(props, 'visible', emit); const projectId = ref(appStore.currentProjectId); @@ -365,6 +366,12 @@ count = module.name; } } + if (type === 'TEST_PLAN_MANAGEMENT') { + const module = options.value.find((item) => item.id === 'TEST_PLAN'); + if (module) { + count = module.name; + } + } const number = parseInt(count, 10); if (number > 99) { return '+99'; @@ -380,6 +387,7 @@ [MessageResourceType.CASE_REVIEW_TASK]: CaseManagementRouteEnum.CASE_MANAGEMENT_REVIEW_DETAIL, [MessageResourceType.API_DEFINITION_TASK]: ApiTestRouteEnum.API_TEST_MANAGEMENT, [MessageResourceType.API_SCENARIO_TASK]: ApiTestRouteEnum.API_TEST_SCENARIO, + [MessageResourceType.TEST_PLAN_TASK]: TestPlanRouteEnum.TEST_PLAN_INDEX_DETAIL, }; // 点击名称跳转 @@ -399,8 +407,13 @@ routeQuery.dId = item.resourceId; } } + const route = resourceTypeRouteMap[item.resourceType]; - openNewPage(route, routeQuery); + if (item.resourceType === MessageResourceType.FUNCTIONAL_CASE_TASK) { + openNewPageWidthSingleParam(route, 'edit', routeQuery); + } else { + openNewPage(route, routeQuery); + } } // 全部标记为已读 diff --git a/frontend/src/hooks/useOpenNewPage.ts b/frontend/src/hooks/useOpenNewPage.ts index dbfc527040..40cef0e32a 100644 --- a/frontend/src/hooks/useOpenNewPage.ts +++ b/frontend/src/hooks/useOpenNewPage.ts @@ -26,7 +26,27 @@ export default function useOpenNewPage() { ); } + function openNewPageWidthSingleParam( + name: RouteRecordName | undefined, + param: string, + query: Record = {} + ) { + const pId = query.pId || appStore.currentProjectId; + if (pId) { + // 如果传入参数指定了项目 id,则使用传入的项目 id + delete query.pId; + } + const queryParams = new URLSearchParams(query).toString(); + window.open( + `${window.location.origin}#${router.resolve({ name }).fullPath}/${param}?orgId=${ + appStore.currentOrgId + }&pId=${pId}&${queryParams}`, + '_blank' + ); + } + return { openNewPage, + openNewPageWidthSingleParam, }; }