fix(报告): 测试计划报告导出按布局配置

--bug=1046675 --user=白奇 创建自定义报告 时只包括场景用例报告,导出报告仍包括全部 https://www.tapd.cn/55049933/s/1581063
This commit is contained in:
baiqi 2024-09-19 15:11:40 +08:00 committed by Craftsman
parent a62943c314
commit 4b7f338a5b
1 changed files with 29 additions and 1 deletions

View File

@ -166,6 +166,7 @@
import { BatchApiParams } from '@/models/common'; import { BatchApiParams } from '@/models/common';
import type { import type {
componentItem,
configItem, configItem,
countDetail, countDetail,
PlanReportDetail, PlanReportDetail,
@ -182,6 +183,7 @@
const route = useRoute(); const route = useRoute();
const innerCardList = ref<configItem[]>([]); const innerCardList = ref<configItem[]>([]);
const layoutShowCards = ref<componentItem[]>([]);
const detail = ref<PlanReportDetail>({ ...cloneDeep(defaultReportDetail) }); const detail = ref<PlanReportDetail>({ ...cloneDeep(defaultReportDetail) });
const reportId = ref<string>(route.query.id as string); const reportId = ref<string>(route.query.id as string);
@ -376,6 +378,7 @@
async function getDefaultLayout() { async function getDefaultLayout() {
try { try {
const res = await getReportLayout(detail.value.id, shareId.value); const res = await getReportLayout(detail.value.id, shareId.value);
layoutShowCards.value = res;
innerCardList.value = res innerCardList.value = res
.filter((e: any) => [ReportCardTypeEnum.CUSTOM_CARD, ReportCardTypeEnum.SUMMARY].includes(e.name)) .filter((e: any) => [ReportCardTypeEnum.CUSTOM_CARD, ReportCardTypeEnum.SUMMARY].includes(e.name))
.map((item: any) => { .map((item: any) => {
@ -679,7 +682,32 @@
})) as RowInput[], })) as RowInput[],
}); });
} }
await Promise.all([initBugList(), initCaseList(), initApiList(), initScenarioList()]); const pageRequest = [];
if (
isDefaultLayout.value ||
(!isDefaultLayout.value && layoutShowCards.value.some((e) => e.name === ReportCardTypeEnum.BUG_DETAIL))
) {
pageRequest.push(initBugList());
}
if (
isDefaultLayout.value ||
(!isDefaultLayout.value && layoutShowCards.value.some((e) => e.name === ReportCardTypeEnum.FUNCTIONAL_DETAIL))
) {
pageRequest.push(initCaseList());
}
if (
isDefaultLayout.value ||
(!isDefaultLayout.value && layoutShowCards.value.some((e) => e.name === ReportCardTypeEnum.API_CASE_DETAIL))
) {
pageRequest.push(initApiList());
}
if (
!isDefaultLayout.value &&
layoutShowCards.value.some((e) => e.name === ReportCardTypeEnum.SCENARIO_CASE_DETAIL)
) {
pageRequest.push(initScenarioList());
}
await Promise.all(pageRequest);
if (fullBugList.value.length > 0) { if (fullBugList.value.length > 0) {
tableArr.push({ tableArr.push({
tableId: 'bug', tableId: 'bug',