From d4c8e63d9f4b111d97879b52f327535ef41c5cae Mon Sep 17 00:00:00 2001
From: Your Name <123456>
Date: 星期五, 16 九月 2022 16:28:29 +0800
Subject: [PATCH]  修改

---
 src/views/doublePreventAction/hiddenDanger/inspectionStatistics/components/todayUnusual/index.vue |   94 +++++++++++++++++++++++++++++++---------------
 1 files changed, 63 insertions(+), 31 deletions(-)

diff --git a/src/views/doublePreventAction/hiddenDanger/inspectionStatistics/components/todayUnusual/index.vue b/src/views/doublePreventAction/hiddenDanger/inspectionStatistics/components/todayUnusual/index.vue
index 1793ff9..77f7d80 100644
--- a/src/views/doublePreventAction/hiddenDanger/inspectionStatistics/components/todayUnusual/index.vue
+++ b/src/views/doublePreventAction/hiddenDanger/inspectionStatistics/components/todayUnusual/index.vue
@@ -5,18 +5,44 @@
 
 <script>
 
+import {getInspectPerson, getInspectTask} from "../../../../../../api/inspectStatistics";
+
 export default {
     name: 'index',
     data(){
         return{
-            numData:[],
+            claimedData:[],
             timeData:[],
+            completedData:[],
+            uncompletedData:[],
         }
     },
-    mounted() {
-        this.drawTodayLine()
-    },
     methods:{
+        async updateData(val) {
+            debugger
+            let res = await getInspectTask(val)
+            if(res.data.code === '200'){
+                debugger
+                this.claimedData = res.data.data.claimed.map(item =>{
+                    return item.num
+                })
+                this.completedData = res.data.data.completed.map(item =>{
+                    return item.num
+                })
+                this.uncompletedData = res.data.data.uncompleted.map(item =>{
+                    return item.num
+                })
+                this.timeData = res.data.data.claimed.map(item =>{
+                    return item.taskDate
+                })
+            }else{
+                this.$message({
+                    type:'warning',
+                    message:res.data.message
+                })
+            }
+            await this.drawTodayLine()
+        },
         async drawTodayLine(){
             this.myChart = this.$echarts.init(document.getElementById('todayUnusual'))
             this.myChart.setOption({
@@ -24,41 +50,47 @@
                     trigger: 'item'
                 },
                 legend: {
+                    left: 'center',
                     top: '5%',
-                    left: 'center'
+                    data:['任务数量','已完成','未完成']
+                },
+                xAxis: {
+                    type: 'category',
+                    data: this.timeData
+                },
+                color:['#0180ff','#91cc75','#ee6666',],
+                yAxis: {
+                    type: 'value'
                 },
                 series: [
                     {
-                    name: 'Access From',
-                    type: 'pie',
-                    radius: ['40%', '70%'],
-                    avoidLabelOverlap: false,
-                    itemStyle: {
-                        borderRadius: 10,
-                        borderColor: '#fff',
-                        borderWidth: 2
-                    },
-                    label: {
-                        show: false,
-                        position: 'center'
-                    },
-                    emphasis: {
-                        label: {
-                        show: true,
-                        fontSize: '40',
-                        fontWeight: 'bold'
+                        data: this.claimedData,
+                        type: 'bar',
+                        name:'任务数量',
+                        showBackground: true,
+                        backgroundStyle: {
+                            color: '#91cc75'
                         }
                     },
-                    color:['#91cc75','#ee6666','#73c0de','#3ba272','#fc8452','#9a60b4'],
-                    labelLine: {
-                        show: false
+                    {
+                        data: this.completedData,
+                        type: 'bar',
+                        name:'已完成',
+                        showBackground: true,
+                        backgroundStyle: {
+                            color: '#fac858'
+                        }
                     },
-                    data: [
-                        { value: 1048, name: '今日完成' },
-                        { value: 735, name: '今日异常' },
+                    {
+                        data: this.uncompletedData,
+                        type: 'bar',
+                        name:'未完成',
+                        showBackground: true,
+                        backgroundStyle: {
+                            color: '#ee6666'
+                        }
+                    },
                     ]
-                    }
-                ]
             })
         }
     }

--
Gitblit v1.9.2