优化:完善分类规则与Excel配置维护并加速查询翻页
This commit is contained in:
@@ -39,7 +39,7 @@ export function QualityTable<T extends object>({
|
||||
}: QualityTableProps<T>) {
|
||||
const compact = useContext(CompactManagementTables);
|
||||
const pageConfig = typeof pagination === 'object' && pagination !== null ? pagination : undefined;
|
||||
const [innerPage, setInnerPage] = useState(() => ({ current: pageConfig?.defaultCurrent ?? 1, pageSize: pageConfig?.defaultPageSize ?? 10 }));
|
||||
const [innerPage, setInnerPage] = useState(() => ({ current: pageConfig?.defaultCurrent ?? 1, pageSize: pageConfig?.defaultPageSize ?? 15 }));
|
||||
const pageSize = pageConfig?.pageSize ?? innerPage.pageSize;
|
||||
const total = pageConfig?.total ?? dataSource?.length ?? 0;
|
||||
const page = Math.min(pageConfig?.current ?? innerPage.current, Math.max(1, Math.ceil(total / pageSize)));
|
||||
@@ -66,7 +66,7 @@ export function QualityTable<T extends object>({
|
||||
tableLayout={props.tableLayout ?? (compact ? 'fixed' : undefined)}
|
||||
columns={[indexColumn, ...(compact ? compactColumns(columns ?? []) : columns ?? [])]}
|
||||
dataSource={dataSource}
|
||||
pagination={pagination}
|
||||
pagination={pagination === false ? false : { defaultPageSize: 15, pageSizeOptions: ['15', '30', '50', '100'], ...pageConfig }}
|
||||
onChange={handleChange}
|
||||
size={size}
|
||||
bordered
|
||||
|
||||
Reference in New Issue
Block a user