用户管理完成
This commit is contained in:
parent
af6cf056de
commit
99687f9b45
@ -10,7 +10,12 @@ export interface TableService<T, P = any> {
|
|||||||
baseUrl: string; // 基础URL
|
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,
|
service,
|
||||||
defaultParams,
|
defaultParams,
|
||||||
config = {}
|
config = {}
|
||||||
@ -40,10 +45,10 @@ export function useTableData<T extends { id: number }, P = any>({
|
|||||||
|
|
||||||
setState(prev => ({
|
setState(prev => ({
|
||||||
...prev,
|
...prev,
|
||||||
list: pageData?.content || [],
|
list: pageData.content || [],
|
||||||
pagination: {
|
pagination: {
|
||||||
...prev.pagination,
|
...prev.pagination,
|
||||||
total: pageData?.totalElements || 0
|
total: pageData.totalElements || 0
|
||||||
},
|
},
|
||||||
loading: false
|
loading: false
|
||||||
}));
|
}));
|
||||||
|
|||||||
@ -113,7 +113,8 @@ const UserPage: React.FC = () => {
|
|||||||
dataIndex: 'id',
|
dataIndex: 'id',
|
||||||
key: 'id',
|
key: 'id',
|
||||||
width: 60,
|
width: 60,
|
||||||
fixed: 'left' as FixedType
|
fixed: 'left' as FixedType,
|
||||||
|
sorter: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '用户名',
|
title: '用户名',
|
||||||
@ -162,6 +163,7 @@ const UserPage: React.FC = () => {
|
|||||||
dataIndex: 'updateTime',
|
dataIndex: 'updateTime',
|
||||||
key: 'updateTime',
|
key: 'updateTime',
|
||||||
width: 150,
|
width: 150,
|
||||||
|
sorter: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '状态',
|
title: '状态',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user