fix(缺陷管理): 缺陷关联用例跳转未切换项目

--bug=1043049 --user=宋昌昌 【缺陷管理】缺陷详情-用例-已关联用例为跨项目用例-点击ID跳转-未跳转到对应项目 https://www.tapd.cn/55049933/s/1536136
This commit is contained in:
song-cc-rock 2024-06-25 14:46:29 +08:00 committed by 刘瑞斌
parent d655120f51
commit f6fac1d10c
1 changed files with 9 additions and 8 deletions

View File

@ -17,7 +17,7 @@
<template #relateCaseNum="{ record }">
<a-tooltip :content="`${record.relateCaseNum}`">
<!-- TOTO 暂时没有用例id的字段 需要后台加caseId -->
<a-button type="text" class="px-0" @click="openDetail(record.relateCaseId)">
<a-button type="text" class="px-0" @click="openDetail(record.relateCaseId, record.projectId)">
<div class="one-line-text max-w-[168px]">{{ record.relateCaseNum }}</div>
</a-button>
</a-tooltip>
@ -104,6 +104,7 @@
getUnAssociatedList,
} from '@/api/modules/bug-management';
import { useI18n } from '@/hooks/useI18n';
import useOpenNewPage from '@/hooks/useOpenNewPage';
import { NO_RESOURCE_ROUTE_NAME } from '@/router/constants';
import { useAppStore } from '@/store';
import useFeatureCaseStore from '@/store/modules/case/featureCase';
@ -111,7 +112,7 @@
import type { TableQueryParams } from '@/models/common';
import { CaseLinkEnum } from '@/enums/caseEnum';
import { CaseManagementRouteEnum } from '@/enums/routeEnum';
import { RouteEnum } from '@/enums/routeEnum';
import Message from '@arco-design/web-vue/es/message';
@ -119,6 +120,7 @@
const featureCaseStore = useFeatureCaseStore();
const router = useRouter();
const { t } = useI18n();
const { openNewPage } = useOpenNewPage();
const currentProjectId = computed(() => appStore.currentProjectId);
@ -268,15 +270,14 @@
await loadList();
}
async function openDetail(id: string) {
async function openDetail(id: string, projectId: string) {
try {
const res = await checkCasePermission(currentProjectId.value, 'FUNCTIONAL');
if (res) {
window.open(
`${window.location.origin}#${
router.resolve({ name: CaseManagementRouteEnum.CASE_MANAGEMENT_CASE }).fullPath
}?id=${id}`
);
openNewPage(RouteEnum.CASE_MANAGEMENT_CASE, {
pId: projectId,
id,
});
} else {
window.open(`${window.location.origin}#${router.resolve({ name: NO_RESOURCE_ROUTE_NAME }).fullPath}`);
}