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 { TableQueryParams } from '@/models/common';
import { BatchApiParams, DragSortParams } from '@/models/common';
import { LastExecuteResults } from '@/enums/caseEnum';
import { CaseLinkEnum, LastExecuteResults } from '@/enums/caseEnum';
import {
type PlanMinderAssociateType,
type PlanMinderCollectionType,
@ -136,16 +136,20 @@ export interface UseCountType {
testProgress: string; // 测试进度
}
export interface RelateCasesType {
id: string;
bugId: string;
name: string;
projectId: string;
type: CaseLinkEnum;
}
// 计划详情缺陷列表
export interface PlanDetailBugItem {
id: string;
num: string;
title: string;
relateCases: {
id: string;
bugId: string;
name: string;
}[];
relateCases: RelateCasesType[];
handleUser: string;
status: string;
createUser: string;

View File

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

View File

@ -6,7 +6,7 @@
<span class="mx-[16px]"> {{ t('ms.case.associate.testSet') }}</span>
<a-input-search
v-model:model-value="keyword"
:placeholder="t('common.searchByIdName')"
:placeholder="t('report.detail.caseDetailSearchPlaceholder')"
allow-clear
class="w-[240px]"
@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.detail.reportSummary': 'Report summary',
'report.detail.bugDetails': 'Bug details',
'report.detail.caseDetailSearchPlaceholder': 'Search by ID/ name/module name',
'report.detail.featureCaseDetails': 'Case details',
'report.detail.executionAnalysis': 'Execution Analysis',
'report.detail.threshold': 'Pass threshold',

View File

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

View File

@ -401,6 +401,7 @@
getPlanDetailApiCaseList,
tableProps.value
);
const existedDefect = inject<Ref<number>>('existedDefect', ref(0));
const tableRef = ref<InstanceType<typeof MsBaseTable>>();
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(() => {
return {
baseAction: [
@ -426,15 +439,11 @@
eventTag: 'disassociate',
permission: ['PROJECT_TEST_PLAN:READ+ASSOCIATION'],
},
{
label: 'caseManagement.featureCase.linkDefect',
eventTag: 'linkDefect',
permission: ['PROJECT_BUG:READ'],
},
...getLinkAction(),
{
label: 'testPlan.featureCase.noBugDataNewBug',
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 testPlanCaseId = ref<string>('');
const lastExecuteReportId = ref<string>('');
const existedDefect = inject<Ref<number>>('existedDefect', ref(0));
const showCreateBugDrawer = ref<boolean>(false);
const isBatchAssociateOrCreate = ref(false);
const caseTitle = ref<string>('');

View File

@ -392,6 +392,18 @@
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(() => {
return {
@ -409,15 +421,11 @@
eventTag: 'disassociate',
permission: ['PROJECT_TEST_PLAN:READ+ASSOCIATION'],
},
{
label: 'caseManagement.featureCase.linkDefect',
eventTag: 'linkDefect',
permission: ['PROJECT_BUG:READ'],
},
...getLinkAction(),
{
label: 'testPlan.featureCase.noBugDataNewBug',
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 batchMoveModalVisible = ref(false);
const existedDefect = inject<Ref<number>>('existedDefect', ref(0));
const isBatchAssociateOrCreate = ref(false);
const showLinkBugDrawer = ref<boolean>(false);
const associatedCaseId = ref<string>('');

View File

@ -7,7 +7,7 @@
<div class="w-[500px]">
<MsBaseTable v-bind="propsRes" v-on="propsEvent">
<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 #type="{ record }">
<span>{{ getCaseType(record.type) || '-' }}</span>
@ -27,9 +27,9 @@
import { useI18n } from '@/hooks/useI18n';
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 { CaseManagementRouteEnum } from '@/enums/routeEnum';
import { ApiTestRouteEnum, CaseManagementRouteEnum } from '@/enums/routeEnum';
import { TableKeyEnum } from '@/enums/tableEnum';
const props = defineProps<{
@ -38,7 +38,6 @@
const { openNewPage } = useOpenNewPage();
const { t } = useI18n();
const columns: MsTableColumn = [
{
title: 'caseManagement.featureCase.tableColumnID',
@ -88,11 +87,30 @@
function popupChange() {
propsRes.value.data = props.bugItem.relateCases;
}
function goCaseDetail(id: string) {
openNewPage(CaseManagementRouteEnum.CASE_MANAGEMENT_CASE, {
id,
});
// TODO
function goCaseDetail(record: RelateCasesType) {
const { id, type, projectId } = record;
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>