diff --git a/klp-ui/src/views/wms/coil/panels/LabelRender/index.vue b/klp-ui/src/views/wms/coil/panels/LabelRender/index.vue index 64c760ae..7b03a6d3 100644 --- a/klp-ui/src/views/wms/coil/panels/LabelRender/index.vue +++ b/klp-ui/src/views/wms/coil/panels/LabelRender/index.vue @@ -166,7 +166,7 @@ export default { style: ` @page { size: ${paperWidthMm}mm ${paperHeightMm}mm; - margin: 0 !important; + margin: 2mm !important; /* 留出页边距,避免紧贴边框 */ padding: 0 !important; } * { @@ -181,8 +181,8 @@ export default { overflow: hidden !important; } #${printContainerId} { - width: ${paperWidthMm}mm !important; - height: ${paperHeightMm}mm !important; + width: calc(${paperWidthMm}mm - 4mm) !important; /* 两侧各2mm的页边距后可用宽度 */ + height: calc(${paperHeightMm}mm - 4mm) !important; /* 上下各2mm的页边距后可用高度 */ margin: 0 !important; padding: 0 !important; display: flex !important; @@ -190,10 +190,10 @@ export default { justify-content: center !important; } #${printContainerId} canvas { - width: ${paperWidthMm}mm !important; - height: ${paperHeightMm}mm !important; - max-width: ${paperWidthMm}mm !important; - max-height: ${paperHeightMm}mm !important; + width: 100% !important; + height: 100% !important; + max-width: calc(${paperWidthMm}mm - 4mm) !important; + max-height: calc(${paperHeightMm}mm - 4mm) !important; object-fit: contain !important; border: none !important; }