From 08b04b418b3c1cfc5d94ee0277a72a53efb30e8f Mon Sep 17 00:00:00 2001 From: wuduoyi Date: Fri, 10 May 2024 11:40:15 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20word=20?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E5=A4=B1=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis-core/src/actions/PrintAction.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/amis-core/src/actions/PrintAction.ts b/packages/amis-core/src/actions/PrintAction.ts index 19d920e6f..eb76da46c 100644 --- a/packages/amis-core/src/actions/PrintAction.ts +++ b/packages/amis-core/src/actions/PrintAction.ts @@ -8,7 +8,7 @@ import { } from './Action'; export interface IPrintAction extends ListenerAction { - actionType: 'copy'; + actionType: 'print'; args: { id?: string; ids?: string[]; @@ -28,6 +28,21 @@ export class PrintAction implements RendererAction { renderer: ListenerContext, event: RendererEvent ) { + // 兼容之前的 word 打印 + if (action.componentId) { + const targetComponent = event.context.scoped?.getComponentById( + action.componentId + ); + targetComponent?.doAction( + { + ...action, + target: undefined + }, + renderer + ); + return; + } + if (action.args?.id) { const element = document.querySelector(`[data-id='${action.args.id}']`); if (element) { From 268f91ec12a9078532410f6953f7c5de5f590bc6 Mon Sep 17 00:00:00 2001 From: wuduoyi Date: Fri, 10 May 2024 13:47:42 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=20doAction=20=E7=9A=84?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis-core/src/actions/PrintAction.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/amis-core/src/actions/PrintAction.ts b/packages/amis-core/src/actions/PrintAction.ts index eb76da46c..d130c5204 100644 --- a/packages/amis-core/src/actions/PrintAction.ts +++ b/packages/amis-core/src/actions/PrintAction.ts @@ -33,13 +33,7 @@ export class PrintAction implements RendererAction { const targetComponent = event.context.scoped?.getComponentById( action.componentId ); - targetComponent?.doAction( - { - ...action, - target: undefined - }, - renderer - ); + targetComponent?.doAction?.(action, event.data, true, action.args); return; }