拖旺项目:聊城公交辅助决策系统
master
2022-05-05 2bb706cc9371e7cb568193db863477d1271c1cba
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<template>
 <div class="vc-basic-passenger-flow-date-bar">
     <div class="_title-box title-box1">
        <div class="title-name ml20 mr20">{{ $route.query.name }}{{ $route.query.typeName }}客流统计</div>
        <el-date-picker
            v-model="date"
            type="date"
            :clearable="false"
            placeholder="选择日期"
            @change="loadData"
        >
        </el-date-picker>
    </div>
    <div style="height: 32vh">
        <barTop10 v-if="isShow" height="28vh" :option="optiontop_kl" width="100%" id="bar" />
    </div>
    
 </div>
</template>
 
<script>
import moment from "moment";
 import barTop10 from '../../echart/barTop10'
export default {
     name: 'dateBar',
    components: { barTop10 },
    data () {
        return {
            isShow: false,
            optiontop_kl: {
                xData: [],
                legendData: ['客流统计'],
                yData: []
            },
            option: {
                 xAxis: {
                    type: "category",
                    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
                    // 设置横坐标字体颜色
                    axisLine: {
                        lineStyle: {
                            color: "#ccc",
                        },
                    },
                },
                backgroundColor: "transparent", // 设置背景色
                // 设置title 与 表格 距离
                grid: {
                    top: '15%',
                    left: '5%',
                    right: '3%',
                    bottom: '14%',
                },
                yAxis: {
                    type: "value",
                    name: "",
                    nameTextStyle: {
                        color: "#88A7D2",
                    },
                    // 设置纵坐标字体颜色
                    axisLine: {
                        show:true,
                        lineStyle: {
                            color: "#88A7D2",
                        },
                    },
                    // 控制网格
                    splitLine: {
                        show: true,
                        lineStyle: {
                            color: "#222328",
                        },
                    },
                },
                series: [
                    {
                    data: [820, 932, 901, 934, 1290, 1330, 1320],
                    type: 'line',
                    smooth: true
                    }
                ]
            },
            date: moment().format("yyyy-MM-DD"),
        }
    },
    computed: {
    },
    created() {
        
    },
    activated() {
        this.loadData()
    },
    methods: {
        loadData() {
            const { id, typeName, name } = this.$route.query;
            
            let url = '';
            let  params = {}
            if(this.date) {
                params.oneDate = moment(this.date).format("yyyy-MM-DD") || ''
            }
            if(typeName == '站点') {
                url = 'getStationThreePassFlow';
                params.stationId = id;
 
            } else {
                url = 'getLineThreePassFlow';
                params.lineName = name;
            }
            this.$axios.get(this.$Interface.basicResource[url], {
                params,
            }).then((res) => {
                let seriesData = [];
                let data = [];
                this.isShow = true;
                res.data.forEach(e => {
                    let timeArr = e.statDate.split('-');
                    data.push(`${timeArr[1]}.${timeArr[2]}`);
                    seriesData.push(e.sumVolumePeople);
                });
                this.optiontop_kl = {
                    ...this.optiontop_kl,
                    xData: data,
                    yData: [seriesData]
                }
                console.log(this.optiontop_kl, 'this.optiontop_kl');
                
            });
        },
        handleTimeChange(e) {
            if(e[0]) {
                this.filterInfo.startDate = moment(e[0]).format("yyyy-MM-DD");
                this.filterInfo.endDate = moment(e[1]).format("yyyy-MM-DD");
                this.loadData();
            }
            
        },
 
    }
}
</script>
 
<style lang="less">
    .vc-basic-passenger-flow-date-bar {
        margin: 0 72px;
    }
 
</style>