feat: add unused records block
This commit is contained in:
parent
7813ace40c
commit
bc2544ed34
@ -1,6 +1,6 @@
|
||||
import { useRecord } from '@nocobase/client';
|
||||
import React, { createContext, useContext, useState } from 'react';
|
||||
import { SettlementStyleContext } from '../schema-initializer/SettlementStyleSwitchActionInitializer';
|
||||
import { SettlementStyleContext } from '../schema-initializer/actions/SettlementStyleSwitchActionInitializer';
|
||||
|
||||
export const PdfIsDoubleContext = createContext({
|
||||
isDouble: null,
|
||||
|
@ -10,7 +10,7 @@ import { RecordFeeConvertedAmount } from './custom-components/RecordFeeConverted
|
||||
import { ReadFeeConvertedAmount } from './custom-components/RecordFeeConvertedRead';
|
||||
import { RecordDetails } from './custom-components/RecordDetails';
|
||||
import { Locale, tval } from './locale';
|
||||
import { AddToChecklistActionInitializer } from './schema-initializer/AddToChecklistActionInitializer';
|
||||
import { AddToChecklistActionInitializer } from './schema-initializer/actions/AddToChecklistActionInitializer';
|
||||
import { useAddToChecklistActionProps } from './hooks/useAddToChecklistActionProps';
|
||||
import { DetailChecks } from './custom-components/DetailChecks';
|
||||
import {
|
||||
@ -18,7 +18,7 @@ import {
|
||||
PrintCounterAction,
|
||||
PrintCounterProvider,
|
||||
usePDFViewerCountablePrintActionProps,
|
||||
} from './schema-initializer/PDFViewerPrintActionInitializer';
|
||||
} from './schema-initializer/actions/PDFViewerPrintActionInitializer';
|
||||
import {
|
||||
PdfIsDoubleProvider,
|
||||
useRecordPdfPath,
|
||||
@ -26,22 +26,23 @@ import {
|
||||
useWaybillPdfPath,
|
||||
WaybillsProvider,
|
||||
} from './hooks/usePdfPath';
|
||||
import { ColumnSwitchAction, ColumnSwitchActionInitializer } from './schema-initializer/ColumnSwitchActionInitializer';
|
||||
import { ColumnSwitchAction, ColumnSwitchActionInitializer } from './schema-initializer/actions/ColumnSwitchActionInitializer';
|
||||
import {
|
||||
SettlementExcelExportActionInitializer,
|
||||
useSettlementExcelExportActionProps,
|
||||
} from './schema-initializer/SettlementExcelExportActionInitializer';
|
||||
} from './schema-initializer/actions/SettlementExcelExportActionInitializer';
|
||||
import {
|
||||
SettlementStyleProvider,
|
||||
SettlementStyleSwitchAction,
|
||||
SettlementStyleSwitchActionInitializer,
|
||||
useSettlementStyleSwitchActionProps,
|
||||
} from './schema-initializer/SettlementStyleSwitchActionInitializer';
|
||||
import { RecordPrintSetupActionInitializer, PrintSetup } from './schema-initializer/RecordPrintSetupActionInitializer';
|
||||
} from './schema-initializer/actions/SettlementStyleSwitchActionInitializer';
|
||||
import { RecordPrintSetupActionInitializer, PrintSetup } from './schema-initializer/actions/RecordPrintSetupActionInitializer';
|
||||
import {
|
||||
RecordPrintSetupMargingTopInitializer,
|
||||
PrintSetupMargingTop,
|
||||
} from './schema-initializer/RecordPrintSetupMargingTopInitializer';
|
||||
} from './schema-initializer/actions/RecordPrintSetupMargingTopInitializer';
|
||||
import { UnusedRecordsBlockHelper } from './schema-initializer/blocks/UnusedRecordsBlockInitializer';
|
||||
export class PluginRentalClient extends Plugin {
|
||||
locale: Locale;
|
||||
async afterAdd() {}
|
||||
@ -188,6 +189,9 @@ export class PluginRentalClient extends Plugin {
|
||||
useSettlementExcelExportActionProps,
|
||||
useSettlementStyleSwitchActionProps,
|
||||
});
|
||||
|
||||
await new UnusedRecordsBlockHelper(this.app).load();
|
||||
|
||||
// FIXME
|
||||
await this.app.apiClient.resource('link-manage').init({ name: 'DetailCheckPage' });
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { ActionInitializer } from '@nocobase/client';
|
||||
import { tval } from '../locale';
|
||||
import { tval } from '../../locale';
|
||||
|
||||
export const AddToChecklistActionInitializer = (props) => {
|
||||
const schema = {
|
@ -1,7 +1,7 @@
|
||||
import React, { useContext, useEffect, useState } from 'react';
|
||||
import { ActionInitializer, useRequest } from '@nocobase/client';
|
||||
import { Radio } from 'antd';
|
||||
import { PdfIsDoubleContext } from '../hooks/usePdfPath';
|
||||
import { PdfIsDoubleContext } from '../../hooks/usePdfPath';
|
||||
|
||||
export const ColumnSwitchAction = (props) => {
|
||||
const [value, setValue] = useState('0');
|
@ -2,7 +2,7 @@ import React, { useContext, useEffect, useState } from 'react';
|
||||
import { ActionInitializer } from '@nocobase/client';
|
||||
import { Radio, RadioChangeEvent } from 'antd';
|
||||
import { useRequest } from '@nocobase/client';
|
||||
import { PdfIsLoadContext } from '../hooks/usePdfPath';
|
||||
import { PdfIsLoadContext } from '../../hooks/usePdfPath';
|
||||
export const PrintSetup = (props) => {
|
||||
const [value, setValue] = useState('');
|
||||
const settingsData = useRequest<any>({
|
@ -2,7 +2,7 @@ import React, { useContext, useEffect, useState } from 'react';
|
||||
import { ActionInitializer, useAPIClient } from '@nocobase/client';
|
||||
import { Input } from 'antd';
|
||||
import { useRequest } from '@nocobase/client';
|
||||
import { PdfMargingTopContext } from '../hooks/usePdfPath';
|
||||
import { PdfMargingTopContext } from '../../hooks/usePdfPath';
|
||||
import { debounce } from 'lodash';
|
||||
import { useCurrentUserContext } from '@nocobase/client';
|
||||
export const PrintSetupMargingTop = (props) => {
|
@ -1,9 +1,9 @@
|
||||
import ExcelJS from 'exceljs';
|
||||
import { saveAs } from 'file-saver';
|
||||
import * as QRCode from 'qrcode';
|
||||
import { RecordCategory, PromptText, Itemcategory, AddItemsCategory } from '../../utils/constants';
|
||||
import { converDate } from '../../utils/daysUtils';
|
||||
import { formatPercent } from '../../utils/currencyUtils';
|
||||
import { RecordCategory, PromptText, Itemcategory, AddItemsCategory } from '../../../utils/constants';
|
||||
import { converDate } from '../../../utils/daysUtils';
|
||||
import { formatPercent } from '../../../utils/currencyUtils';
|
||||
import { message } from 'antd';
|
||||
|
||||
export const excelDataHandle = (excelData) => {
|
@ -0,0 +1,80 @@
|
||||
import React from 'react';
|
||||
import {
|
||||
Application,
|
||||
SchemaInitializerItem,
|
||||
SchemaSettings,
|
||||
SchemaToolbar,
|
||||
useSchemaInitializer,
|
||||
useSchemaInitializerItem,
|
||||
} from '@nocobase/client';
|
||||
import { useFieldSchema } from '@formily/react';
|
||||
import { ToolOutlined } from '@ant-design/icons';
|
||||
|
||||
export class UnusedRecordsBlockHelper {
|
||||
constructor(private app: Application) {}
|
||||
async load() {
|
||||
this.app.schemaSettingsManager.add(unusedRecordsBlockSettings);
|
||||
this.app.schemaInitializerManager.get('page:addBlock').add('otherBlocks.unusedRecords', {
|
||||
name: 'unusedRecords',
|
||||
title: 'unusedRecords',
|
||||
Component: UnusedRecordsBlockInitializer.displayName,
|
||||
});
|
||||
this.app.addComponents({
|
||||
UnusedRecordsBlock,
|
||||
UnusedRecordsBlockInitializer,
|
||||
UnusedRecordsBlockToolbar,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export const UnusedRecordsBlock: React.FC = () => {
|
||||
return <div>没使用的单号</div>;
|
||||
};
|
||||
|
||||
UnusedRecordsBlock.displayName = 'UnusedRecordsBlock';
|
||||
|
||||
export const UnusedRecordsBlockInitializer: React.FC = () => {
|
||||
const { insert } = useSchemaInitializer();
|
||||
const itemConfig = useSchemaInitializerItem();
|
||||
return (
|
||||
<SchemaInitializerItem
|
||||
{...itemConfig}
|
||||
icon={<ToolOutlined />}
|
||||
onClick={() => {
|
||||
insert({
|
||||
type: 'void',
|
||||
'x-toolbar': 'UnusedRecordsBlockToolbar',
|
||||
'x-settings': 'unusedRecordsBlockSettings',
|
||||
'x-component': 'CardItem',
|
||||
properties: {
|
||||
viewer: {
|
||||
type: 'void',
|
||||
'x-component': 'UnusedRecordsBlock',
|
||||
},
|
||||
},
|
||||
});
|
||||
}}
|
||||
/>
|
||||
);
|
||||
};
|
||||
UnusedRecordsBlockInitializer.displayName = 'UnusedRecordsBlockInitializer';
|
||||
|
||||
export const unusedRecordsBlockSettings = new SchemaSettings({
|
||||
name: 'unusedRecordsBlockSettings',
|
||||
items: [
|
||||
{
|
||||
name: 'remove',
|
||||
type: 'remove',
|
||||
componentProps: {
|
||||
removeParentsIfNoChildren: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const UnusedRecordsBlockToolbar: React.FC = (props) => {
|
||||
const fieldSchema = useFieldSchema();
|
||||
return <SchemaToolbar title={fieldSchema.title} settings={fieldSchema['x-settings']} {...props} />;
|
||||
};
|
||||
|
||||
UnusedRecordsBlockToolbar.displayName = 'UnusedRecordsBlockToolbar';
|
Loading…
Reference in New Issue
Block a user