表格排序

This commit is contained in:
shijingjing
2022-08-15 14:41:16 +08:00
parent 3fb0b4bec0
commit ad3e7b5f7e

View File

@@ -119,7 +119,9 @@ export default {
value: 'id',
checkStrictly: true,
},
chooseUserList: []
chooseUserList: [],
sortFiled: '',
sortRule: ''
}
},
created() {
@@ -155,7 +157,8 @@ export default {
...this.page,
...this.search,
current: this.current,
sortFiled: this.sortFiled,
sortRule: this.sortRule
}
}).then(res => {
if(res?.data) {
@@ -166,16 +169,12 @@ export default {
},
selectPerson(val) {
this.personList = val
this.form.ids = [...this.personList.map(e => e.id)]
// .concat(this.chooseUserList.map(v=>v.id))
// if (val) {
// this.form.residentId = val.id
// this.personList = [{...val}]
// } else {
// this.form.residentId = ""
// this.personList = []
// }
if (val) {
this.personList = val
this.form.ids = [...this.personList.map(e => e.id)]
} else {
this.form.ids = this.chooseUserList.map(e => e.id)
}
},
changeIntegral(row,type) {
console.log(row);
@@ -186,7 +185,7 @@ export default {
id: row.id,
name: row.userName
}]
// this.personList = this.chooseUserList.map(e => e.id)
this.form.ids = this.chooseUserList.map(e => e.id)
this.dialog = true
}
},
@@ -226,21 +225,42 @@ export default {
},
changeTableSort(col) {
console.log(col);
// console.log(col);
if(col.prop === 'integral') { // 剩余积分
// col.order === 'ascending' &&
// col.order === 'descending' &&
// col.order === null &&
if(col.order === 'ascending') {
this.sortFiled = 0
this.sortRule = true
} else if(col.order === 'descending') {
this.sortFiled = 0
this.sortRule = false
} else if(col.order === null) {
this.sortFiled = ''
this.sortRule = ''
}
} else if(col.prop === 'totalIntegral') { // 累计积分
// col.order === 'ascending' &&
// col.order === 'descending' &&
// col.order === null &&
if(col.order === 'ascending') {
this.sortFiled = 1
this.sortRule = true
} else if(col.order === 'descending') {
this.sortFiled = 1
this.sortRule = false
} else if(col.order === null) {
this.sortFiled = ''
this.sortRule = ''
}
} else if(col.prop === 'usedIntegral') { // 已用积分
// col.order === 'ascending' &&
// col.order === 'descending' &&
// col.order === null &&
if(col.order === 'ascending') {
this.sortFiled = 2
this.sortRule = true
} else if(col.order === 'descending') {
this.sortFiled = 2
this.sortRule = false
} else if(col.order === null) {
this.sortFiled = ''
this.sortRule = ''
}
}
// this.getTableData()
this.getTableData()
},
onConfirm() {