From 3647241da061b6fba84f8746a6a6b6f9b4249902 Mon Sep 17 00:00:00 2001 From: Esacpe <1113279529@qq.com> Date: Thu, 28 Aug 2025 17:55:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AnalysisReport/components/a.js | 78 ------------------- .../backOfficeSystem/AnalysisReport/index.vue | 65 +--------------- .../warningControl/components/yjItem.vue | 4 +- 3 files changed, 3 insertions(+), 144 deletions(-) delete mode 100644 src/views/backOfficeSystem/AnalysisReport/components/a.js diff --git a/src/views/backOfficeSystem/AnalysisReport/components/a.js b/src/views/backOfficeSystem/AnalysisReport/components/a.js deleted file mode 100644 index a8b96d2..0000000 --- a/src/views/backOfficeSystem/AnalysisReport/components/a.js +++ /dev/null @@ -1,78 +0,0 @@ -// import jsPDF from 'jspdf'; -// import html2canvas from 'html2canvas'; - - -// export function useExportToPDF() { -// const exportToImage = async (element, filename = 'screenshot.png') => { -// const canvas = await html2canvas(element, { -// scale: 2, -// useCORS: true, -// }); - -// // 转换为图片并下载 -// const link = document.createElement('a'); -// link.download = filename; -// link.href = canvas.toDataURL('image/png'); -// link.click(); -// }; - -// // 将div导出为PDF的方法 -// const exportDivToPDF = async (element, filename = 'document.pdf') => { -// try { -// // 使用html2canvas将div转换为canvas -// const canvas = await html2canvas(element, { -// scale: 2, // 提高清晰度 -// useCORS: true, // 允许跨域图片 -// logging: false, // 关闭日志 -// width: element.offsetWidth, -// height: element.offsetHeight, -// windowWidth: element.scrollWidth, -// windowHeight: element.scrollHeight, -// backgroundColor: '#ffffff' // 设置背景色为白色 -// }); - -// // 获取canvas的宽高 -// const imgWidth = 210; // A4纸宽度(mm) -// const pageHeight = 297; // A4纸高度(mm) -// const imgHeight = canvas.height * imgWidth / canvas.width; -// let heightLeft = imgHeight; -// let position = 0; - -// // 创建PDF文档 -// const pdf = new jsPDF({ -// orientation: 'portrait', -// unit: 'mm', -// format: 'a4' -// }); - -// // 将canvas转换为图片并添加到PDF -// const imgData = canvas.toDataURL('image/png'); -// pdf.addImage(imgData, 'PNG', 0, position, imgWidth, imgHeight); -// heightLeft -= pageHeight; - -// // 如果内容超出一页,添加新页面 -// while (heightLeft > 0) { -// position = heightLeft - imgHeight; -// pdf.addPage(); -// pdf.addImage(imgData, 'PNG', 0, position, imgWidth, imgHeight); -// heightLeft -= pageHeight; -// } - -// // 下载PDF -// pdf.save(filename); -// } catch (error) { -// console.error('导出PDF失败:', error); -// alert('导出PDF失败,请稍后重试'); -// } -// }; - -// return { -// exportToImage, -// exportDivToPDF -// }; -// } -// exportToImage -// }; -// } -export function exportDivToPDF(divId, filename) { -} diff --git a/src/views/backOfficeSystem/AnalysisReport/index.vue b/src/views/backOfficeSystem/AnalysisReport/index.vue index 53d637d..fe0789c 100644 --- a/src/views/backOfficeSystem/AnalysisReport/index.vue +++ b/src/views/backOfficeSystem/AnalysisReport/index.vue @@ -124,19 +124,15 @@