feat: 操作日志
This commit is contained in:
@@ -1,36 +1,37 @@
|
||||
// components/EnhancedProTable/EnhancedProTable.tsx
|
||||
|
||||
import { PlusOutlined } from '@ant-design/icons';
|
||||
import {
|
||||
type ActionType,
|
||||
type ParamsType,
|
||||
ProColumns,
|
||||
ProTable,
|
||||
TableDropdown,
|
||||
} from '@ant-design/pro-components';
|
||||
import { Button, Space } from 'antd';
|
||||
import React, {
|
||||
useRef,
|
||||
useState,
|
||||
useCallback,
|
||||
useMemo,
|
||||
act,
|
||||
forwardRef,
|
||||
} from "react";
|
||||
import {
|
||||
ProTable,
|
||||
ProColumns,
|
||||
ActionType,
|
||||
TableDropdown,
|
||||
ParamsType,
|
||||
} from "@ant-design/pro-components";
|
||||
import { Button, Space } from "antd";
|
||||
import {
|
||||
EnhancedProTableProps,
|
||||
BaseRecord,
|
||||
TableAction,
|
||||
ToolbarAction,
|
||||
} from "./types";
|
||||
useCallback,
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
} from 'react';
|
||||
import {
|
||||
buildTableDropdownMenuItems,
|
||||
handleTableDropdownSelect,
|
||||
formatPaginationTotal,
|
||||
} from "@/utils/antd/tableHelpers";
|
||||
import { PlusOutlined } from "@ant-design/icons";
|
||||
handleTableDropdownSelect,
|
||||
} from '@/utils/antd/tableHelpers';
|
||||
import {
|
||||
type BaseRecord,
|
||||
type EnhancedProTableProps,
|
||||
TableAction,
|
||||
ToolbarAction,
|
||||
} from './types';
|
||||
|
||||
function EnhancedProTable<T extends BaseRecord, U extends ParamsType = any>(
|
||||
props: EnhancedProTableProps<T, U>,
|
||||
ref: React.Ref<ActionType | undefined> | undefined
|
||||
ref: React.Ref<ActionType | undefined> | undefined,
|
||||
) {
|
||||
const {
|
||||
columns,
|
||||
@@ -87,7 +88,7 @@ function EnhancedProTable<T extends BaseRecord, U extends ParamsType = any>(
|
||||
</Space>
|
||||
);
|
||||
},
|
||||
[showSelection]
|
||||
[showSelection],
|
||||
);
|
||||
|
||||
const toolBarRender = useCallback(
|
||||
@@ -96,7 +97,7 @@ function EnhancedProTable<T extends BaseRecord, U extends ParamsType = any>(
|
||||
rows: {
|
||||
selectedRowKeys?: (string | number)[] | undefined;
|
||||
selectedRows?: T[] | undefined;
|
||||
}
|
||||
},
|
||||
) => {
|
||||
const toolbarElements =
|
||||
toolbarActions?.map((action) => {
|
||||
@@ -125,7 +126,7 @@ function EnhancedProTable<T extends BaseRecord, U extends ParamsType = any>(
|
||||
// ];
|
||||
return toolbarElements;
|
||||
},
|
||||
[toolbarActions]
|
||||
[toolbarActions],
|
||||
);
|
||||
return (
|
||||
<ProTable<T, U>
|
||||
@@ -140,9 +141,9 @@ function EnhancedProTable<T extends BaseRecord, U extends ParamsType = any>(
|
||||
showSorterTooltip
|
||||
tableAlertRender={tableAlertRender}
|
||||
// tableAlertOptionRender={tableAlertOptionRender}
|
||||
scroll={{ x: "max-content" }}
|
||||
scroll={{ x: 'max-content' }}
|
||||
search={{
|
||||
labelWidth: "auto",
|
||||
labelWidth: 'auto',
|
||||
defaultCollapsed: false,
|
||||
...restProps.search,
|
||||
}}
|
||||
@@ -156,6 +157,7 @@ function EnhancedProTable<T extends BaseRecord, U extends ParamsType = any>(
|
||||
pagination={{
|
||||
showSizeChanger: true,
|
||||
showQuickJumper: true,
|
||||
pageSize: 10,
|
||||
showTotal: formatPaginationTotal,
|
||||
...restProps.pagination,
|
||||
}}
|
||||
@@ -165,7 +167,7 @@ function EnhancedProTable<T extends BaseRecord, U extends ParamsType = any>(
|
||||
|
||||
export default forwardRef(EnhancedProTable) as <
|
||||
T extends BaseRecord,
|
||||
U extends ParamsType = any
|
||||
U extends ParamsType = any,
|
||||
>(
|
||||
props: EnhancedProTableProps<T, U> & { ref?: React.Ref<ActionType> }
|
||||
props: EnhancedProTableProps<T, U> & { ref?: React.Ref<ActionType> },
|
||||
) => React.ReactElement;
|
||||
|
||||
Reference in New Issue
Block a user