用户管理完成

This commit is contained in:
戚辰先生 2024-11-30 22:14:11 +08:00
parent af6cf056de
commit 99687f9b45
2 changed files with 11 additions and 4 deletions

View File

@ -10,7 +10,12 @@ export interface TableService<T, P = any> {
baseUrl: string; // 基础URL
}
export function useTableData<T extends { id: number }, P = any>({
interface SortParams {
sortField?: string;
sortOrder?: 'ascend' | 'descend';
}
export function useTableData<T extends { id: number }, P extends SortParams>({
service,
defaultParams,
config = {}
@ -40,10 +45,10 @@ export function useTableData<T extends { id: number }, P = any>({
setState(prev => ({
...prev,
list: pageData?.content || [],
list: pageData.content || [],
pagination: {
...prev.pagination,
total: pageData?.totalElements || 0
total: pageData.totalElements || 0
},
loading: false
}));

View File

@ -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: '状态',