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