增加排序参数

This commit is contained in:
dushixiang
2021-03-05 17:33:13 +08:00
parent 0ef8f4276e
commit 1472ec73a7
18 changed files with 206 additions and 29 deletions

View File

@ -281,6 +281,16 @@ class User extends Component {
})
}
handleTableChange = (pagination, filters, sorter) => {
let query = {
...this.state.queryParams,
'order': sorter.order,
'field': sorter.field
}
this.loadTableData(query);
}
render() {
const columns = [{
@ -294,10 +304,12 @@ class User extends Component {
title: '登录账号',
dataIndex: 'username',
key: 'username',
sorter: true,
}, {
title: '用户昵称',
dataIndex: 'nickname',
key: 'nickname',
sorter: true,
}, {
title: '用户类型',
dataIndex: 'type',
@ -350,7 +362,8 @@ class User extends Component {
{dayjs(text).fromNow()}
</Tooltip>
)
}
},
sorter: true,
},
{
title: '操作',
@ -578,6 +591,7 @@ class User extends Component {
showTotal: total => `总计 ${total}`
}}
loading={this.state.loading}
onChange={this.handleTableChange}
/>
{/* 为了屏蔽ant modal 关闭后数据仍然遗留的问题*/}

View File

@ -259,6 +259,16 @@ class UserGroup extends Component {
})
}
handleTableChange = (pagination, filters, sorter) => {
let query = {
...this.state.queryParams,
'order': sorter.order,
'field': sorter.field
}
this.loadTableData(query);
}
render() {
const columns = [{
@ -271,6 +281,7 @@ class UserGroup extends Component {
}, {
title: '名称',
dataIndex: 'name',
sorter: true,
}, {
title: '授权资产',
dataIndex: 'assetCount',
@ -293,7 +304,8 @@ class UserGroup extends Component {
{dayjs(text).fromNow()}
</Tooltip>
)
}
},
sorter: true,
},
{
title: '操作',
@ -422,6 +434,7 @@ class UserGroup extends Component {
showTotal: total => `总计 ${total}`
}}
loading={this.state.loading}
onChange={this.handleTableChange}
/>
{/* 为了屏蔽ant modal 关闭后数据仍然遗留的问题*/}