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(() => { const contentStyles = computed(() => {
return { return {
maxHeight: props.autoHeight ? '800px' : props.maxHeight || '260px', maxHeight: props.autoHeight ? '' : props.maxHeight || '260px',
overflow: 'auto', overflow: props.autoHeight ? 'hidden' : 'auto',
}; };
}); });

View File

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

View File

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