From b1bdac435d4aa9fe34bde1a859490842166b47f7 Mon Sep 17 00:00:00 2001 From: Your Name <123456> Date: 星期五, 26 八月 2022 17:30:48 +0800 Subject: [PATCH] statistics --- src/views/doublePreventAction/hiddenDanger/inspectionStatistics/components/inspectionPerson/index.vue | 32 +++++++++++++++++++++----------- 1 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/views/doublePreventAction/hiddenDanger/inspectionStatistics/components/inspectionPerson/index.vue b/src/views/doublePreventAction/hiddenDanger/inspectionStatistics/components/inspectionPerson/index.vue index ab266c5..439da18 100644 --- a/src/views/doublePreventAction/hiddenDanger/inspectionStatistics/components/inspectionPerson/index.vue +++ b/src/views/doublePreventAction/hiddenDanger/inspectionStatistics/components/inspectionPerson/index.vue @@ -5,6 +5,8 @@ <script> +import {getInspectPerson} from "../../../../../../api/inspectStatistics"; + export default { name: "index", data(){ @@ -14,17 +16,25 @@ } }, mounted(){ - this.drawLine() }, methods:{ - // setCount(val){ - // this.numData = val.map(item =>{ - // return item.num - // }) - // this.timeData = val.map(item =>{ - // return item.errorTaskIdList - // }) - // }, + async updateData(val){ + let res = await getInspectPerson(val) + if(res.data.code === '200'){ + this.numData = res.data.data.map(item =>{ + return item.num + }) + this.timeData = res.data.data.map(item =>{ + return item.taskDate + }) + }else{ + this.$message({ + type:'warning', + message:res.data.message + }) + } + this.drawLine() + }, async drawLine(){ this.myChart = this.$echarts.init(document.getElementById('inspectionPerson')) this.myChart.setOption({ @@ -38,14 +48,14 @@ color:'#fac858', xAxis: { type: 'category', - data: ['2022-4-1', '2022-4-2', '2022-4-4', '2022-4-4', '2022-4-5', '2022-4-6', '2022-4-7'] + data: this.timeData }, yAxis: { type: 'value' }, series: [ { - data: [120, 200, 150, 80, 70, 110, 130], + data: this.numData, type: 'bar', showBackground: true, backgroundStyle: { -- Gitblit v1.9.2