feat(项目管理): 增加测试计划跳转

This commit is contained in:
guoyuqi 2024-05-10 18:59:37 +08:00 committed by Craftsman
parent 7d3e2a9f53
commit 73f0404d90
2 changed files with 35 additions and 2 deletions

View File

@ -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<string>(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,9 +407,14 @@
routeQuery.dId = item.resourceId;
}
}
const route = resourceTypeRouteMap[item.resourceType];
if (item.resourceType === MessageResourceType.FUNCTIONAL_CASE_TASK) {
openNewPageWidthSingleParam(route, 'edit', routeQuery);
} else {
openNewPage(route, routeQuery);
}
}
//
async function prepositionEdit() {

View File

@ -26,7 +26,27 @@ export default function useOpenNewPage() {
);
}
function openNewPageWidthSingleParam(
name: RouteRecordName | undefined,
param: string,
query: Record<string, any> = {}
) {
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,
};
}