Your Name
2022-09-16 d4c8e63d9f4b111d97879b52f327535ef41c5cae
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<template>
    <div id="todayUnusual" style="width:90%;height:380px;margin: 0 auto;">
    </div>
</template>
 
<script>
 
import {getInspectPerson, getInspectTask} from "../../../../../../api/inspectStatistics";
 
export default {
    name: 'index',
    data(){
        return{
            claimedData:[],
            timeData:[],
            completedData:[],
            uncompletedData:[],
        }
    },
    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({
                tooltip: {
                    trigger: 'item'
                },
                legend: {
                    left: 'center',
                    top: '5%',
                    data:['任务数量','已完成','未完成']
                },
                xAxis: {
                    type: 'category',
                    data: this.timeData
                },
                color:['#0180ff','#91cc75','#ee6666',],
                yAxis: {
                    type: 'value'
                },
                series: [
                    {
                        data: this.claimedData,
                        type: 'bar',
                        name:'任务数量',
                        showBackground: true,
                        backgroundStyle: {
                            color: '#91cc75'
                        }
                    },
                    {
                        data: this.completedData,
                        type: 'bar',
                        name:'已完成',
                        showBackground: true,
                        backgroundStyle: {
                            color: '#fac858'
                        }
                    },
                    {
                        data: this.uncompletedData,
                        type: 'bar',
                        name:'未完成',
                        showBackground: true,
                        backgroundStyle: {
                            color: '#ee6666'
                        }
                    },
                    ]
            })
        }
    }
}
</script>
 
<style scoped>
 
</style>