From bdc861cf8e56b705d388d867d89821605189beec Mon Sep 17 00:00:00 2001 From: duxingchen Date: Thu, 6 Aug 2026 10:37:08 +0800 Subject: [PATCH] =?UTF-8?q?Web=E7=AB=AF=E5=88=9B=E5=BB=BA=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E6=88=90=E5=8A=9F=E5=BC=B9=E7=AA=97:=20=E6=89=93?= =?UTF-8?q?=E5=BC=80=E4=BA=8C=E7=BB=B4=E7=A0=81=E2=86=92=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=A0=87=E7=AD=BE(window.print+=E9=9A=90?= =?UTF-8?q?=E5=BC=8F=E7=AA=97=E5=8F=A3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/admin/CreateProductDialog.tsx | 38 +++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/frontend/src/pages/admin/CreateProductDialog.tsx b/frontend/src/pages/admin/CreateProductDialog.tsx index 9c08f31..a55a027 100644 --- a/frontend/src/pages/admin/CreateProductDialog.tsx +++ b/frontend/src/pages/admin/CreateProductDialog.tsx @@ -284,6 +284,38 @@ export default function CreateProductDialog({ open, onClose, onCreated }: Props) }; }); + // ============================================================ + // 打印标签 + // ============================================================ + + function printCurrentQRCode() { + if (!createdSn) return; + const qrUrl = `/api/v1/products/qrcode/${createdSn}`; + const printWindow = window.open("", "_blank", "width=600,height=600"); + if (!printWindow) return; + printWindow.document.write(` + + + 打印标签 - ${createdSn} + + + + +
${createdSn}
+ + + `); + printWindow.document.close(); + } + // ============================================================ // 渲染 // ============================================================ @@ -310,10 +342,10 @@ export default function CreateProductDialog({ open, onClose, onCreated }: Props)

产品创建成功!

- -