diff --git a/apps/web-antd/src/views/wms/order/receipt/modules/print.vue b/apps/web-antd/src/views/wms/order/receipt/modules/print.vue index a0b98775d..4bb43a4a1 100644 --- a/apps/web-antd/src/views/wms/order/receipt/modules/print.vue +++ b/apps/web-antd/src/views/wms/order/receipt/modules/print.vue @@ -37,6 +37,7 @@ const printRows = computed(() => })), ); +/** 等待条码和打印 DOM 完成绘制,避免浏览器打印到旧内容 */ function waitForPaint() { return new Promise((resolve) => { requestAnimationFrame(() => { @@ -45,10 +46,12 @@ function waitForPaint() { }); } +/** 退出打印模式,恢复当前页面显示 */ function removePrintMode() { document.body.classList.remove('wms-receipt-order-printing'); } +/** 获取打印用字典文案,空值统一显示为横杠 */ function getPrintDictLabel(dictType: string, value?: number) { if (value === undefined || value === null) { return '-'; @@ -56,6 +59,7 @@ function getPrintDictLabel(dictType: string, value?: number) { return getDictLabel(dictType, value) || '-'; } +/** 打印入库单:加载数据后只展示打印区域,再调用浏览器打印 */ async function print(id: number) { const order = await getReceiptOrder(id); const details = order.details || (await getReceiptOrderDetailListByOrderId(id)); @@ -71,126 +75,134 @@ defineExpose({ print });