|
@@ -64,6 +64,7 @@ export default {
|
|
|
methods: {
|
|
|
changeHandler(idx) {
|
|
|
this.idx = idx;
|
|
|
+ this.list = toFirst(this.sortData(this.list), this.qx, 'qx')
|
|
|
},
|
|
|
getPercent(bn, tq) {
|
|
|
if (bn - tq === 0) {
|
|
@@ -86,21 +87,44 @@ export default {
|
|
|
return null;
|
|
|
}
|
|
|
},
|
|
|
+ sortData(tempData) {
|
|
|
+ const sub1 = tempData.filter(item => {
|
|
|
+ if (this.idx === 0) {
|
|
|
+ return item.hzIcon === upIcon
|
|
|
+ } else {
|
|
|
+ return item.wrIcon === upIcon
|
|
|
+ }
|
|
|
+ }).sort((a,b) => parseInt(b.hzPercent.replace("%", "")) - parseInt(a.hzPercent.replace("%", "")))
|
|
|
+ const sub2 = tempData.filter(item => {
|
|
|
+ if (this.idx === 0) {
|
|
|
+ return item.hzIcon === null
|
|
|
+ } else {
|
|
|
+ return item.wrIcon === null
|
|
|
+ }
|
|
|
+ })
|
|
|
+ const sub3 = tempData.filter(item => {
|
|
|
+ if (this.idx === 0) {
|
|
|
+ return item.hzIcon === downIcon
|
|
|
+ } else {
|
|
|
+ return item.wrIcon === downIcon
|
|
|
+ }
|
|
|
+ }).sort((a,b) => parseInt(a.hzPercent.replace("%", "")) - parseInt(b.hzPercent.replace("%", "")))
|
|
|
+ return [...sub1, ...sub2, ...sub3]
|
|
|
+ },
|
|
|
loadData() {
|
|
|
this.reload = false
|
|
|
fireDistribution({
|
|
|
pageSize: 100,
|
|
|
pageNum: 1,
|
|
|
- // qx: this.qx
|
|
|
}).then(res => {
|
|
|
let tempData = res.data.rows.map(item => ({...item,
|
|
|
- hzPercent: this.getPercent(item.bnhzqs, item.tqhzqs),
|
|
|
- wrPercent: this.getPercent(item.bnwrs, item.tqwrs),
|
|
|
- hzIcon: this.getIcon(item.bnhzqs, item.tqhzqs),
|
|
|
- wrIcon: this.getIcon(item.bnwrs, item.tqwrs),
|
|
|
+ hzPercent: this.getPercent(item.bnhzqs, item.tqhzqs || 0),
|
|
|
+ wrPercent: this.getPercent(item.bnwrs, item.tqwrs || 0),
|
|
|
+ hzIcon: this.getIcon(item.bnhzqs, item.tqhzqs || 0),
|
|
|
+ wrIcon: this.getIcon(item.bnwrs, item.tqwrs || 0),
|
|
|
isActive: item.qx === this.qx
|
|
|
}))
|
|
|
- this.list = toFirst(tempData, this.qx, 'qx')
|
|
|
+ this.list = toFirst(this.sortData(tempData), this.qx, 'qx')
|
|
|
this.reload = true
|
|
|
})
|
|
|
}
|