fix(测试计划): 修复测试计划详情用例明细跳转问题&用例明细批量操作执行权限补充

This commit is contained in:
xinxin.wu 2024-09-19 16:45:07 +08:00 committed by 刘瑞斌
parent f5db54fafc
commit aadf25fd6f
8 changed files with 70 additions and 31 deletions

View File

@ -5,7 +5,7 @@ import type { saveParams } from '@/components/business/ms-associate-case/types';
import type { customFieldsItem } from '@/models/caseManagement/featureCase'; import type { customFieldsItem } from '@/models/caseManagement/featureCase';
import type { TableQueryParams } from '@/models/common'; import type { TableQueryParams } from '@/models/common';
import { BatchApiParams, DragSortParams } from '@/models/common'; import { BatchApiParams, DragSortParams } from '@/models/common';
import { LastExecuteResults } from '@/enums/caseEnum'; import { CaseLinkEnum, LastExecuteResults } from '@/enums/caseEnum';
import { import {
type PlanMinderAssociateType, type PlanMinderAssociateType,
type PlanMinderCollectionType, type PlanMinderCollectionType,
@ -136,16 +136,20 @@ export interface UseCountType {
testProgress: string; // 测试进度 testProgress: string; // 测试进度
} }
export interface RelateCasesType {
id: string;
bugId: string;
name: string;
projectId: string;
type: CaseLinkEnum;
}
// 计划详情缺陷列表 // 计划详情缺陷列表
export interface PlanDetailBugItem { export interface PlanDetailBugItem {
id: string; id: string;
num: string; num: string;
title: string; title: string;
relateCases: { relateCases: RelateCasesType[];
id: string;
bugId: string;
name: string;
}[];
handleUser: string; handleUser: string;
status: string; status: string;
createUser: string; createUser: string;

View File

@ -81,7 +81,7 @@
}, },
{ {
title: 'bugManagement.status', title: 'bugManagement.status',
dataIndex: 'status', dataIndex: 'statusName',
width: 100, width: 100,
showTooltip: true, showTooltip: true,
}, },

View File

@ -6,7 +6,7 @@
<span class="mx-[16px]"> {{ t('ms.case.associate.testSet') }}</span> <span class="mx-[16px]"> {{ t('ms.case.associate.testSet') }}</span>
<a-input-search <a-input-search
v-model:model-value="keyword" v-model:model-value="keyword"
:placeholder="t('common.searchByIdName')" :placeholder="t('report.detail.caseDetailSearchPlaceholder')"
allow-clear allow-clear
class="w-[240px]" class="w-[240px]"
@search="searchList" @search="searchList"

View File

@ -26,6 +26,7 @@ export default {
'report.passRateTip': 'Pass rate: successful cases in the plan / cases in the plan * 100%', 'report.passRateTip': 'Pass rate: successful cases in the plan / cases in the plan * 100%',
'report.detail.reportSummary': 'Report summary', 'report.detail.reportSummary': 'Report summary',
'report.detail.bugDetails': 'Bug details', 'report.detail.bugDetails': 'Bug details',
'report.detail.caseDetailSearchPlaceholder': 'Search by ID/ name/module name',
'report.detail.featureCaseDetails': 'Case details', 'report.detail.featureCaseDetails': 'Case details',
'report.detail.executionAnalysis': 'Execution Analysis', 'report.detail.executionAnalysis': 'Execution Analysis',
'report.detail.threshold': 'Pass threshold', 'report.detail.threshold': 'Pass threshold',

View File

@ -26,6 +26,7 @@ export default {
'report.completed': '已完成', 'report.completed': '已完成',
'report.detail.reportSummary': '报告总结', 'report.detail.reportSummary': '报告总结',
'report.detail.bugDetails': '缺陷明细', 'report.detail.bugDetails': '缺陷明细',
'report.detail.caseDetailSearchPlaceholder': '通过ID/名称/模块名称搜索',
'report.detail.featureCaseDetails': '用例明细', 'report.detail.featureCaseDetails': '用例明细',
'report.detail.executionAnalysis': '执行分析', 'report.detail.executionAnalysis': '执行分析',
'report.detail.threshold': '通过阈值', 'report.detail.threshold': '通过阈值',

View File

@ -401,6 +401,7 @@
getPlanDetailApiCaseList, getPlanDetailApiCaseList,
tableProps.value tableProps.value
); );
const existedDefect = inject<Ref<number>>('existedDefect', ref(0));
const tableRef = ref<InstanceType<typeof MsBaseTable>>(); const tableRef = ref<InstanceType<typeof MsBaseTable>>();
watch( watch(
@ -410,6 +411,18 @@
} }
); );
function getLinkAction() {
return existedDefect.value
? [
{
label: 'caseManagement.featureCase.linkDefect',
eventTag: 'linkDefect',
permission: ['PROJECT_TEST_PLAN:READ+EXECUTE', 'PROJECT_BUG:READ'],
},
]
: [];
}
const batchActions = computed(() => { const batchActions = computed(() => {
return { return {
baseAction: [ baseAction: [
@ -426,15 +439,11 @@
eventTag: 'disassociate', eventTag: 'disassociate',
permission: ['PROJECT_TEST_PLAN:READ+ASSOCIATION'], permission: ['PROJECT_TEST_PLAN:READ+ASSOCIATION'],
}, },
{ ...getLinkAction(),
label: 'caseManagement.featureCase.linkDefect',
eventTag: 'linkDefect',
permission: ['PROJECT_BUG:READ'],
},
{ {
label: 'testPlan.featureCase.noBugDataNewBug', label: 'testPlan.featureCase.noBugDataNewBug',
eventTag: 'newBug', eventTag: 'newBug',
permission: ['PROJECT_BUG:READ+ADD'], permission: ['PROJECT_TEST_PLAN:READ+EXECUTE', 'PROJECT_BUG:READ+ADD'],
}, },
], ],
}; };
@ -677,7 +686,6 @@
const associatedCaseId = ref<string>(''); const associatedCaseId = ref<string>('');
const testPlanCaseId = ref<string>(''); const testPlanCaseId = ref<string>('');
const lastExecuteReportId = ref<string>(''); const lastExecuteReportId = ref<string>('');
const existedDefect = inject<Ref<number>>('existedDefect', ref(0));
const showCreateBugDrawer = ref<boolean>(false); const showCreateBugDrawer = ref<boolean>(false);
const isBatchAssociateOrCreate = ref(false); const isBatchAssociateOrCreate = ref(false);
const caseTitle = ref<string>(''); const caseTitle = ref<string>('');

View File

@ -392,6 +392,18 @@
tableRef.value?.initColumn(columns.value); tableRef.value?.initColumn(columns.value);
} }
); );
const existedDefect = inject<Ref<number>>('existedDefect', ref(0));
function getLinkAction() {
return existedDefect.value
? [
{
label: 'caseManagement.featureCase.linkDefect',
eventTag: 'linkDefect',
permission: ['PROJECT_TEST_PLAN:READ+EXECUTE', 'PROJECT_BUG:READ'],
},
]
: [];
}
const batchActions = computed(() => { const batchActions = computed(() => {
return { return {
@ -409,15 +421,11 @@
eventTag: 'disassociate', eventTag: 'disassociate',
permission: ['PROJECT_TEST_PLAN:READ+ASSOCIATION'], permission: ['PROJECT_TEST_PLAN:READ+ASSOCIATION'],
}, },
{ ...getLinkAction(),
label: 'caseManagement.featureCase.linkDefect',
eventTag: 'linkDefect',
permission: ['PROJECT_BUG:READ'],
},
{ {
label: 'testPlan.featureCase.noBugDataNewBug', label: 'testPlan.featureCase.noBugDataNewBug',
eventTag: 'newBug', eventTag: 'newBug',
permission: ['PROJECT_BUG:READ+ADD'], permission: ['PROJECT_TEST_PLAN:READ+EXECUTE', 'PROJECT_BUG:READ+ADD'],
}, },
], ],
}; };
@ -662,7 +670,6 @@
const batchUpdateParams = ref(); const batchUpdateParams = ref();
const batchMoveModalVisible = ref(false); const batchMoveModalVisible = ref(false);
const existedDefect = inject<Ref<number>>('existedDefect', ref(0));
const isBatchAssociateOrCreate = ref(false); const isBatchAssociateOrCreate = ref(false);
const showLinkBugDrawer = ref<boolean>(false); const showLinkBugDrawer = ref<boolean>(false);
const associatedCaseId = ref<string>(''); const associatedCaseId = ref<string>('');

View File

@ -7,7 +7,7 @@
<div class="w-[500px]"> <div class="w-[500px]">
<MsBaseTable v-bind="propsRes" v-on="propsEvent"> <MsBaseTable v-bind="propsRes" v-on="propsEvent">
<template #num="{ record }"> <template #num="{ record }">
<MsButton size="mini" type="text" @click="goCaseDetail(record.id)">{{ record.num }}</MsButton> <MsButton size="mini" type="text" @click="goCaseDetail(record)">{{ record.num }}</MsButton>
</template> </template>
<template #type="{ record }"> <template #type="{ record }">
<span>{{ getCaseType(record.type) || '-' }}</span> <span>{{ getCaseType(record.type) || '-' }}</span>
@ -27,9 +27,9 @@
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useOpenNewPage from '@/hooks/useOpenNewPage'; import useOpenNewPage from '@/hooks/useOpenNewPage';
import type { PlanDetailBugItem } from '@/models/testPlan/testPlan'; import type { PlanDetailBugItem, RelateCasesType } from '@/models/testPlan/testPlan';
import { CaseLinkEnum } from '@/enums/caseEnum'; import { CaseLinkEnum } from '@/enums/caseEnum';
import { CaseManagementRouteEnum } from '@/enums/routeEnum'; import { ApiTestRouteEnum, CaseManagementRouteEnum } from '@/enums/routeEnum';
import { TableKeyEnum } from '@/enums/tableEnum'; import { TableKeyEnum } from '@/enums/tableEnum';
const props = defineProps<{ const props = defineProps<{
@ -38,7 +38,6 @@
const { openNewPage } = useOpenNewPage(); const { openNewPage } = useOpenNewPage();
const { t } = useI18n(); const { t } = useI18n();
const columns: MsTableColumn = [ const columns: MsTableColumn = [
{ {
title: 'caseManagement.featureCase.tableColumnID', title: 'caseManagement.featureCase.tableColumnID',
@ -88,11 +87,30 @@
function popupChange() { function popupChange() {
propsRes.value.data = props.bugItem.relateCases; propsRes.value.data = props.bugItem.relateCases;
} }
// TODO
function goCaseDetail(id: string) { function goCaseDetail(record: RelateCasesType) {
openNewPage(CaseManagementRouteEnum.CASE_MANAGEMENT_CASE, { const { id, type, projectId } = record;
id, switch (type) {
}); case CaseLinkEnum.API:
openNewPage(ApiTestRouteEnum.API_TEST_MANAGEMENT, {
cId: id,
pId: projectId,
});
break;
case CaseLinkEnum.FUNCTIONAL:
openNewPage(CaseManagementRouteEnum.CASE_MANAGEMENT_CASE, {
id,
});
break;
case CaseLinkEnum.SCENARIO:
openNewPage(ApiTestRouteEnum.API_TEST_SCENARIO, {
id,
pId: projectId,
});
break;
default:
break;
}
} }
</script> </script>