表格排序

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