Your Name
2022-08-26 b1bdac435d4aa9fe34bde1a859490842166b47f7
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
<template>
    <div id="inspectionPerson" style="width:90%;height:360px;margin: 0 auto;">
    </div>
</template>
 
<script>
 
import {getInspectPerson} from "../../../../../../api/inspectStatistics";
 
export default {
    name: "index",
    data(){
        return{
            barData:[],
            myChart:'',
        }
    },
    mounted(){
    },
    methods:{
        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({
                tooltip: {
                    trigger: 'item'
                },
                legend: {
                    left: 'center',
                    top: '84%',
                },
                color:'#fac858',
                xAxis: {
                    type: 'category',
                    data: this.timeData
                },
                yAxis: {
                    type: 'value'
                },
                series: [
                {
                    data: this.numData,
                    type: 'bar',
                    showBackground: true,
                    backgroundStyle: {
                        color: '#5470c6'
                    }
                }]
            })
        },
    }
}
</script>
<style scoped lang="scss">
</style>