|
|
|
@ -7,18 +7,19 @@
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
import AMapLoader from '@amap/amap-jsapi-loader';
|
|
|
|
|
import {getCarGpsList, listBasetyre} from '@/api/realTimeMonitoring/vehicleMonitoring'
|
|
|
|
|
|
|
|
|
|
const treeData = [
|
|
|
|
|
const treeData = ref([
|
|
|
|
|
{
|
|
|
|
|
label: 'Level one 1',
|
|
|
|
|
title: 'Level one 1',
|
|
|
|
|
id: 1,
|
|
|
|
|
children: [
|
|
|
|
|
baseCarList: [
|
|
|
|
|
{
|
|
|
|
|
label: 'Level two 1-1',
|
|
|
|
|
title: 'Level two 1-1',
|
|
|
|
|
id: 11,
|
|
|
|
|
children: [
|
|
|
|
|
baseCarList: [
|
|
|
|
|
{
|
|
|
|
|
label: 'Level three 1-1-1',
|
|
|
|
|
title: 'Level three 1-1-1',
|
|
|
|
|
id: 111,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
@ -26,52 +27,49 @@ const treeData = [
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: 'Level one 2',
|
|
|
|
|
children: [
|
|
|
|
|
title: 'Level one 2',
|
|
|
|
|
baseCarList: [
|
|
|
|
|
{
|
|
|
|
|
label: 'Level two 2-1',
|
|
|
|
|
children: [
|
|
|
|
|
title: 'Level two 2-1',
|
|
|
|
|
baseCarList: [
|
|
|
|
|
{
|
|
|
|
|
label: 'Level three 2-1-1',
|
|
|
|
|
title: 'Level three 2-1-1',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: 'Level two 2-2',
|
|
|
|
|
children: [
|
|
|
|
|
title: 'Level two 2-2',
|
|
|
|
|
baseCarList: [
|
|
|
|
|
{
|
|
|
|
|
label: 'Level three 2-2-1',
|
|
|
|
|
title: 'Level three 2-2-1',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: 'Level one 3',
|
|
|
|
|
children: [
|
|
|
|
|
title: 'Level one 3',
|
|
|
|
|
baseCarList: [
|
|
|
|
|
{
|
|
|
|
|
label: 'Level two 3-1',
|
|
|
|
|
children: [
|
|
|
|
|
title: 'Level two 3-1',
|
|
|
|
|
baseCarList: [
|
|
|
|
|
{
|
|
|
|
|
label: 'Level three 3-1-1',
|
|
|
|
|
title: 'Level three 3-1-1',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: 'Level two 3-2',
|
|
|
|
|
children: [
|
|
|
|
|
title: 'Level two 3-2',
|
|
|
|
|
baseCarList: [
|
|
|
|
|
{
|
|
|
|
|
label: 'Level three 3-2-1',
|
|
|
|
|
title: 'Level three 3-2-1',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
const treeDefaultProps = {
|
|
|
|
|
children: 'children',
|
|
|
|
|
label: 'label',
|
|
|
|
|
}
|
|
|
|
|
])
|
|
|
|
|
const treeDefaultProps = {label: 'title', children: 'baseCarList'}
|
|
|
|
|
const treeClick = (data) => {
|
|
|
|
|
console.log(data)
|
|
|
|
|
}
|
|
|
|
@ -109,18 +107,19 @@ const mockRequest = () => {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const setMarker = async () => {
|
|
|
|
|
const markerArr = await mockRequest()
|
|
|
|
|
const {data: markerArr} = await getCarGpsList()
|
|
|
|
|
console.log(markerArr)
|
|
|
|
|
markerArr.forEach(e => {
|
|
|
|
|
|
|
|
|
|
// 点标记
|
|
|
|
|
let marker = new AMap.Marker({
|
|
|
|
|
content: '<div class="markerIcon" />',
|
|
|
|
|
position: e.location,
|
|
|
|
|
position: [e.longitude, e.latitude],
|
|
|
|
|
anchor: 'bottom-center',
|
|
|
|
|
offset: new AMap.Pixel(0, 0),
|
|
|
|
|
label: {
|
|
|
|
|
direction: 'top',
|
|
|
|
|
content: `<div class='info'>${e.title} - ${e.one}</div><div class='info'>${e.two} ${e.three}</div><div class='info'>${e.four}</div>`, //设置文本标注内容
|
|
|
|
|
content: `<div class='info'>${e.carLicense || ''} - ${e.state === 0? '在线':'离线'}</div><div class='info'>${e.two || ''} ${e.three || ''}</div><div class='info'>${e.four || ''}</div>`, //设置文本标注内容
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -188,6 +187,13 @@ AMapLoader.load({
|
|
|
|
|
console.log(e);
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
listBasetyre().then(e => {
|
|
|
|
|
let res = JSON.stringify(e.rows)
|
|
|
|
|
let newObj = JSON.parse(res.replace(/"carLicense":/g,'"title":'))
|
|
|
|
|
treeData.value = newObj
|
|
|
|
|
console.log(newObj)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
<style>
|
|
|
|
|
.tree {
|
|
|
|
@ -211,6 +217,7 @@ AMapLoader.load({
|
|
|
|
|
background-size: 100% 100%;
|
|
|
|
|
background-image: url("../../../assets/images/trucks.png");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.amap-marker-label {
|
|
|
|
|
top: 0 !important;
|
|
|
|
|
left: 0 !important;
|
|
|
|
|