From 0a860f741827e8dcc76e08b463fd7590b8c1a7a2 Mon Sep 17 00:00:00 2001 From: lxd <1004405501@qq.com> Date: Mon, 17 Mar 2025 18:02:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8A=A5=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/templates/report-template.html | 73 ++++++++++++++----- .../reprot-print/components/ReportPreview.vue | 14 +++- 2 files changed, 68 insertions(+), 19 deletions(-) diff --git a/public/templates/report-template.html b/public/templates/report-template.html index 953346d..ae84eeb 100644 --- a/public/templates/report-template.html +++ b/public/templates/report-template.html @@ -553,7 +553,11 @@
-
体检编号:--
+
+
+ 体检编号:-- +
+
健康
@@ -593,10 +597,15 @@
第1页
-

+
-
前言
+
+
+ 前言 + 填充值 +
+

尊敬的________先生/女士:

@@ -615,13 +624,13 @@
第2页
@@ -630,7 +639,12 @@

-
一般检查
+
+
+ 一般检查 + 填充值 +
+
@@ -680,7 +694,7 @@

--

第3页
@@ -688,7 +702,12 @@
-
超声检查报告
+
+
+ 超声检查报告 + 填充值 +
+
@@ -713,7 +732,7 @@

第4页
@@ -721,7 +740,12 @@
-
尿常规检查报告
+
+
+ 尿常规检查报告 + 填充值 +
+
@@ -740,7 +764,7 @@

--

第5页
@@ -748,7 +772,12 @@
-
生化检查报告
+
+
+ 生化检查报告 + 填充值 +
+
@@ -767,7 +796,7 @@

--

第6页
@@ -775,7 +804,12 @@
-
血常规检查报告
+
+
+ 血常规检查报告 + 填充值 +
+
@@ -794,7 +828,7 @@

--

第7页
@@ -802,7 +836,12 @@
-
心电图检查报告
+
+
+ 心电图检查报告 + 填充值 +
+
心电图检查
@@ -815,7 +854,7 @@

第8页
diff --git a/src/views/summary/reprot-print/components/ReportPreview.vue b/src/views/summary/reprot-print/components/ReportPreview.vue index 58c21cb..4347251 100644 --- a/src/views/summary/reprot-print/components/ReportPreview.vue +++ b/src/views/summary/reprot-print/components/ReportPreview.vue @@ -212,6 +212,16 @@ const handleIframeLoad = async () => { } } + + + // 获取所有报告标题中的第二个span(填充值所在位置) + const reportTitles = doc.querySelectorAll('.report-title > div > span:nth-child(2)'); + // 更新每个填充值 + reportTitles.forEach(span => { + span.textContent = `体检编号:${reportData.medicalSn || '--'}`+`姓名:${reportData.pName || '--'}`; + }); + + // 心电图 const ecgData = reportData.data.find(item => item.type === 'ecg'); if (ecgData) { @@ -251,9 +261,8 @@ const handleIframeLoad = async () => { if (reportTitle) { const reportSection = Array.from(doc.querySelectorAll('.report-item')).find(section => { const titleElement = section.querySelector('.report-title'); - return titleElement && titleElement.textContent.trim() === reportTitle; + return titleElement && titleElement.textContent?.trim().includes(reportTitle); }); - if (reportSection) { // 为PDF URL添加参数 const pdfUrl = item.data + '#toolbar=0&navpanes=0&view=Fit'; @@ -282,6 +291,7 @@ const handleIframeLoad = async () => { } } + const handlePrint = () => { const iframe = document.querySelector('iframe') if (iframe && iframe.contentWindow) {