mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-09 01:36:57 +08:00
feat: Improve user list sorting
This commit is contained in:
committed by
fit2cloud-chenyw
parent
767d665dd9
commit
ee5e80d35f
@@ -96,6 +96,7 @@
|
||||
:data="state.tableData"
|
||||
style="width: 100%"
|
||||
@selection-change="handleSelectionChange"
|
||||
@sort-change="handleSortChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="name" show-overflow-tooltip :label="$t('user.name')" width="280" />
|
||||
@@ -651,6 +652,8 @@ const state = reactive<any>({
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
total: 0,
|
||||
sortColumn: '',
|
||||
sortOrder: '', // 'ascending' | 'descending' | ''
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1004,6 +1007,11 @@ const configParams = () => {
|
||||
})
|
||||
})
|
||||
|
||||
if (state.pageInfo.sortColumn) {
|
||||
str += str ? `&order_by=${state.pageInfo.sortColumn}` : `order_by=${state.pageInfo.sortColumn}`
|
||||
str += `&desc=${state.pageInfo.sortOrder === 'descending'}`
|
||||
}
|
||||
|
||||
if (str.length) {
|
||||
str = `?${str}`
|
||||
}
|
||||
@@ -1146,6 +1154,12 @@ const handleCurrentChange = (val: number) => {
|
||||
state.pageInfo.currentPage = val
|
||||
search()
|
||||
}
|
||||
const handleSortChange = ({ prop, order }: any) => {
|
||||
state.pageInfo.sortColumn = order ? prop : ''
|
||||
state.pageInfo.sortOrder = order || ''
|
||||
state.pageInfo.currentPage = 1
|
||||
search()
|
||||
}
|
||||
const formatSpaceName = (row_oid_list: Array<any>) => {
|
||||
if (!row_oid_list?.length) {
|
||||
return '-'
|
||||
|
||||
Reference in New Issue
Block a user