feat(工作台): 工作台测试计划卡片新增查询归档状态通过/未通过跳转

This commit is contained in:
xinxin.wu 2024-12-19 14:39:21 +08:00 committed by Craftsman
parent 9837330cf6
commit 7211563978
6 changed files with 67 additions and 10 deletions

View File

@ -157,7 +157,7 @@ export const toolTipConfig: TooltipOption = {
appendTo: 'body', appendTo: 'body',
formatter(params: any) { formatter(params: any) {
const html = ` const html = `
<div class="w-[144px] p-[16px] rounded flex items-center justify-between bg-[var(--color-bg-5)]"> <div class="p-[16px] w-[180px] rounded flex items-center justify-between bg-[var(--color-bg-5)]">
<div class=" flex items-center"> <div class=" flex items-center">
<div class="mb-[2px] mr-[8px] h-[6px] w-[6px] rounded-full bg-[${params.color}]" style="background:${ <div class="mb-[2px] mr-[8px] h-[6px] w-[6px] rounded-full bg-[${params.color}]" style="background:${
params.color params.color

View File

@ -407,6 +407,12 @@ export const NAV_NAVIGATION: Record<WorkNavValueEnum, any> = {
[WorkNavValueEnum.TEST_PLAN_NOT_PASS]: { [WorkNavValueEnum.TEST_PLAN_NOT_PASS]: {
passed: ['NOT_PASSED'], // 测试计划-未通过 passed: ['NOT_PASSED'], // 测试计划-未通过
}, },
[WorkNavValueEnum.TEST_PLAN_PASSED_ARCHIVED]: {
archivedPassed: [true], // 测试计划-已归档-已通过
},
[WorkNavValueEnum.TEST_PLAN_NOT_PASS_ARCHIVED]: {
archivedPassed: [false], // 测试计划-已归档-未通过
},
/** /**
* *
*/ */

View File

@ -101,6 +101,8 @@ export enum WorkNavValueEnum {
TEST_PLAN_ARCHIVED = 'TEST_PLAN_ARCHIVED', // 测试计划-已归档 TEST_PLAN_ARCHIVED = 'TEST_PLAN_ARCHIVED', // 测试计划-已归档
TEST_PLAN_PASSED = 'TEST_PLAN_PASSED', // 测试计划已通过 TEST_PLAN_PASSED = 'TEST_PLAN_PASSED', // 测试计划已通过
TEST_PLAN_NOT_PASS = 'TEST_PLAN_NOT_PASS', // 测试计划未通过通过 TEST_PLAN_NOT_PASS = 'TEST_PLAN_NOT_PASS', // 测试计划未通过通过
TEST_PLAN_NOT_PASS_ARCHIVED = 'TEST_PLAN_NOT_PASS_ARCHIVED', // 测试计划未通过已归档
TEST_PLAN_PASSED_ARCHIVED = 'TEST_PLAN_PASSED_ARCHIVED', // 测试计划已通过已归档
TEST_PLAN_BUG = 'TEST_PLAN_BUG', // 测试计划总缺陷 TEST_PLAN_BUG = 'TEST_PLAN_BUG', // 测试计划总缺陷
TEST_PLAN_LEGACY = 'TEST_PLAN_LEGACY', // 测试计划遗留缺陷 TEST_PLAN_LEGACY = 'TEST_PLAN_LEGACY', // 测试计划遗留缺陷

View File

@ -162,7 +162,6 @@
sortDirections: ['ascend', 'descend'], sortDirections: ['ascend', 'descend'],
sorter: true, sorter: true,
}, },
fixed: 'left',
width: 110, width: 110,
columnSelectorDisabled: true, columnSelectorDisabled: true,
}, },

View File

@ -12,11 +12,15 @@
<MsChart height="92px" width="92px" :options="props.options" /> <MsChart height="92px" width="92px" :options="props.options" />
</div> </div>
<div class="pass-rate-title flex-1"> <div class="pass-rate-title flex-1">
<div v-for="item of props.valueList" :key="item.label" class="flex-1"> <div v-for="(item, index) of props.valueList" :key="item.label" class="flex-1">
<div class="one-line-text mb-[8px] text-[var(--color-text-4)]">{{ item.label }}</div> <slot :ele="item" :index="index">
<div class="pass-rate-count" @click="goNavigation(item)"> <div class="one-line-text mb-[8px] text-[var(--color-text-4)]">{{ item.label }}</div>
{{ hasPermission ? addCommasToNumber(item.value as number) : '-' }} <div class="pass-rate-count text-[rgb(var(--primary-4))]">
</div> <div @click="goNavigation(item)">
{{ hasPermission ? addCommasToNumber(item.value as number) : '-' }}
</div>
</div>
</slot>
</div> </div>
</div> </div>
</a-spin> </a-spin>
@ -44,6 +48,7 @@
value: number | string; value: number | string;
status?: string; status?: string;
route?: string; route?: string;
archivedPassed?: number;
}[]; }[];
}>(); }>();
@ -67,8 +72,8 @@
@apply flex items-center gap-2; @apply flex items-center gap-2;
.pass-rate-count { .pass-rate-count {
font-size: 20px; font-size: 20px;
color: rgb(var(--primary-4)); gap: 8px;
@apply cursor-pointer font-medium; @apply flex cursor-pointer items-center justify-start font-medium;
} }
} }
} }

View File

@ -29,7 +29,22 @@
:has-permission="hasPermission" :has-permission="hasPermission"
:options="tabItem.options" :options="tabItem.options"
:value-list="tabItem.valueList" :value-list="tabItem.valueList"
/> >
<template v-if="tabItem.value === 'pass'" #default="{ ele: passItem, index }">
<div class="one-line-text mb-[8px] text-[var(--color-text-4)]">{{ passItem.label }}</div>
<div class="pass-rate-count-archived">
<div class="text-[rgb(var(--primary-4))]" @click="goNavigation(passItem, index)">
{{ hasPermission ? addCommasToNumber(passItem.value as number) : '-' }}
</div>
<div
class="mr-[8px] text-center text-[var(--color-text-brand)]"
@click="goNavigation(passItem, index, true)"
>
{{ hasPermission ? addCommasToNumber(passItem.archivedPassed || 0) : '-' }}
</div>
</div>
</template>
</PassRatePie>
</div> </div>
</div> </div>
<div class="mt-[16px] h-[148px]"> <div class="mt-[16px] h-[148px]">
@ -59,7 +74,9 @@
import { workTestPlanRage } from '@/api/modules/workbench'; import { workTestPlanRage } from '@/api/modules/workbench';
import getVisualThemeColor from '@/config/chartTheme'; import getVisualThemeColor from '@/config/chartTheme';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useOpenNewPage from '@/hooks/useOpenNewPage';
import useAppStore from '@/store/modules/app'; import useAppStore from '@/store/modules/app';
import { addCommasToNumber } from '@/utils';
import type { import type {
SelectedCardItem, SelectedCardItem,
@ -67,9 +84,12 @@
WorkTestPlanDetail, WorkTestPlanDetail,
WorkTestPlanRageDetail, WorkTestPlanRageDetail,
} from '@/models/workbench/homePage'; } from '@/models/workbench/homePage';
import { WorkNavValueEnum } from '@/enums/workbenchEnum';
import { colorMapConfig, handlePieData, handleUpdateTabPie } from '../utils'; import { colorMapConfig, handlePieData, handleUpdateTabPie } from '../utils';
const { openNewPage } = useOpenNewPage();
const { t } = useI18n(); const { t } = useI18n();
const appStore = useAppStore(); const appStore = useAppStore();
@ -155,10 +175,12 @@
{ {
name: t('workbench.homePage.havePassed'), name: t('workbench.homePage.havePassed'),
count: passed, count: passed,
archivedPassed: 0,
}, },
{ {
name: t('workbench.homePage.notPass'), name: t('workbench.homePage.notPass'),
count: notPassed, count: notPassed,
archivedPassed: 0,
}, },
]; ];
@ -249,6 +271,24 @@
}); });
} }
function goNavigation(
item: { label: string; value: number | string; status?: string; route?: string },
index: number,
isArchived = false
) {
let status;
if (isArchived) {
status = index === 0 ? WorkNavValueEnum.TEST_PLAN_PASSED_ARCHIVED : WorkNavValueEnum.TEST_PLAN_NOT_PASS_ARCHIVED;
} else {
status = item.status;
}
openNewPage(item.route, {
pId: projectId.value,
home: status,
});
}
onMounted(() => { onMounted(() => {
initTestPlanCount(); initTestPlanCount();
}); });
@ -296,4 +336,9 @@
:deep(.arco-tabs-tab) { :deep(.arco-tabs-tab) {
padding: 0 !important; padding: 0 !important;
} }
.pass-rate-count-archived {
font-size: 20px;
gap: 8px;
@apply grid cursor-pointer grid-cols-2 font-medium;
}
</style> </style>