fix(导出): 测试计划报告导出

--bug=1047049 --user=白奇 【测试计划】计划-编辑修改报告总结内容-导出自定义的报告失败 https://www.tapd.cn/55049933/s/1584661
This commit is contained in:
baiqi 2024-09-24 14:15:38 +08:00 committed by Craftsman
parent 9621ebbce6
commit b0b0dad304
3 changed files with 24 additions and 18 deletions

View File

@ -521,8 +521,8 @@
const contentStyles = computed(() => {
return {
maxHeight: props.autoHeight ? '800px' : props.maxHeight || '260px',
overflow: 'auto',
maxHeight: props.autoHeight ? '' : props.maxHeight || '260px',
overflow: props.autoHeight ? 'hidden' : 'auto',
};
});

View File

@ -107,9 +107,9 @@ export default async function exportPDF(
};
autoTableConfig.forEach((config, index) => {
autoTable(pdf, {
...(commonOdfTableConfig as UserOptions),
...config,
startY: index === 0 && lastImagePageUseHeight > 0 ? lastImagePageUseHeight + 32 : undefined, // 第一页表格如果和图片同一页,则需要设置 startY 为当前图片占用高度+32以避免表格遮挡图片
...(commonOdfTableConfig as UserOptions),
didDrawPage: (data) => {
pdf.text(
`${data.doc.internal.getCurrentPageInfo().pageNumber}`,

View File

@ -167,7 +167,6 @@
import { BatchApiParams } from '@/models/common';
import type {
componentItem,
configItem,
countDetail,
PlanReportDetail,
@ -685,10 +684,10 @@
);
return {
apiColumns: apiColumns || apiDefaultColumns,
scenarioColumns: scenarioColumns || apiDefaultColumns,
bugColumns: bugColumns || bugDefaultColumns,
functionalCaseColumns: functionalCaseColumns || caseDefaultColumns,
apiColumns: apiColumns.length > 0 ? apiColumns : apiDefaultColumns.value,
scenarioColumns: scenarioColumns.length > 0 ? scenarioColumns : apiDefaultColumns.value,
bugColumns: bugColumns.length > 0 ? bugColumns : bugDefaultColumns,
functionalCaseColumns: functionalCaseColumns.length > 0 ? functionalCaseColumns : caseDefaultColumns.value,
};
}
@ -869,7 +868,9 @@
if (customCardImages.length > 0 || summaryImages.length > 0) {
let loadedImageCount = 0;
await new Promise((resolve) => {
const images = [...customCardImages, ...summaryImages];
const images = [...customCardImages, ...summaryImages].filter((image) => !image.complete); // JS
if (images.length > 0) {
//
images.forEach((image) => {
image.onload = () => {
loadedImageCount += 1;
@ -879,6 +880,11 @@
}
};
});
} else {
// PDF
doExport(name, tableArr);
resolve(true);
}
});
} else {
doExport(name, tableArr);