+
+
- 板块收入统计
+ 板块收入统计
+
+ {{item.name}}: {{item.total}}
+
- 长护险: 10000
-
-
- 80岁+老人照护: 10000
-
-
- 自营商业: 10000
-
-
- 总计: 30000
+ 总计: {{ total() }}
@@ -32,15 +26,26 @@ require('echarts/theme/macarons') // echarts theme
export default {
+ props:{
+ data:{
+ type:Array,
+ default:()=>[]
+ }
+ },
data() {
return {
chart: null
}
},
- mounted() {
- this.$nextTick(() => {
- this.init()
- })
+ watch:{
+ data:{
+ handler(){
+ this.$nextTick(() => {
+ this.init()
+ })
+ },
+ deep:true
+ }
},
beforeDestroy() {
if (!this.chart) {
@@ -51,6 +56,19 @@ export default {
},
methods: {
init() {
+ let colors = ['#00A82A','#70e1f5','#ffd194','#FF6B6B','#6E48AA','#4B1248']
+ let data = this.data.map((item,index) => {
+ return {
+ value:item.total,
+ name:item.name,
+ itemStyle: {
+ normal: {
+ color: colors[(index+1)%6]
+ },
+ },
+ }
+ })
+
this.chart = echarts.init(document.getElementById('doughnut-chart'))
this.chart.setOption({
tooltip: {
@@ -84,48 +102,22 @@ export default {
labelLine: {
show: false
},
- data: [
- {
- value: 10408,
- name: '长护险',
- itemStyle: {
- normal: {
- color: '#00A82A'
- },
- },
- },
- {
- value: 20000,
- name: '残疾人照护',
- itemStyle: {
- normal: {
- color: '#FF8522'
- },
- },
- },
- {
- value: 9622,
- name: '80岁+老人照护',
- itemStyle: {
- normal: {
- color: '#2B50FF'
- },
- },
- },
- {
- value: 4842,
- name: '自营商业',
- itemStyle: {
- normal: {
- color: '#F2A300'
- },
- },
- },
- ]
+ data
}
]
})
}
+ },
+ computed:{
+ total(){
+ return function (){
+ let total = 0;
+ this.data.forEach(item => {
+ total += item.total
+ })
+ return total
+ }
+ },
}
}
diff --git a/src/views/statistics/people.vue b/src/views/statistics/people.vue
index 0310d13..56b27ed 100644
--- a/src/views/statistics/people.vue
+++ b/src/views/statistics/people.vue
@@ -1,17 +1,61 @@
+
+
+
+
+
+
+
+ 查询
+
+
+
+
+
+
+
+
+
diff --git a/src/views/statistics/peopleComponents/barChart.vue b/src/views/statistics/peopleComponents/barChart.vue
new file mode 100644
index 0000000..b6957bc
--- /dev/null
+++ b/src/views/statistics/peopleComponents/barChart.vue
@@ -0,0 +1,145 @@
+
+
+
+
+ 区域人效统计
+
+
+
+
+
+
+ {{item.value}}: {{item.total.toFixed(2)}}小时/天
+
+
+ 总计: {{total().toFixed(2)}}小时/天
+
+
+
+
+
+
+
+
diff --git a/src/views/statistics/peopleComponents/doughnutChart.vue b/src/views/statistics/peopleComponents/doughnutChart.vue
new file mode 100644
index 0000000..5efce98
--- /dev/null
+++ b/src/views/statistics/peopleComponents/doughnutChart.vue
@@ -0,0 +1,148 @@
+
+
+
+
+ 板块人效统计
+
+
+
+
+
+
+ {{item.name}}: {{item.total.toFixed(2)}}小时/天
+
+
+ 总计: {{ total().toFixed(2) }}小时/天
+
+
+
+
+
+
+
+
+