update 排序参数修改

This commit is contained in:
赵霄
2023-09-27 14:13:55 +08:00
parent 3262e22947
commit 843dd588d7
+13 -21
View File
@@ -7,6 +7,7 @@ import { ACCESS_TOKEN } from '@/store/mutation-types'
import store from '@/store'
import { isHasPermission } from '../utils/hasPermission.js'
import { FieldType } from '../enums/commonEnums.js'
import { filterObj } from '../utils/util.js'
let importModalLoading
@@ -28,6 +29,11 @@ export const ConfigurableTableMixin = {
showSizeChanger: true,
total: 0
},
/* 排序参数 */
isorter: {
column: 'createTime',
order: 'desc'
},
columns: [],
selectedRowKeys: [],
selectionRows: [],
@@ -165,17 +171,10 @@ export const ConfigurableTableMixin = {
return dimension.width + 40
},
getQueryParams () {
const pageNo = this.ipagination.current
const pageSize = this.ipagination.pageSize
return {
...this.filters,
...this.searchParams,
orderBy: this.orderBy,
orderByField: this.orderByField,
module: this.flag,
pageNo: pageNo,
pageSize: pageSize
}
const param = Object.assign({}, this.queryParam, this.isorter, this.filters)
param.pageNo = this.ipagination.current
param.pageSize = this.ipagination.pageSize
return filterObj(param)
},
loadData (arg) {
if (!this.url.list) {
@@ -205,17 +204,10 @@ export const ConfigurableTableMixin = {
})
},
tableOnChange (pagination, filters, sorter) {
this.orderBy = sorter.order === 'ascend' ? '1' : '2'
let sortFieldName
if (sorter.columnKey && sorter.columnKey.indexOf('_dictText') !== -1) {
sortFieldName = sorter.columnKey.substring(0, sorter.columnKey.indexOf('_dictText'))
} else {
sortFieldName = sorter.columnKey
if (Object.keys(sorter).length > 0) {
this.isorter.column = sorter.field
this.isorter.order = sorter.order === 'ascend' ? 'asc' : 'desc'
}
if (!sorter.order) {
sortFieldName = ''
}
this.orderByField = sortFieldName
this.ipagination = pagination
this.loadData()
},