fix(导出): 测试计划报告导出
--bug=1047049 --user=白奇 【测试计划】计划-编辑修改报告总结内容-导出自定义的报告失败 https://www.tapd.cn/55049933/s/1584661
This commit is contained in:
parent
9621ebbce6
commit
b0b0dad304
|
@ -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',
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
@ -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}`,
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue