| | |
| | | |
| | | // 饼状图 |
| | | getPieChart().then((response) => { |
| | | if (response.data) { |
| | | |
| | | if (response.data.tjdj.length === 0) { |
| | | this.PieChart = [] |
| | | this.PieChart = [ |
| | | { |
| | | "name": "体检登记人数分布", |
| | | "count": 1, |
| | | "value": 10 |
| | | }, |
| | | |
| | | ] |
| | | } else { |
| | | this.PieChart = response.data.tjdj |
| | | this.PieChart.forEach(item => { |
| | | item.value = item.count |
| | |
| | | this.PieChart.reverse() |
| | | this.PieChart.push(this.PieChart[0]) |
| | | this.PieChart.splice(0, 1) |
| | | this.PieChart2 = response.data.tjyc |
| | | if (this.PieChart2 == 0) { |
| | | this.PieChart2 = [ |
| | | |
| | | |
| | | |
| | | { |
| | | "name": "40-60岁", |
| | | "count": 1, |
| | | "value": 1 |
| | | }, |
| | | { |
| | | "name": "16-40岁", |
| | | "count": 1, |
| | | "value": 1 |
| | | }, |
| | | { |
| | | "name": "3-16岁", |
| | | "count": 1, |
| | | "value": 1 |
| | | }, |
| | | { |
| | | "name": "0-3岁", |
| | | "count": 1, |
| | | "value": 1 |
| | | }, |
| | | { |
| | | "name": "60岁以上", |
| | | "count": 1, |
| | | "value": 1 |
| | | } |
| | | ] |
| | | } |
| | | this.PieChart2.reverse() |
| | | this.PieChart2.push(this.PieChart2[0]) |
| | | this.PieChart2.splice(0, 1) |
| | | this.PieChart2.forEach(item => { |
| | | item.value = item.count |
| | | }) |
| | | // this.TobeToday = response |
| | | |
| | | let myChart2 = this.$echarts.init(document.getElementById('main2')); |
| | | let myChart3 = this.$echarts.init(document.getElementById('main3')); |
| | | myChart2.setOption({ |
| | | title: { |
| | | text: '体检登记人数分布', |
| | | top: '5' |
| | | |
| | | }, |
| | | |
| | | tooltip: { |
| | | trigger: 'item' |
| | | }, |
| | | legend: { |
| | | top: '78%', |
| | | top: '80%', |
| | | left: 'center' |
| | | }, |
| | | series: [ |
| | |
| | | } |
| | | }] |
| | | }) |
| | | |
| | | if (response.data.tjyc.length === 0) { |
| | | this.PieChart2 = [] |
| | | this.PieChart2 = [ |
| | | { |
| | | "name": "体检结果异常人数分布", |
| | | "count": 1, |
| | | "value": 10 |
| | | }, |
| | | |
| | | ] |
| | | } else { |
| | | this.PieChart2 = response.data.tjyc |
| | | this.PieChart2.reverse() |
| | | this.PieChart2.push(this.PieChart2[0]) |
| | | this.PieChart2.splice(0, 1) |
| | | this.PieChart2.forEach(item => { |
| | | item.value = item.count |
| | | }) |
| | | // this.TobeToday = response |
| | | } |
| | | let myChart3 = this.$echarts.init(document.getElementById('main3')); |
| | | |
| | | myChart3.setOption({ |
| | | title: { |
| | | text: '体检结果异常人数分布', |
| | |
| | | trigger: 'item' |
| | | }, |
| | | legend: { |
| | | top: '78%', |
| | | top: '80%', |
| | | left: 'center' |
| | | }, |
| | | series: [ |
| | |
| | | } |
| | | }] |
| | | }) |
| | | } |
| | | |
| | | |
| | | window.onresize = function () { |
| | | myChart2.resize() |
| | | myChart3.resize() |
| | | } |
| | | this.loading = false; |
| | | }); |
| | | |
| | | } |
| | | }, |
| | | |