|
@@ -11,6 +11,7 @@
|
|
|
@handle-show-video="handleShowVideo"
|
|
|
@handle-show-warehouse="handleShowWarehouse"
|
|
|
@handle-show-people="handleShowPeople"
|
|
|
+ @handle-show-track="handleShowTrack"
|
|
|
/>
|
|
|
<Map
|
|
|
v-else
|
|
@@ -21,6 +22,7 @@
|
|
|
@handle-show-video="handleShowVideo"
|
|
|
@handle-show-warehouse="handleShowWarehouse"
|
|
|
@handle-show-people="handleShowPeople"
|
|
|
+ @handle-show-track="handleShowTrack"
|
|
|
/>
|
|
|
<!--左侧菜单-->
|
|
|
<LeftMenu
|
|
@@ -62,11 +64,15 @@ import DrawTools from '@/views/globalMap/RightMenu/DrawTools.vue';
|
|
|
import CommunicationSupport from '@/views/globalMap/RightMenu/CommunicationSupport.vue';
|
|
|
import GridPointRainfall from '@/views/globalMap/RightMenu/GridPointRainfall.vue';
|
|
|
import EmergencyCrew from '@/views/globalMap/RightMenu/EmergencyCrew.vue';
|
|
|
+import { getVehicleTrajectory } from '@/api/globalMap/KeyVehicles';
|
|
|
+import { parseTime } from '@/utils/ruoyi';
|
|
|
+import useMapStore from '@/store/modules/map';
|
|
|
|
|
|
const AMapType = ['vectorgraph', 'satellite'];
|
|
|
const YMapType = ['satellite2', 'satellite3', 'imageMap', 'imageMap2'];
|
|
|
const rightMenuRef = ref(null);
|
|
|
const mapData = reactive(logicalData);
|
|
|
+const mapStore = useMapStore();
|
|
|
let map;
|
|
|
let mapRef = ref(null);
|
|
|
let map2Ref = ref(null);
|
|
@@ -119,36 +125,40 @@ const addMarkers = (item) => {
|
|
|
addMarkersMethod();
|
|
|
}
|
|
|
};
|
|
|
+const adjustPoint = (data) => {
|
|
|
+ data.forEach((item2) => {
|
|
|
+ // 获取图标
|
|
|
+ if (iconList[item2.dataType]) {
|
|
|
+ item2.icon = iconList[item2.dataType].image;
|
|
|
+ item2.image = iconList[item2.dataType].image;
|
|
|
+ item2.imageHover = iconList[item2.dataType].imageHover;
|
|
|
+ item2.size = iconList[item2.dataType].size;
|
|
|
+ } else {
|
|
|
+ item2.icon = iconList['common'].image;
|
|
|
+ item2.image = iconList['common'].image;
|
|
|
+ item2.imageHover = iconList['common'].imageHover;
|
|
|
+ item2.size = iconList['common'].size;
|
|
|
+ }
|
|
|
+ if (item2.materia_name) {
|
|
|
+ item2.name = item2.materia_name;
|
|
|
+ }
|
|
|
+ if (item2.dataType === 43) {
|
|
|
+ item2.showName = true;
|
|
|
+ }
|
|
|
+ item2.lnglat = [item2.longitude, item2.latitude];
|
|
|
+ });
|
|
|
+ return data;
|
|
|
+};
|
|
|
+
|
|
|
const addMarkersMethod = () => {
|
|
|
- const dom = ['satellite2', 'satellite3', 'imageMap', 'imageMap2'].includes(activeMap.value) ? map2Ref.value : mapRef.value;
|
|
|
+ const dom = YMapType.includes(activeMap.value) ? map2Ref.value : mapRef.value;
|
|
|
const path = [];
|
|
|
pointType.value.forEach((item) => {
|
|
|
path.push(item.component);
|
|
|
});
|
|
|
getPointInfo(path.toString()).then((res) => {
|
|
|
const data = res.data && res.data.list ? res.data?.list : [];
|
|
|
- markerList.value = data;
|
|
|
- data.forEach((item2) => {
|
|
|
- // 获取图标
|
|
|
- if (iconList[item2.dataType]) {
|
|
|
- item2.icon = iconList[item2.dataType].image;
|
|
|
- item2.image = iconList[item2.dataType].image;
|
|
|
- item2.imageHover = iconList[item2.dataType].imageHover;
|
|
|
- item2.size = iconList[item2.dataType].size;
|
|
|
- } else {
|
|
|
- item2.icon = iconList['common'].image;
|
|
|
- item2.image = iconList['common'].image;
|
|
|
- item2.imageHover = iconList['common'].imageHover;
|
|
|
- item2.size = iconList['common'].size;
|
|
|
- }
|
|
|
- if (item2.materia_name) {
|
|
|
- item2.name = item2.materia_name;
|
|
|
- }
|
|
|
- if (item2.dataType === 43) {
|
|
|
- item2.showName = true;
|
|
|
- }
|
|
|
- item2.lnglat = [item2.longitude, item2.latitude];
|
|
|
- });
|
|
|
+ markerList.value = adjustPoint(data);
|
|
|
dom?.addMarker(data);
|
|
|
});
|
|
|
if (addMarkersTimer) {
|
|
@@ -156,7 +166,7 @@ const addMarkersMethod = () => {
|
|
|
addMarkersTimer = null;
|
|
|
}
|
|
|
if (path.includes('43')) {
|
|
|
- addMarkersTimer = setInterval(addMarkersMethod, 10 * 1000);
|
|
|
+ addMarkersTimer = setInterval(addMarkersMethod, 60 * 1000);
|
|
|
}
|
|
|
};
|
|
|
// 跳转指定地点
|
|
@@ -388,9 +398,35 @@ const handleShowPeople = (data) => {
|
|
|
showPeople.value = true;
|
|
|
};
|
|
|
|
|
|
+watch(
|
|
|
+ () => mapStore.trackState.show,
|
|
|
+ (show) => {
|
|
|
+ if (!!show) {
|
|
|
+ const dom = YMapType.includes(activeMap.value) ? map2Ref.value : mapRef.value;
|
|
|
+ dom?.addMarker(adjustPoint(mapStore.trackState.data));
|
|
|
+ mapStore.trackState.data = [];
|
|
|
+ mapStore.trackState.show = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+);
|
|
|
+const handleShowTrack = (data) => {
|
|
|
+ getVehicleTrajectory(data.id).then((res) => {
|
|
|
+ const trajectory = [];
|
|
|
+ if (res.data && res.data.list) {
|
|
|
+ res.data.list.forEach((item) => {
|
|
|
+ trajectory.push({
|
|
|
+ time: !!item.gpsDate ? parseTime(item.gpsDate, '{h}:{i}') : '',
|
|
|
+ lnglat: [item.lng, item.lat]
|
|
|
+ });
|
|
|
+ });
|
|
|
+ // console.log(data, res.data.list);
|
|
|
+ initDataToPlay({ type: 'track', data: trajectory });
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
// 传递数据给时间轴
|
|
|
const initDataToPlay = (data) => {
|
|
|
- if (!!tempMenu.value) {
|
|
|
+ if (!!timeAxisRef.value) {
|
|
|
timeAxisRef.value.initDataToPlay(data);
|
|
|
}
|
|
|
};
|
|
@@ -406,6 +442,10 @@ onBeforeUnmount(() => {
|
|
|
map.un('click', handleClickMap);
|
|
|
}
|
|
|
}
|
|
|
+ if (!!addMarkersTimer) {
|
|
|
+ clearInterval(addMarkersTimer);
|
|
|
+ addMarkersTimer = null;
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
provide('getMapUtils', getMapUtils);
|