<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>
|