用户管理完成
This commit is contained in:
parent
af6cf056de
commit
99687f9b45
@ -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
|
||||
}));
|
||||
|
||||
@ -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: '状态',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user