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