|
|
|
@ -7,7 +7,7 @@
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
import AMapLoader from '@amap/amap-jsapi-loader';
|
|
|
|
|
import {getCarGpsList, listBasetyre} from '@/api/realTimeMonitoring/vehicleMonitoring'
|
|
|
|
|
import {getCarGpsList, listBasetyre,queryCardata} from '@/api/realTimeMonitoring/vehicleMonitoring'
|
|
|
|
|
import {parseTime} from "@/utils/ruoyi";
|
|
|
|
|
import {onBeforeUnmount} from "@vue/runtime-core";
|
|
|
|
|
|
|
|
|
@ -20,19 +20,26 @@ const treeClick = (data) => {
|
|
|
|
|
if (!data.baseCarList) {
|
|
|
|
|
map.remove(markers.value);
|
|
|
|
|
markers.value = []
|
|
|
|
|
setMarker({id: data.id}, 14)
|
|
|
|
|
setMarker({id: data.id}, 14,false)
|
|
|
|
|
} else {
|
|
|
|
|
map.remove(markers.value);
|
|
|
|
|
markers.value = []
|
|
|
|
|
setMarker({queueId: data.id}, 8)
|
|
|
|
|
setMarker({queueId: data.id}, 8,true)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
window.$tab = proxy.$tab
|
|
|
|
|
const setMarker = async (data, zoom) => {
|
|
|
|
|
const {data: markerArr} = await getCarGpsList(data)
|
|
|
|
|
const setMarker = async (data, zoom,isChildren) => {
|
|
|
|
|
let markerArr = []
|
|
|
|
|
if(isChildren){
|
|
|
|
|
let e= await listBasetyre(data)
|
|
|
|
|
markerArr = e.rows?.[0]?.baseCarList
|
|
|
|
|
} else{
|
|
|
|
|
let e = await queryCardata(data)
|
|
|
|
|
markerArr = [e.data]
|
|
|
|
|
}
|
|
|
|
|
console.log(markerArr)
|
|
|
|
|
markerArr.forEach((e, index) => {
|
|
|
|
|
|
|
|
|
|
// 点标记
|
|
|
|
|
markers.value[index] = new AMap.Marker({
|
|
|
|
|
content: '<div class="markerIcon" />',
|
|
|
|
@ -69,7 +76,7 @@ AMapLoader.load({
|
|
|
|
|
zoom: 8, //初始化地图级别
|
|
|
|
|
center: [116.397428, 39.90923], //初始化地图中心点位置
|
|
|
|
|
});
|
|
|
|
|
await setMarker()
|
|
|
|
|
await setMarker(undefined,undefined,true)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 在图面添加工具条控件,工具条控件集成了缩放、平移、定位等功能按钮在内的组合控件
|
|
|
|
|