fix(测试用例): 修复功能用例详情测试计划列表状态展示不正确
This commit is contained in:
parent
28c0a50585
commit
b106a41de9
|
@ -17,7 +17,8 @@
|
|||
<a-button type="text" class="px-0" @click="goToPlan(record)">{{ record.testPlanNum }}</a-button>
|
||||
</template>
|
||||
<template #planStatus="{ record }">
|
||||
<MsStatusTag :status="record.planStatus" />
|
||||
<MsStatusTag v-if="getStatus(record.testPlanId)" :status="getStatus(record.testPlanId)" />
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
<template #lastExecResult="{ record }">
|
||||
<ExecuteResult :execute-result="record.lastExecResult || 'PENDING'" />
|
||||
|
@ -45,9 +46,10 @@
|
|||
import MsStatusTag from '@/components/business/ms-status-tag/index.vue';
|
||||
|
||||
import { getLinkedCaseTestPlanList } from '@/api/modules/case-management/featureCase';
|
||||
import { getPlanPassRate } from '@/api/modules/test-plan/testPlan';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
|
||||
import { AssociateFunctionalCaseItem, planStatusType } from '@/models/testPlan/testPlan';
|
||||
import { AssociateFunctionalCaseItem, PassRateCountDetail, planStatusType } from '@/models/testPlan/testPlan';
|
||||
import { TestPlanRouteEnum } from '@/enums/routeEnum';
|
||||
import { TableKeyEnum } from '@/enums/tableEnum';
|
||||
import { FilterSlotNameEnum } from '@/enums/tableFilterEnum';
|
||||
|
@ -107,10 +109,11 @@
|
|||
title: 'caseManagement.featureCase.planStatus',
|
||||
slotName: 'planStatus',
|
||||
dataIndex: 'planStatus',
|
||||
filterConfig: {
|
||||
options: planStatusOptions.value,
|
||||
filterSlotName: FilterSlotNameEnum.TEST_PLAN_STATUS_FILTER,
|
||||
},
|
||||
// TODO : 这个版本先不上过滤后台没有做
|
||||
// filterConfig: {
|
||||
// options: planStatusOptions.value,
|
||||
// filterSlotName: FilterSlotNameEnum.TEST_PLAN_STATUS_FILTER,
|
||||
// },
|
||||
width: 200,
|
||||
},
|
||||
{
|
||||
|
@ -188,6 +191,38 @@
|
|||
}
|
||||
);
|
||||
|
||||
const defaultCountDetailMap = ref<Record<string, PassRateCountDetail>>({});
|
||||
|
||||
function getStatus(id: string) {
|
||||
return defaultCountDetailMap.value[id]?.status;
|
||||
}
|
||||
|
||||
// 获取状态统计
|
||||
async function getStatistics(selectedPlanIds: (string | undefined)[]) {
|
||||
try {
|
||||
const result = await getPlanPassRate(selectedPlanIds);
|
||||
result.forEach((item: PassRateCountDetail) => {
|
||||
defaultCountDetailMap.value[item.id] = item;
|
||||
});
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => propsRes.value.data,
|
||||
(val) => {
|
||||
if (val) {
|
||||
const selectedPlanIds: (string | undefined)[] = propsRes.value.data.map((e) => e.testPlanId) || [];
|
||||
getStatistics(selectedPlanIds);
|
||||
}
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
}
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
initData();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue