diff --git a/frontend/src/hooks/useTableData.ts b/frontend/src/hooks/useTableData.ts index 59721af9..692f3cb8 100644 --- a/frontend/src/hooks/useTableData.ts +++ b/frontend/src/hooks/useTableData.ts @@ -10,7 +10,12 @@ export interface TableService { baseUrl: string; // 基础URL } -export function useTableData({ +interface SortParams { + sortField?: string; + sortOrder?: 'ascend' | 'descend'; +} + +export function useTableData({ service, defaultParams, config = {} @@ -40,10 +45,10 @@ export function useTableData({ setState(prev => ({ ...prev, - list: pageData?.content || [], + list: pageData.content || [], pagination: { ...prev.pagination, - total: pageData?.totalElements || 0 + total: pageData.totalElements || 0 }, loading: false })); diff --git a/frontend/src/pages/System/User/index.tsx b/frontend/src/pages/System/User/index.tsx index 36ea28ac..655d5d79 100644 --- a/frontend/src/pages/System/User/index.tsx +++ b/frontend/src/pages/System/User/index.tsx @@ -113,7 +113,8 @@ const UserPage: React.FC = () => { dataIndex: 'id', key: 'id', width: 60, - fixed: 'left' as FixedType + fixed: 'left' as FixedType, + sorter: true }, { title: '用户名', @@ -162,6 +163,7 @@ const UserPage: React.FC = () => { dataIndex: 'updateTime', key: 'updateTime', width: 150, + sorter: true }, { title: '状态',