feat: table list sorter

This commit is contained in:
jialin
2025-12-21 21:37:05 +08:00
parent 6738dfe0d3
commit 23a761226a
25 changed files with 417 additions and 138 deletions
+6 -2
View File
@@ -2,6 +2,7 @@ import DeleteModal from '@/components/delete-modal';
import IconFont from '@/components/icon-font';
import { FilterBar } from '@/components/page-tools';
import { PageAction } from '@/config';
import { TABLE_SORT_DIRECTIONS } from '@/config/settings';
import type { PageActionType } from '@/config/types';
import useTableFetch from '@/hooks/use-table-fetch';
import { useIntl, useModel } from '@umijs/max';
@@ -38,7 +39,10 @@ const Users: React.FC = () => {
} = useTableFetch<ListItem>({
fetchAPI: queryUsersList,
deleteAPI: deleteUser,
contentForDelete: 'users.table.user'
contentForDelete: 'users.table.user',
defaultQueryParams: {
sort_by: '-created_at'
}
});
const { initialState } = useModel('@@initialState') || {};
@@ -188,7 +192,7 @@ const Users: React.FC = () => {
dataSource={dataList}
rowSelection={rowSelection}
loading={dataSource.loading}
sortDirections={['ascend', 'descend', 'ascend']}
sortDirections={TABLE_SORT_DIRECTIONS}
rowKey="id"
onChange={handleTableChange}
pagination={{