From d9dc57e7b028712b5e03824a7540a1c033f470f9 Mon Sep 17 00:00:00 2001 From: hongchao <3228015117@qq.com> Date: Wed, 25 Dec 2024 13:50:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E7=AB=A0=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/material/lease/outBound/index.vue | 55 +++++++++++++++++---- 1 file changed, 46 insertions(+), 9 deletions(-) diff --git a/src/views/material/lease/outBound/index.vue b/src/views/material/lease/outBound/index.vue index 508001a6..0c351a99 100644 --- a/src/views/material/lease/outBound/index.vue +++ b/src/views/material/lease/outBound/index.vue @@ -490,7 +490,7 @@ append-to-body >
- +
-
+
- 检验单位: + 检验单位:xxxxxxxx
-
+
@@ -568,7 +568,7 @@
@@ -951,9 +951,7 @@ export default { created() { this.getList(); }, - mounted() { - chapter('机具检验专用章', '重庆送变电工程有限公司') - }, + methods: { // 多选框选中数据 handleSelectionChange(selection) { @@ -1171,6 +1169,9 @@ export default { handlePrint(row) { // this.query.taskId = row.taskId // this.getPrintTable(row.taskId) + setTimeout(() => { + chapter('机具检验专用章', '重庆送变电工程有限公司') + }, 100); this.openPrint = true; this.title = "出库检验单"; }, @@ -1186,7 +1187,43 @@ export default { console.log(this.leaseApplyData); }, - //打印 + //出库检验单打印 + printCheck() { + // 获取打印内容的容器 + const printContent = this.$refs.remarksPrintRefCheck.$el; + + // 获取公章canvas元素 + const canvas = document.getElementById('canvas'); + // 将canvas转换为图像 + const imgData = canvas.toDataURL('image/png'); + // 创建一个新的图像元素 + const img = new Image(); + img.src = imgData; + + // 等待图像加载完成 + img.onload = () => { + console.log('Image loaded:', img); + // 将图像插入到打印内容中 + img.style.display = 'block'; // 确保图像可见 + img.style.zIndex = '9999'; // 确保图像在最上层 + // 将图像插入到打印内容中 + printContent.appendChild(img); + console.log('content:', printContent.innerHTML); + // 调用打印方法 + setTimeout(() => { + this.$refs.remarksPrintRefCheck.print({ + // 自定义打印内容 + content: printContent.innerHTML + }); + }, 1000); + + + // 打印完成后移除图像 + printContent.removeChild(img); + }; + }, + + //领料单打印 print() { this.$refs.remarksPrintRef.print(); },