|
@@ -376,19 +376,27 @@ var vm = new Vue({
|
|
|
// 设置排序方式
|
|
|
setsortType (data) {
|
|
|
this.sections.areaScatter.sortType = data
|
|
|
- this.sections.areaScatter.setCityList = this.formatterWinData(this.sections.areaScatter.setCityList, data===0?'total':'amount')
|
|
|
+ const type = data===0 ? 'total' : 'amount'
|
|
|
+ // const list = this.setCitySort(this.sections.areaScatter.setCityList, type)
|
|
|
let newArr = []
|
|
|
if(data === 0) {
|
|
|
newArr = this.sections.areaScatter.setCityList.sort((a, b) => b.total - a.total)
|
|
|
} else {
|
|
|
newArr = this.sections.areaScatter.setCityList.sort((a, b) => b.amount - a.amount)
|
|
|
}
|
|
|
+ this.sections.areaScatter.setCityList = this.formatterWinData(newArr, type)
|
|
|
this.sortOptionTitle = this.sortOptionContent[data].text
|
|
|
this.sections.areaScatter.setCityList = newArr
|
|
|
},
|
|
|
cancelSelectArea () {
|
|
|
this.sections.areaScatter.showAreaPopup = false
|
|
|
},
|
|
|
+ // 城市排序
|
|
|
+ setCitySort (list, type) {
|
|
|
+ return list.sort((a, b) => {
|
|
|
+ a[type] - b[type]
|
|
|
+ })
|
|
|
+ },
|
|
|
// 选择省份展示城市分布(单选)
|
|
|
confirmSelectArea (data) {
|
|
|
console.log(data)
|
|
@@ -397,7 +405,13 @@ var vm = new Vue({
|
|
|
if(item.area == data.data[0]) {
|
|
|
this.sections.areaScatter.selectArea = item
|
|
|
const areaSort = this.sections.areaScatter.sortType === 0 ? 'total' : 'amount'
|
|
|
- this.sections.areaScatter.setCityList = this.formatterWinData(item.areaDetails, areaSort)
|
|
|
+ let newArr = []
|
|
|
+ if(this.sections.areaScatter.sortType === 0) {
|
|
|
+ newArr = item.areaDetails.sort((a, b) => b.total - a.total)
|
|
|
+ } else {
|
|
|
+ newArr = item.areaDetails.sort((a, b) => b.amount - a.amount)
|
|
|
+ }
|
|
|
+ this.sections.areaScatter.setCityList = this.formatterWinData(newArr, areaSort)
|
|
|
this.sections.areaScatter.setCityList = this.sections.areaScatter.setCityList.sort((a, b) => b[areaSort] - a[areaSort])
|
|
|
if(this.sections.areaScatter.setCityList.length > 5) {
|
|
|
this.sections.areaScatter.showAreaCityListBtn = true
|
|
@@ -1389,12 +1403,11 @@ var vm = new Vue({
|
|
|
const list = areacitylist
|
|
|
const ZXS = ['北京', '天津', '上海', '重庆', '台湾', '澳门', '香港']
|
|
|
const result = list.reduce((max, item) => {
|
|
|
- const isTianjinIncluded = ZXS.includes(item.area)
|
|
|
- if(!isTianjinIncluded) {
|
|
|
- return item.total > max.total ? item : max
|
|
|
- } else {
|
|
|
- return max
|
|
|
- }
|
|
|
+ const isMaxZXS = ZXS.includes(max.area)
|
|
|
+ const isZXS = ZXS.includes(item.area);
|
|
|
+ const isMaxTotal = item.total > max.total;
|
|
|
+ const isNotZXSMaxTotal = (isMaxTotal && !isZXS) || isMaxZXS;
|
|
|
+ return isNotZXSMaxTotal ? item : max
|
|
|
})
|
|
|
if (result.areaDetails.length > 5) {
|
|
|
this.sections.areaScatter.showAreaCityListBtn = true
|