拖旺项目:聊城公交辅助决策系统
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
<template>
    <div class="v-center">
        <div class="left-box" v-show="showFlag">
            <div class="small">
                <div class="title-h">
                    <v-title-home :content="title.t1"  :showDateFlag="false" :more-show="false"></v-title-home>
                    <div>
                        <rightTop ref="rightTop"></rightTop>
                    </div>
                </div>
                <div class="title-bg"></div>
 
                <div class="title-h1 mt10">
                    <v-title-home :content="title.t2" :link="title.link2" :more-show="true" @choseDate="choseDate2"></v-title-home>
 
                    <div class="flex color-white ju-c">
                        <div>单位:{{ operateUnit }}</div>
                        <div class="flex ml20">
                            <div class="btn-ck" :class="operateIdx == 0 ? 'active' : ''" @click="checkBtn(0, '营运班次')">营运班次</div>
                            <div class="btn-ck" :class="operateIdx == 1 ? 'active' : ''" @click="checkBtn(1, '营运速度')">营运速度</div>
                            <div class="btn-ck" :class="operateIdx == 2 ? 'active' : ''" @click="checkBtn(2, '营运里程')">营运里程</div>
                        </div>
                    </div>
                    <div ref="lines">
                        <Lines :height="lineH" :option="lineOption2" :width="bar5Width" id="line2"></Lines>
                    </div>
                    <div class="title-bg"></div>
                </div>
                <div class="title-h2 mt10">
                    <v-title-home :content="title.t3" :link="title.link3" :more-show="true" @choseDate="choseDate3"></v-title-home>
                    <div class="flex">
                        <div class="img-h" ref="bar5">
                            <pie1 :height="bar5Height" :option="optionArr" :width="bar5Width"></pie1>
                        </div>
                        <div class="ml30">
                            <div class="flex item-sa" v-for="(item,index) in opdata" :key="index">
                                <div class="ts-size" :class="'py_'+ index"></div>
                                <div class="ml10 tlse">{{item.name}}</div>
                                <div class="digi col-py fz18 ml40">{{getGL(item.sun)}}</div>
                                <div class="ml35"><span class="digi col-py fz18 mr10">{{item.sun}}</span>起</div>
                            </div>
                        </div>
                    </div>
                    <div class="title-bg"></div>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
    import rightTop from "./../components/rightTop"
    import Lines from "./../components/echart/line"
    import Bar5 from "./../components/echart/bar5"
    import pie1 from "./../components/echart/pie1"
    import moment from 'moment';
    export default {
        name: 'leftBox',
        data() {
            return {
                title:{
                    t1:'基础资源',
                    t2:'运营数据分析',
                    t3:'服务质量',
                    link1:'operateC',
                    link2:'customer',
                    link3:'customer',
                },
                opdata:[],
                operateUnit: '班',
                operateIdx: 0,
                totalNum: 0,
                showFlag: true,
                id: 'charts',
                companyId: '',
                timeLogo3: 'day',
                timeLogo2: 'day',
                bar5Width: '100%',
                lineH: '19vh',
                bar5Height: '19vh',
                pwidth: '400px',
                optionDate: {},
                options: {
                    legend: ['市民咨询', '有责投诉', '乘客寻物', '有责事故'],
                    xData: [],
                    yData: {
                        accidentNum: [],
                        complainNum: [],
                        counselNum: [],
                        findNum: [],
                        time: [],
                    }
                },
                optionArr: [],
                lineOption2: {
                    title: '',
                    xData: [],
                    legendData: ['营运班次', '营运速度', '营运里程'],
                    unit: '',
                    yData: [],
                },
            }
        },
        methods: {
            init() {
 
                if (this.$store.state.parentCompany) {
                    this.companyId = localStorage.getItem('companyId') || '';
                } else {
                    this.companyId = this.$store.state.companyId
                }
                this.getData2();
                this.getData3();
                this.$refs.rightTop.init();
            },
            getGL(btn){
                if(this.totalNum==0 || btn==0){
                    return '0%'
                }else{
                    let str=Number(btn/this.totalNum*100).toFixed(2);
                    str+="%";
                    return str;
                }
            },
            choseDate2(num){
                let a=['day','week','month']
                this.timeLogo2=a[num];
                this.getData2();
            },
            choseDate3(index){
                let a=['day','week','month']
                this.timeLogo3=a[index];
                this.getData3();
            },
            checkBtn(index, name) {
                this.lineOption2.yData=[];
                this.lineOption2.yData.push({data:this.dataArray[index]})
                this.lineOption2.legendData = [name]
                this.operateIdx = index;
                switch (index) {
                    case 0:
                        this.operateUnit = '班'
                        break;
                    case 1:
                        this.operateUnit = 'km/h'
                        break;
                    case 2:
                        this.operateUnit = 'km'
                        break;
                }
            },
            goPath(path, val) {
                this.$router.push(path)
            },
            getData3(){
                this.$axios.get(`${this.$Interface.securityService}?companyId=${this.companyId}&timeLego=${this.timeLogo3}`).then(res => {
                    this.optionArr=[res.data.counselNum, res.data.advice, res.data.complainNum, res.data.findNum, res.data.praise, res.data.qita,];
                    this.totalNum=res.data.zong;
                    this.opdata=[
                        {name:'市民咨询',sun: res.data.counselNum},
                        {name:'市民建议',sun: res.data.advice},
                        {name:'市民投诉',sun: res.data.complainNum},
                        {name:'失物寻找',sun: res.data.findNum},
                        {name:'感谢',sun: res.data.praise},
                        {name:'其他',sun: res.data.qita},
                    ]
                });
            },
 
            getData2(){
                this.$axios.get(`${this.$Interface.operationalDataAnalysis}?companyId=${this.companyId}&timeLogo=${this.timeLogo2}`).then(_res => {
                    let arr1 = [];
                    let arr2 = [];
                    let arr3 = [];
                    this.dataArray = [];
                    this.lineOption2.yData = [];
                    this.lineOption2.xData = [];
                    if (_res.data && _res.data.length > 0) {
                        _res.data.map(item => {
                            if(this.timeLogo2 == 'day') {
                                this.lineOption2.xData.push(item.time);
                            } else {
                                this.lineOption2.xData.push(moment(item.time).format('MM-DD'));
                            }
                            arr1.push(item.speed);
                            arr2.push(item.shift);
                            arr3.push(this.decimal(item.mileage,2));
                        });
                        this.dataArray=[arr2,arr1,arr3];
                        this.lineOption2.yData = [{data: arr2}];
                    }
                })
            },
        },
        computed: {},
        activated() {
            this.init();
        },
        components: {
            rightTop,
            Lines,
            Bar5,
            pie1,
        }
    }
</script>
<style scoped lang="less">
    .col-py{color: #6BC2FC;}
    .py_0{background:rgba(20,131,242,1)}
    .py_1{background:#02FED3}
    .py_2{background:#F5BD37}
    .py_3{background:#6BC2FC}
    .py_4{background:#C2FC87}
    .py_5{background:#fff}
    .item-sa{height:26px;align-items: center;color:#fff;font-size:12px;}
    .ts-size{width:9px;height:9px;}
    .img-car{width:133px;height:135px;}
    .img-h{width:40%;height:100%;}
    .tlse{width:60px;}
    .left-car-bg{width:112px;height:112px;background: url("../assets/newImg/bg2@2x.png") no-repeat center/cover;}
    .right-car-bg{width:112px;height:112px;background: url("../assets/newImg/bg4@2x.png") no-repeat center/cover;}
    .num-fl{font-family: "Digital";font-size:24px;color:#03F1EC;text-align: center;}
    .btn-ck{width:112px;height:20px;background:url("../assets/newImg/check_echarts.png") no-repeat center/cover;text-align: center;line-height: 20px;font-size:12px;opacity: 0.8}
    .btn-ck.active{
        opacity: 1;
        background-image: url("../assets/newImg/check_echarts_active.png");
    }
    .borderCenter {
        position: relative;
        margin: auto;
        width: 480px;
 
        &::before {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            border: 2px solid gold;
            border-radius: 10px;
            transition: all .5s;
            animation: clippath 3s infinite linear;
        }
    }
 
    @keyframes clippath {
        0%,
        100% {
            clip-path: inset(0 0 95% 0);
        }
 
        25% {
            clip-path: inset(0 95% 0 0);
        }
        50% {
            clip-path: inset(95% 0 0 0);
        }
        75% {
            clip-path: inset(0 0 0 95%);
        }
    }
 
    @keyframes scale {
        0% {
            transform: scale(1);
        }
        25% {
            transform: scale(1.03);
        }
        50% {
            transform: scale(1.06);
        }
        75% {
            transform: scale(1.03);
        }
        100% {
            transform: scale(1);
        }
    }
 
    .bg::before {
        background: rgba(255, 215, 0, .5);
    }
    .t1-box{width:380px;justify-content: space-evenly;margin:15px auto;}
    .data-box-time {
        opacity: 0;
    }
    .time-right {
        right: 20px;
    }
    .title-h {
        height: 26vh;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    .title-h1 {
        height: 29vh;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    .title-h2 {
        height: 28vh;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    .collapse-btn {
        position: absolute;
        z-index: 9999;
        cursor: pointer;
    }
    .collapse-btn:hover {
        background: transparent;
    }
    .el-icon-d-arrow-left, .el-icon-d-arrow-right {
        font-size: 20px;
        color: #d9ebfe;
    }
    .btn-flag {
        color: red;
        background: #999;
        border-radius: 10px;
        height: 40px;
        margin-top: 100px;
        width: 50px;
        text-align: center;
        line-height: 40px;
    }
    .left-box {
        width: 100%;
        background: rgba(3, 11, 22, 0.5);
        height: calc(100% - 120px);
        position: relative;
        top: 60px;
        z-index: 1;
    }
    .small {
        width: calc(100% - 38px);
        margin-left: 18px;
        // height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: space-around;
    }
    .flex {
        display: flex
    }
    .ju-c {
        justify-content: center
    }
    .ju-sb {
        justify-content: space-between;
    }
    .ju-sa {
        justify-content: space-around;
    }
    .flex-y {
        display: flex;
        flex-direction: column;
        justify-content: space-evenly
    }
    .al-end {
        align-items: center;
        flex: 1;
    }
    .max-h {
        height: 100%;
    }
    .center {
        height: 90%;
        width: 100%;
        .items-box {
            height: 25%;
        }
    }
    .box {
        width: 100%;
        height: 100%;
    }
    .al-cen {
        align-items: center;
    }
    .bg-test {
        width: 100%;
        background: url("./../assets/png/test1.jpg") no-repeat center/cover;
    }
    .item1 {
        width: 30%;
        background: url("./../assets/png/test2.jpg") no-repeat center/cover;
    }
    .img-size {
        width: 30px;
    }
    .lv-color {
        color: green;
    }
    .big-fz {
        font-size: 25px;
    }
</style>