|
@@ -10,6 +10,7 @@ export default {
|
|
localLoading: false,
|
|
localLoading: false,
|
|
localDataSource: [],
|
|
localDataSource: [],
|
|
localPagination: Object.assign({}, this.pagination),
|
|
localPagination: Object.assign({}, this.pagination),
|
|
|
|
+ sortObj: null,
|
|
isSucceed: true ,// 是否请求成功
|
|
isSucceed: true ,// 是否请求成功
|
|
leftAlignId:"",
|
|
leftAlignId:"",
|
|
}
|
|
}
|
|
@@ -153,6 +154,7 @@ export default {
|
|
this.localLoading = false
|
|
this.localLoading = false
|
|
this.localDataSource = []
|
|
this.localDataSource = []
|
|
this.needTotalList = []
|
|
this.needTotalList = []
|
|
|
|
+ this.sortObj = null
|
|
this.clearSelected()
|
|
this.clearSelected()
|
|
this.localPagination = Object.assign({}, {
|
|
this.localPagination = Object.assign({}, {
|
|
current: 1, pageSize: this.pageSize, total: 0
|
|
current: 1, pageSize: this.pageSize, total: 0
|
|
@@ -166,6 +168,7 @@ export default {
|
|
*/
|
|
*/
|
|
loadData (pagination, filters, sorter) {
|
|
loadData (pagination, filters, sorter) {
|
|
this.localLoading = true
|
|
this.localLoading = true
|
|
|
|
+ console.log(sorter)
|
|
const parameter = Object.assign({
|
|
const parameter = Object.assign({
|
|
pageNo: (pagination && pagination.current) ||
|
|
pageNo: (pagination && pagination.current) ||
|
|
this.showPagination && this.localPagination.current || this.pageNum,
|
|
this.showPagination && this.localPagination.current || this.pageNum,
|
|
@@ -174,16 +177,22 @@ export default {
|
|
tableId: this.tableId,
|
|
tableId: this.tableId,
|
|
index: this.index
|
|
index: this.index
|
|
},
|
|
},
|
|
- (sorter && sorter.field && {
|
|
|
|
|
|
+ (sorter ? sorter.field && {
|
|
sortField: sorter.field
|
|
sortField: sorter.field
|
|
- }) || {},
|
|
|
|
- (sorter && sorter.order && {
|
|
|
|
|
|
+ } : this.sortObj&&{sortField:this.sortObj.field}) || {},
|
|
|
|
+ (sorter ? sorter.order && {
|
|
sortOrder: sorter.order
|
|
sortOrder: sorter.order
|
|
- }) || {}, {
|
|
|
|
|
|
+ } : this.sortObj&&{sortOrder:this.sortObj.order}) || {}, {
|
|
...filters
|
|
...filters
|
|
}
|
|
}
|
|
)
|
|
)
|
|
- // console.log('parameter', parameter)
|
|
|
|
|
|
+ // 缓存排序参数
|
|
|
|
+ if(sorter){
|
|
|
|
+ this.sortObj = {
|
|
|
|
+ field: sorter.field||'',
|
|
|
|
+ order: sorter.order||''
|
|
|
|
+ }
|
|
|
|
+ }
|
|
const result = this.data(parameter)
|
|
const result = this.data(parameter)
|
|
// 对接自己的通用数据接口需要修改下方代码中的 r.pageNo, r.count, r.data
|
|
// 对接自己的通用数据接口需要修改下方代码中的 r.pageNo, r.count, r.data
|
|
// eslint-disable-next-line
|
|
// eslint-disable-next-line
|