居民统计
This commit is contained in:
@@ -45,6 +45,7 @@ export default {
|
|||||||
specialPeople: {},
|
specialPeople: {},
|
||||||
specialFlag: true,
|
specialFlag: true,
|
||||||
ageArray: [],
|
ageArray: [],
|
||||||
|
ageRange: [],
|
||||||
ageFlag: true,
|
ageFlag: true,
|
||||||
sexArray: [],
|
sexArray: [],
|
||||||
sexFlag: true,
|
sexFlag: true,
|
||||||
@@ -65,24 +66,25 @@ export default {
|
|||||||
if(res?.data) {
|
if(res?.data) {
|
||||||
this.data = res.data
|
this.data = res.data
|
||||||
this.specialPeople = res.data.特殊人群
|
this.specialPeople = res.data.特殊人群
|
||||||
let specialArr = Object.values(this.specialPeople)
|
this.$nextTick(()=> {
|
||||||
this.specialFlag = !specialArr.every(e=> e==0)
|
let specialArr = Object.values(this.specialPeople)
|
||||||
|
this.specialFlag = !specialArr.every(e=> e==0)
|
||||||
|
})
|
||||||
this.ageArray = res.data.年龄层次.map(v=> v.v2)
|
this.ageArray = res.data.年龄层次.map(v=> v.v2)
|
||||||
|
this.ageRange = res.data.年龄层次.map(v=> v.v1)
|
||||||
this.ageFlag = !this.ageArray.every(e=> e==0)
|
this.ageFlag = !this.ageArray.every(e=> e==0)
|
||||||
this.sexArray = res.data.男女比例.map(v=> v.v2)
|
this.sexArray = res.data.男女比例.map(v=> v.v2)
|
||||||
this.sexFlag = !this.sexArray.every(e=> e==0)
|
this.sexFlag = !this.sexArray.every(e=> e==0)
|
||||||
this.$nextTick(()=> {
|
this.getSpecialEcharts()
|
||||||
this.getSpecialEcharts()
|
this.getAgeProportion()
|
||||||
this.getAgeEcherts(this.ageArray)
|
this.getAgeEcherts(this.ageArray)
|
||||||
this.getAgeProportion()
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 特殊人群
|
// 特殊人群
|
||||||
getSpecialEcharts() {
|
getSpecialEcharts() {
|
||||||
let specialDom = document.getElementById('specialEcharts');
|
let specialDom = document.getElementById('specialEcharts');
|
||||||
let myChart = echarts.init(specialDom);
|
let mySpecialChart = echarts.init(specialDom);
|
||||||
let option = {
|
let option = {
|
||||||
title: {
|
title: {
|
||||||
zlevel: 0,
|
zlevel: 0,
|
||||||
@@ -142,17 +144,17 @@ export default {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
option && myChart.setOption(option);
|
option && mySpecialChart.setOption(option);
|
||||||
},
|
},
|
||||||
// 年龄分布
|
// 年龄分布
|
||||||
getAgeEcherts(ageArray) {
|
getAgeEcherts(ageArray) {
|
||||||
let ageDom = document.getElementById('ageEcharts');
|
let ageDom = document.getElementById('ageEcharts');
|
||||||
let myChart = echarts.init(ageDom);
|
let myAgeChart = echarts.init(ageDom);
|
||||||
let option;
|
let option;
|
||||||
option = {
|
option = {
|
||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'category',
|
type: 'category',
|
||||||
data: ['10以下', '10-18', '18-65', '65-80', '80以上']
|
data: this.ageRange,
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: "value",
|
type: "value",
|
||||||
@@ -189,7 +191,7 @@ export default {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
option && myChart.setOption(option);
|
option && myAgeChart.setOption(option);
|
||||||
},
|
},
|
||||||
// 男女比例
|
// 男女比例
|
||||||
getAgeProportion() {
|
getAgeProportion() {
|
||||||
|
|||||||
Reference in New Issue
Block a user