From 9f54af69a1d6d069db29331243a2830067796920 Mon Sep 17 00:00:00 2001 From: guoshuang Date: Thu, 15 Aug 2024 12:19:13 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=86=E6=96=99=E5=8D=95=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/mes/prepare/index.vue | 102 ++++++++++++++++++++------- src/views/plan/workorder/printID.vue | 2 +- 2 files changed, 79 insertions(+), 25 deletions(-) diff --git a/src/views/mes/prepare/index.vue b/src/views/mes/prepare/index.vue index 3efd4b11..8246ba81 100644 --- a/src/views/mes/prepare/index.vue +++ b/src/views/mes/prepare/index.vue @@ -226,7 +226,7 @@
@@ -234,31 +234,33 @@ - 生产订单备料单({{printData.printTitle}}) + 生产订单备料单({{printData.printTitle}}) - 工厂:{{printData.factory}} - 工作中心:{{printData.workCenter}} - 线体:{{printData.prodLineCode}} - 生产日期:{{printData.productDate}} - 打印日期:{{printData.printDate}} - 页次: 1/ 1 + 工厂:{{printData.factory}} + 工作中心:{{printData.workCenter}} + 线体:{{printData.prodLineCode}} + + + 生产日期:{{printData.productDate}} + 打印日期:{{printData.printDate}} + 页次: 1/ 1 - + - + - - - - - + + + + +
@@ -293,6 +295,7 @@ export default { // components: {Detail}, data() { return { + shengchan:true, newWorkerLoading: false, refreshNewWorkerTable:true, showWorkorderCode:true, @@ -403,17 +406,38 @@ export default { printJS({ printable: params.printable, // 'printFrom', // 标签元素id type: params.type || 'html', - maxWidth: 1500, // 最大宽度 - font_size: "",// 设置字体大小 + dpi: 300, // 清晰度 + //font_size: "",// 设置字体大小 header: params.header, // '表单', targetStyles: ['*'], - style: '@page {margin:0 10mm};', // 可选-打印时去掉眉页眉尾 + style: ` + + body {margin: 5mm;padding: 0;} + .my-print-table { + width: 100%; + } + .my-print-table tr { + page-break-inside: avoid; + page-break-after: auto; + } + .my-print-table thead { + display: table-header-group; /* 确保表头在每一页显示 */ + } + .my-print-table tbody { + display: table-row-group; + } + .my-print-table th, .my-print-table td { + word-wrap: break-word; + white-space: normal; + } + `, ignoreElements: params.ignore || [], // ['no-print'] properties: params.properties || null }) }, // 打印预览(生产物料) showPrint() { + this.shengchan = true; // 清楚缓存 this.printData.workCenter = "暂无数据"; this.printData.printDate = null; @@ -444,7 +468,7 @@ export default { this.$modal.msgError("请选择工单生产日期"); return; } - + this.shengchan = false; // 清楚缓存 this.printData.workCenter = "暂无数据"; this.printData.printDate = null; @@ -593,22 +617,52 @@ export default { .my-print-head { margin-top: 20px; font-weight: bold; + text-align: center; } .my-print-nav { margin-top: 15px; margin-bottom: 15px; } -.my-print-table { -} .my-print-foot { margin-top: 20px; } @media print { + body { + font-family: 'Arial', sans-serif; /* 设置字体为'Arial'或其他清晰的无衬线字体 */ + font-size: 14px; /* 设置字体大小 */ + } + table, th, td { + border: 1px solid black; + border-collapse: collapse; + font-size: 14px; /* 确保表格内字体大小一致 */ + } +} +/* @media print { #printFrom{ font-family: "SimSun", "宋体" !important; color: #000 !important; - font-size: 14pt !important; /* 调整字体大小 */ + font-size: 14pt !important; + -webkit-print-color-adjust: exact; } -} + + .my-print-table { + width: 100%; + page-break-inside: auto; + } + .my-print-table tr { + page-break-inside: avoid; + } + .my-print-table thead { + display: table-header-group; + } + .my-print-table th, .my-print-table td { + word-wrap: break-word; + white-space: normal; + } + @page { + size: A5 portrait; + margin: 5mm; + } +} */ diff --git a/src/views/plan/workorder/printID.vue b/src/views/plan/workorder/printID.vue index bc25d1f8..f20abb05 100644 --- a/src/views/plan/workorder/printID.vue +++ b/src/views/plan/workorder/printID.vue @@ -119,7 +119,7 @@ export default { header: params.header, // '表单', targetStyles: ['*'], style: ` - @page { size: A5 landscape; } body { margin: 10mm; padding: 0; } + body { margin: 10mm; padding: 0; } .print-page { page-break-after: always; } `, ignoreElements: params.ignore || [],