diff --git a/klp-ui/src/views/wms/coil/panels/LabelRender/OuterTagPreview.vue b/klp-ui/src/views/wms/coil/panels/LabelRender/OuterTagPreview.vue index 060df98e..d206a337 100644 --- a/klp-ui/src/views/wms/coil/panels/LabelRender/OuterTagPreview.vue +++ b/klp-ui/src/views/wms/coil/panels/LabelRender/OuterTagPreview.vue @@ -374,7 +374,7 @@ export default { text-align: center; } -/* 打印样式 - 强制单页,适配180mm x 100mm纸张 */ +/* 打印样式 - 强制单页,适配180mm x 100mm纸张,保持原有样式不变 */ @media print { @page { size: 180mm 100mm; @@ -387,41 +387,18 @@ export default { print-color-adjust: exact !important; } - html { + html, body { margin: 0 !important; padding: 0 !important; - width: 180mm !important; - height: 100mm !important; overflow: hidden !important; } - body { - margin: 0 !important; - padding: 0 !important; - width: 180mm !important; - height: 100mm !important; - overflow: hidden !important; - position: relative !important; - } - /* 隐藏所有其他内容,只显示标签容器 */ body > *:not(.label-container) { display: none !important; } - /* 确保标签容器是 body 的直接子元素且唯一可见 */ .label-container { - /* 强制使用纸张尺寸 */ - width: 180mm !important; - height: 100mm !important; - max-width: 180mm !important; - max-height: 100mm !important; - min-width: 180mm !important; - min-height: 100mm !important; - - padding: 2mm !important; - margin: 0 !important; - /* 防止分页 - 多重保护 */ page-break-inside: avoid !important; break-inside: avoid !important; @@ -432,56 +409,14 @@ export default { orphans: 999 !important; widows: 999 !important; - /* 确保内容不溢出 */ - overflow: hidden !important; - box-sizing: border-box !important; - - /* 应用动态缩放 */ + /* 应用动态缩放,保持原有样式 */ transform: scale(var(--print-scale, 1)) !important; transform-origin: top left !important; - /* 定位和布局 */ - position: absolute !important; - top: 0 !important; - left: 0 !important; - /* 确保缩放后不超出纸张 */ - display: block !important; - } - - /* 打印时调整字体和间距,使用相对单位自动缩放 */ - .company-header { - margin-bottom: 0.3em; - } - - .company-logo { - width: 4em; - height: 4em; - margin-right: 0.5em; - } - - .info-grid { - margin-bottom: 0.5em; - } - - .info-grid-item { - padding: 0.1em; - font-size: 1.05em; - height: 2em; - } - - .footer-info { - font-size: 0.7em; - margin-top: 0.3em; - } - - /* 确保二维码在打印时正确显示 */ - .contact-timestamp img, - .contact-timestamp canvas { - width: 15mm !important; - height: 15mm !important; - max-width: 15mm !important; - max-height: 15mm !important; + max-width: 180mm !important; + max-height: 100mm !important; + overflow: hidden !important; } } \ No newline at end of file diff --git a/klp-ui/src/views/wms/coil/panels/LabelRender/ProductionTagPreview.vue b/klp-ui/src/views/wms/coil/panels/LabelRender/ProductionTagPreview.vue index 5fc811cf..3be175e9 100644 --- a/klp-ui/src/views/wms/coil/panels/LabelRender/ProductionTagPreview.vue +++ b/klp-ui/src/views/wms/coil/panels/LabelRender/ProductionTagPreview.vue @@ -233,7 +233,7 @@ export default { text-align: center; } -/* 打印样式 - 强制单页,适配180mm x 100mm纸张 */ +/* 打印样式 - 强制单页,适配180mm x 100mm纸张,保持原有样式不变 */ @media print { @page { size: 180mm 100mm; @@ -246,40 +246,18 @@ export default { print-color-adjust: exact !important; } - html { + html, body { margin: 0 !important; padding: 0 !important; - width: 180mm !important; - height: 100mm !important; overflow: hidden !important; } - body { - margin: 0 !important; - padding: 0 !important; - width: 180mm !important; - height: 100mm !important; - overflow: hidden !important; - position: relative !important; - } - /* 隐藏所有其他内容,只显示标签容器 */ body > *:not(.material-label-container) { display: none !important; } .material-label-container { - /* 强制使用纸张尺寸 */ - width: 180mm !important; - height: 100mm !important; - max-width: 180mm !important; - max-height: 100mm !important; - min-width: 180mm !important; - min-height: 100mm !important; - - padding: 2mm !important; - margin: 0 !important; - /* 防止分页 - 多重保护 */ page-break-inside: avoid !important; break-inside: avoid !important; @@ -290,45 +268,14 @@ export default { orphans: 999 !important; widows: 999 !important; - /* 确保内容不溢出 */ - overflow: hidden !important; - box-sizing: border-box !important; - - /* 应用动态缩放 */ + /* 应用动态缩放,保持原有样式 */ transform: scale(var(--print-scale, 1)) !important; transform-origin: top left !important; - /* 定位和布局 */ - position: absolute !important; - top: 0 !important; - left: 0 !important; - /* 确保缩放后不超出纸张 */ - display: block !important; - } - - .material-label-table { - width: 100%; - height: 100%; - } - - .material-label-table td { - padding: 0; - height: auto; - } - - .label-cell { - background-color: #f5f5f5 !important; - font-weight: bold; - } - - /* 确保二维码在打印时正确显示 */ - .value-cell img, - .value-cell canvas { - width: 10mm !important; - height: 10mm !important; - max-width: 10mm !important; - max-height: 10mm !important; + max-width: 180mm !important; + max-height: 100mm !important; + overflow: hidden !important; } } \ No newline at end of file