From 3920cb20c3e900877f47ad2ab47273f016625a49 Mon Sep 17 00:00:00 2001 From: wjh Date: Fri, 15 Mar 2024 17:53:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=80=9A=E8=BF=87=E5=8C=BA=E5=9D=97?= =?UTF-8?q?=E7=9A=84=E7=B1=BB=E5=9E=8B=E9=85=8D=E7=BD=AE=E5=8A=A8=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../@hera/plugin-rental/src/client/index.tsx | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/packages/plugins/@hera/plugin-rental/src/client/index.tsx b/packages/plugins/@hera/plugin-rental/src/client/index.tsx index 8975fd29a..0c529eb65 100644 --- a/packages/plugins/@hera/plugin-rental/src/client/index.tsx +++ b/packages/plugins/@hera/plugin-rental/src/client/index.tsx @@ -1,4 +1,4 @@ -import { Plugin } from '@nocobase/client'; +import { Plugin, useCollection } from '@nocobase/client'; import { RecordSummary } from './custom-components/RecordSummary'; import { RecordTotalPrice } from './custom-components/RecordTotalPrice'; import { RecordItemWeight } from './custom-components/RecordItemWeight'; @@ -67,11 +67,21 @@ export class PluginRentalClient extends Plugin { type: 'item', title: '{{t("Print(countable)")}}', component: 'PDFViewerCountablePrintActionInitializer', + useVisible() { + const collection = useCollection(); + const name = collection['options']['name']; + return name === 'records'; + }, }); this.app.schemaInitializerManager.addItem('PDFViewActionInitializer', 'enbaleActions.columnSwitch', { type: 'item', title: '{{t("Column switch")}}', component: 'ColumnSwitchActionInitializer', + useVisible() { + const collection = useCollection(); + const name = collection['options']['name']; + return name === 'records'; + }, }); this.app.schemaInitializerManager.addItem('PDFViewActionInitializer', 'enbaleActions.recordPrintSetup', { type: 'item', @@ -82,16 +92,31 @@ export class PluginRentalClient extends Plugin { type: 'item', title: '{{t("Record print margingtop")}}', component: 'RecordPrintSetupMargingTopInitializer', + useVisible() { + const collection = useCollection(); + const name = collection['options']['name']; + return name === 'records' || name === 'waybills'; + }, }); this.app.schemaInitializerManager.addItem('PDFViewActionInitializer', 'enbaleActions.settlementExcelExport', { type: 'item', title: '{{t("Settlement excel export")}}', component: 'SettlementExcelExportActionInitializer', + useVisible() { + const collection = useCollection(); + const name = collection['options']['name']; + return name === 'settlements'; + }, }); this.app.schemaInitializerManager.addItem('PDFViewActionInitializer', 'enbaleActions.settlementStyleSwitch', { type: 'item', title: '{{t("Settlement style switch")}}', component: 'SettlementStyleSwitchActionInitializer', + useVisible() { + const collection = useCollection(); + const name = collection['options']['name']; + return name === 'settlements'; + }, }); this.app.schemaInitializerManager.addItem('RecordBlockInitializers', 'previewBlock.record', { key: 'record',