|
|
@ -7,18 +7,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
<script setup>
|
|
|
|
import AMapLoader from '@amap/amap-jsapi-loader';
|
|
|
|
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,
|
|
|
|
id: 1,
|
|
|
|
children: [
|
|
|
|
baseCarList: [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
label: 'Level two 1-1',
|
|
|
|
title: 'Level two 1-1',
|
|
|
|
id: 11,
|
|
|
|
id: 11,
|
|
|
|
children: [
|
|
|
|
baseCarList: [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
label: 'Level three 1-1-1',
|
|
|
|
title: 'Level three 1-1-1',
|
|
|
|
id: 111,
|
|
|
|
id: 111,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
@ -26,52 +27,49 @@ const treeData = [
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
label: 'Level one 2',
|
|
|
|
title: 'Level one 2',
|
|
|
|
children: [
|
|
|
|
baseCarList: [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
label: 'Level two 2-1',
|
|
|
|
title: 'Level two 2-1',
|
|
|
|
children: [
|
|
|
|
baseCarList: [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
label: 'Level three 2-1-1',
|
|
|
|
title: 'Level three 2-1-1',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
label: 'Level two 2-2',
|
|
|
|
title: 'Level two 2-2',
|
|
|
|
children: [
|
|
|
|
baseCarList: [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
label: 'Level three 2-2-1',
|
|
|
|
title: 'Level three 2-2-1',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
label: 'Level one 3',
|
|
|
|
title: 'Level one 3',
|
|
|
|
children: [
|
|
|
|
baseCarList: [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
label: 'Level two 3-1',
|
|
|
|
title: 'Level two 3-1',
|
|
|
|
children: [
|
|
|
|
baseCarList: [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
label: 'Level three 3-1-1',
|
|
|
|
title: 'Level three 3-1-1',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
label: 'Level two 3-2',
|
|
|
|
title: 'Level two 3-2',
|
|
|
|
children: [
|
|
|
|
baseCarList: [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
label: 'Level three 3-2-1',
|
|
|
|
title: 'Level three 3-2-1',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]
|
|
|
|
])
|
|
|
|
const treeDefaultProps = {
|
|
|
|
const treeDefaultProps = {label: 'title', children: 'baseCarList'}
|
|
|
|
children: 'children',
|
|
|
|
|
|
|
|
label: 'label',
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const treeClick = (data) => {
|
|
|
|
const treeClick = (data) => {
|
|
|
|
console.log(data)
|
|
|
|
console.log(data)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -109,18 +107,19 @@ const mockRequest = () => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const setMarker = async () => {
|
|
|
|
const setMarker = async () => {
|
|
|
|
const markerArr = await mockRequest()
|
|
|
|
const {data: markerArr} = await getCarGpsList()
|
|
|
|
|
|
|
|
console.log(markerArr)
|
|
|
|
markerArr.forEach(e => {
|
|
|
|
markerArr.forEach(e => {
|
|
|
|
|
|
|
|
|
|
|
|
// 点标记
|
|
|
|
// 点标记
|
|
|
|
let marker = new AMap.Marker({
|
|
|
|
let marker = new AMap.Marker({
|
|
|
|
content: '<div class="markerIcon" />',
|
|
|
|
content: '<div class="markerIcon" />',
|
|
|
|
position: e.location,
|
|
|
|
position: [e.longitude, e.latitude],
|
|
|
|
anchor: 'bottom-center',
|
|
|
|
anchor: 'bottom-center',
|
|
|
|
offset: new AMap.Pixel(0, 0),
|
|
|
|
offset: new AMap.Pixel(0, 0),
|
|
|
|
label: {
|
|
|
|
label: {
|
|
|
|
direction: 'top',
|
|
|
|
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);
|
|
|
|
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>
|
|
|
|
</script>
|
|
|
|
<style>
|
|
|
|
<style>
|
|
|
|
.tree {
|
|
|
|
.tree {
|
|
|
@ -211,6 +217,7 @@ AMapLoader.load({
|
|
|
|
background-size: 100% 100%;
|
|
|
|
background-size: 100% 100%;
|
|
|
|
background-image: url("../../../assets/images/trucks.png");
|
|
|
|
background-image: url("../../../assets/images/trucks.png");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.amap-marker-label {
|
|
|
|
.amap-marker-label {
|
|
|
|
top: 0 !important;
|
|
|
|
top: 0 !important;
|
|
|
|
left: 0 !important;
|
|
|
|
left: 0 !important;
|
|
|
|