居民统计

This commit is contained in:
shijingjing
2022-12-30 15:56:47 +08:00
parent 407cdff82b
commit f81ac447f6

View File

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