longyvfengyun
2023-11-15 f7d2d315ac58565cd371d90befc08b7962320b75
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
<script setup>
import {nextTick, onMounted, onUnmounted, ref} from 'vue';
import {BaiduMap, BmInfoWindow, BmLabel, BmMarker} from "vue-baidu-map-3x";
import mapJson from "@/assets/mapJson/map_config";
import {FullScreen} from "@element-plus/icons-vue";
import BoxComponent from "@/components/boxComponent.vue";
import HdwChart from "@/components/echarts/hdwChart.vue";
import getGaugeOption from "@/components/echarts/options/gauge";
import getRadiusBarOption from "@/components/echarts/options/radiusBar";
import getHorizontalTechnologyOption from "@/components/echarts/options/horizontalTechnologyBar";
import carPng from "@/assets/images/car.png";
import ChartBox from "@/components/chartBox.vue";
const isFullScreen = ref(false);
const mapStyle = ref({styleJson: mapJson});
const boxGauge = ref(null);
const boxBar = ref(null);
 
const videoGauge = ref(null);
const videoBar = ref(null);
 
const battGauge = ref(null);
const battBar = ref(null);
 
const alarmBar = ref(null);
const changeScreenState = ()=>{
    isFullScreen.value = !isFullScreen.value;
}
 
import carPosModule from "@/views/moudle/carInfo/carPosModule";
 
const {
    carPosInfo,
    getCarPosList
} = carPosModule();
 
const infoWindowClose = (item) => {
    item.show = false;
};
const infoWindowOpen = (item) => {
    item.show = true
};
 
onMounted(()=>{
    getCarPosList();
 
    const boxGaugeOption = getGaugeOption(10, 90, "今日在线汽车数");
    boxGauge.value.setOption(boxGaugeOption);
 
    const boxBarOption = getRadiusBarOption();
    boxBar.value.setOption(boxBarOption);
 
    const videoGaugeOption = getGaugeOption(1, 500, "今日在线摄像头数");
    videoGauge.value.setOption(videoGaugeOption);
 
    const videoBarOption = getRadiusBarOption();
    videoBar.value.setOption(videoBarOption);
 
    const battGaugeOption = getGaugeOption(1, 500, "今日在线电池数");
    battGauge.value.setOption(videoGaugeOption);
 
    const battBarOption = getRadiusBarOption();
    battBar.value.setOption(videoBarOption);
 
    const alarmBarOption = getHorizontalTechnologyOption();
    alarmBar.value.setOption(alarmBarOption);
});
</script>
 
<template>
    <div class="baidu-map-wrapper" :class="{'full-screen': isFullScreen}">
        <div class="baidu-map-container">
            <div class="baidu-map-header" v-if="isFullScreen">
                <div class="baidu-map-header-wrapper">
                    <div class="baidu-map-header-left"></div>
                    <div class="baidu-map-header-content">
                        动力电池安全检测大数据分析平台
                    </div>
                    <div class="baidu-map-header-right">
                        <el-button type="primary" @click="changeScreenState" :icon="FullScreen" />
                    </div>
                </div>
            </div>
            <div class="baidu-map-content">
<!--                <div class="baidu-map-tools-right" v-if="!isFullScreen">-->
<!--                    <el-button type="primary" @click="changeScreenState" :icon="FullScreen" />-->
<!--                </div>-->
                <div class="baidu-map-float">
                    <div class="box-container">
                        <div class="box-container-top">
                            <box-component>
                                <div class="box-content-inner-wrapper">
                                    <div class="content-inner-header">
                                        <el-row>
                                            <el-col :span="12">
                                                <div class="box-value-wrapper">
                                                    <div class="text-content">今日在线汽车数:</div>
                                                    <div class="text-value">0</div>
                                                </div>
                                                <div class="box-value-wrapper">
                                                    <div class="text-content">汽车总数:</div>
                                                    <div class="text-value">0</div>
                                                </div>
                                            </el-col>
                                            <el-col :span="12">
                                                <div class="hdw-chart-box">
                                                    <hdw-chart ref="boxGauge"></hdw-chart>
                                                </div>
                                            </el-col>
                                        </el-row>
                                    </div>
                                    <div class="content-inner-body">
                                        <chart-box title="最近7天在线汽车数">
                                            <hdw-chart ref="boxBar"></hdw-chart>
                                        </chart-box>
                                    </div>
                                </div>
                            </box-component>
                        </div>
                        <div class="box-container-top">
                            <box-component>
                                <div class="box-content-inner-wrapper">
                                    <div class="content-inner-header">
                                        <el-row>
                                            <el-col :span="12">
                                                <div class="box-value-wrapper">
                                                    <div class="text-content">今日在线摄像头数:</div>
                                                    <div class="text-value">0</div>
                                                </div>
                                                <div class="box-value-wrapper">
                                                    <div class="text-content">摄像头总数:</div>
                                                    <div class="text-value">0</div>
                                                </div>
                                            </el-col>
                                            <el-col :span="12">
                                                <div class="hdw-chart-box">
                                                    <hdw-chart ref="videoGauge"></hdw-chart>
                                                </div>
                                            </el-col>
                                        </el-row>
                                    </div>
                                    <div class="content-inner-body">
                                        <chart-box title="最近7天在线摄像头数">
                                            <hdw-chart ref="videoBar"></hdw-chart>
                                        </chart-box>
                                    </div>
                                </div>
                            </box-component>
                        </div>
                    </div>
                </div>
                <div class="baidu-map-float right">
                    <div class="box-container">
                        <div class="box-container-top">
                            <box-component>
                                <div class="box-content-inner-wrapper">
                                    <div class="content-inner-header">
                                        <el-row>
                                            <el-col :span="12">
                                                <div class="box-value-wrapper">
                                                    <div class="text-content">今日在电池数:</div>
                                                    <div class="text-value">0</div>
                                                </div>
                                                <div class="box-value-wrapper">
                                                    <div class="text-content">电池总数:</div>
                                                    <div class="text-value">0</div>
                                                </div>
                                            </el-col>
                                            <el-col :span="12">
                                                <div class="hdw-chart-box">
                                                    <hdw-chart ref="battGauge"></hdw-chart>
                                                </div>
                                            </el-col>
                                        </el-row>
                                    </div>
                                    <div class="content-inner-body">
                                        <chart-box title="最近7天在线电池数">
                                            <hdw-chart ref="battBar"></hdw-chart>
                                        </chart-box>
                                    </div>
                                </div>
                            </box-component>
                        </div>
                        <div class="box-container-top">
                            <box-component>
                                <hdw-chart ref="alarmBar"></hdw-chart>
                            </box-component>
                        </div>
                    </div>
                </div>
                <baidu-map
                    class="map-container"
                    ak="4GdR40xNyYI2w2XiIgYgS4TdiS3c197C"
                    v="3.0" type="API"
                    :center="{lng: 114.3202, lat: 30.59}" :zoom="15" :scroll-wheel-zoom="true" :mapStyle="mapStyle">
                    <bm-marker
                        v-for="(item, key) in carPosInfo" :key="'key'+key"
                        :position="{lng: item.lon, lat: item.lat}"
                        :dragging="false"
                        @click="infoWindowOpen(item)"
                        :icon="{url: carPng, size: {width: 40, height: 40}}">
<!--                        <bm-info-window-->
<!--                            :show="item.show"-->
<!--                            :offset="{width: 0, height: -15}"-->
<!--                            @close="infoWindowClose(item)"-->
<!--                            @open="infoWindowOpen(item)">-->
<!--                            <div class="info-list">-->
<!--                                <div class="info-item">-->
<!--                                    <div class="info-label">车辆名称:</div>-->
<!--                                    <div class="info-value">{{item.boxName}}</div>-->
<!--                                </div>-->
<!--                                <div class="info-item">-->
<!--                                    <div class="info-label">车辆识别码:</div>-->
<!--                                    <div class="info-value">{{item.boxSn}}</div>-->
<!--                                </div>-->
<!--                                <div class="info-item">-->
<!--                                    <div class="info-label">创建日期:</div>-->
<!--                                    <div class="info-value">{{new Date(item.createTime).format("yyyy-MM-dd hh:mm:ss")}}</div>-->
<!--                                </div>-->
<!--                                <div class="info-item">-->
<!--                                    <div class="info-label">上传日期:</div>-->
<!--                                    <div class="info-value">{{new Date(item.uploadTime).format("yyyy-MM-dd hh:mm:ss")}}</div>-->
<!--                                </div>-->
<!--                                <div class="info-item">-->
<!--                                    <div class="info-label">更新日期:</div>-->
<!--                                    <div class="info-value">{{new Date(item.updateTime).format("yyyy-MM-dd hh:mm:ss")}}</div>-->
<!--                                </div>-->
<!--                            </div>-->
<!--                        </bm-info-window>-->
                        <bm-label :content="item.boxName" :offset="{width: -12, height: 30}"></bm-label>
                    </bm-marker>
                </baidu-map>
            </div>
        </div>
 
    </div>
</template>
 
<style scoped>
.baidu-map-wrapper {
    height: 100%;
    background-color: #091220ff;
    &.full-screen {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }
    .baidu-map-container {
        display: flex;
        height: 100%;
        flex-direction: column;
        .baidu-map-header {
            height: 81px;
            background-image: url("@/assets/images/header_bg.png");
            background-repeat: no-repeat;
            background-size: 100% 100%;
        }
        .baidu-map-content {
            position: relative;
            flex: 1;
            .map-container {
                width: 100%;
                height: 100%;
            }
            .baidu-map-tools-right {
                position: absolute;
                right: 16px;
                top: 16px;
                z-index: 9;
            }
            .baidu-map-float {
                position: absolute;
                top: 0;
                bottom: 0;
                width: 450px;
                height: 100%;
                z-index: 8;
                &.right {
                    right: 0;
                }
            }
        }
    }
}
 
.baidu-map-header-wrapper {
    position: relative;
    .baidu-map-header-content {
        text-align: center;
        font-size: 2rem;
        line-height: 81px;
        font-weight: bold;
        color: #00FEFF;
    }
    .baidu-map-header-right {
        position: absolute;
        top: 1.5rem;
        right: 1rem;
    }
}
 
.box-container {
    display: flex;
    height: 100%;
    flex-direction: column;
    padding: 16px;
    .box-container-top {
        flex: 1;
        padding-bottom: 32px;
    }
}
.box-content-inner-wrapper {
    display: flex;
    height: 100%;
    flex-direction: column;
    .content-inner-body {
        flex: 1;
    }
}
 
.box-value-wrapper {
    margin-bottom: 24px;
    background: linear-gradient(to bottom, #0363f1, #033f8f, #0363f1);
    white-space: nowrap;
    color: #FFFFFF;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 4px;
    vertical-align: middle;
    .text-content {
        display: inline-block;
        vertical-align: middle;
    }
    .text-value {
        display: inline-block;
        margin-left: 8px;
        font-weight: bold;
        text-align: right;
        font-size: 2rem;
        vertical-align: middle;
    }
}
.hdw-chart-box {
    height: 150px;
}
.info-list {
    .info-item {
        padding: 4px 0;
        .info-label {
            display: inline-block;
        }
        .info-value {
            display: inline-block;
        }
    }
}
</style>