From 7c9a14ef5d0a01159096582dfa150bf9c6e98079 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=9C=E7=AC=99=E6=AD=8C?= <2277317060@qq.com> Date: Mon, 23 Jun 2025 17:49:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9C=8B=E6=9D=BF=E5=92=8C?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.ts | 5 + src/views/mes/productPlanDetail/index.vue | 7 +- src/views/print/externalPrint.vue | 123 +++++++++++++--------- src/views/print/test.vue | 17 +++ src/views/print/view.vue | 6 ++ 5 files changed, 106 insertions(+), 52 deletions(-) create mode 100644 src/views/print/test.vue diff --git a/src/router/index.ts b/src/router/index.ts index 616d019..5522b34 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -26,6 +26,11 @@ import Layout from '@/layout/index.vue'; // 公共路由 export const constantRoutes: RouteRecordRaw[] = [ + { + path: '/test', + hidden: true, + component: () => import('@/views/print/test.vue') + }, { path: '/externalPrint', hidden: true, diff --git a/src/views/mes/productPlanDetail/index.vue b/src/views/mes/productPlanDetail/index.vue index 0aada43..8af17ee 100644 --- a/src/views/mes/productPlanDetail/index.vue +++ b/src/views/mes/productPlanDetail/index.vue @@ -310,6 +310,8 @@ diff --git a/src/views/print/externalPrint.vue b/src/views/print/externalPrint.vue index 40db1a0..d9a4477 100644 --- a/src/views/print/externalPrint.vue +++ b/src/views/print/externalPrint.vue @@ -1,58 +1,54 @@ - - - - {{ printName() }} - - - 导出PDF - 本地打印 - {{ i.name }} - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - 关闭 - - + + + {{ printName() }} + + + 导出PDF + 本地打印 + {{ i.name }} + + + + + { + if (event.data === 'print') { + printFun(); + } + console.log(event); +}); onMounted(() => { nodes.value = JSON.parse(localStorage.getItem('printNodes') || '[]'); + const param = route.query.data; + if (isJSON(param)) { + let data = JSON.parse(param); + if (Array.isArray(data)) { + + } + // if() + } }); const printInfoObj = { @@ -222,6 +235,16 @@ defineExpose({ position: absolute; } +.left { + display: inline-block; + width: calc(100% - 200px); +} + +.right { + vertical-align: top; + display: inline-block; + width: 200px; +} diff --git a/src/views/print/view.vue b/src/views/print/view.vue index 604bd8a..439b4f5 100644 --- a/src/views/print/view.vue +++ b/src/views/print/view.vue @@ -237,6 +237,12 @@ defineExpose({ /* 打印样式:仅显示图片区域 */ @media print { + @page { + + + margin: 0; + + } body * { visibility: hidden !important; }