chenhaozhe
2025-12-16 e7c5ce7f86210ea57ca10f98c265ecc5bbf27a12
调整打印样式
1个文件已修改
15 ■■■■ 已修改文件
src/views/component/printList/barcode.vue 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/component/printList/barcode.vue
@@ -26,6 +26,7 @@
        recordset: [],
      },
      grfPath: "",
      oriention: null,
    };
  },
  async mounted() {
@@ -115,6 +116,7 @@
      this.pageSize.width = grfMeta.Printer.Width * 10 + "mm";
      this.pageSize.height = grfMeta.Printer.Height * 10 + "mm";
      console.log("pageSize: ",this.pageSize)
      this.oriention = grfMeta.Printer.Oriention.toLowerCase()
    },
    getTemp() {
      // 对每个要打印的对象添加分页
@@ -136,10 +138,11 @@
        type: "html",
        style:
          this.styleList[0].innerText +
          ` @media print {
          `
            .printable {
              page-break-inside: avoid;
              page-break-after: always;
              box-sizing: border-box !important; /* 内边距不影响宽高 */
            }
            @page {
@@ -148,9 +151,16 @@
              padding: 0;
            }
            table { border-collapse: collapse !important; }
            * {
              margin: 0;
              padding: 0;
              color: #000 !important;
              opacity: 1 !important;
              filter: none !important;
              text-shadow: none !important;
              -webkit-print-color-adjust: exact; /* 强制还原颜色(避免淡色) */
            }
        `,
      });
@@ -159,4 +169,5 @@
};
</script>
<style></style>
<style>
</style>