|
@@ -10,7 +10,7 @@
|
|
|
@handle-show-track="handleShowTrack"
|
|
|
/>
|
|
|
<YztMap
|
|
|
- v-else
|
|
|
+ v-else-if="!!mapStore.activeMap"
|
|
|
ref="map2Ref"
|
|
|
@handle-show-video="handleShowVideo"
|
|
|
@handle-show-warehouse="handleShowWarehouse"
|
|
@@ -43,7 +43,7 @@
|
|
|
<!--通讯保障-->
|
|
|
<CommunicationSupport v-if="communicationSupport.show" @close="handleHideCommunicationSupport" />
|
|
|
<!--应急人员详情-->
|
|
|
- <EmergencyCrew v-if="showPeople" v-model="showPeople" :id="teamId" />
|
|
|
+ <EmergencyCrew v-if="showPeople" :id="teamId" v-model="showPeople" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -61,12 +61,12 @@ import CommunicationSupport from './RightMenu/CommunicationSupport.vue';
|
|
|
import GridPointRainfall from './RightMenu/GridPointRainfall.vue';
|
|
|
import EmergencyCrew from './RightMenu/EmergencyCrew.vue';
|
|
|
import useMapStore from '@/store/modules/map';
|
|
|
-import { getPointInfo } from '@/api/globalMap';
|
|
|
import { getVehicleTrajectory } from '@/api/globalMap/KeyVehicles';
|
|
|
import { iconList } from './data/mapData';
|
|
|
-import { deepClone } from '@/utils';
|
|
|
+import { debounce, deepClone } from '@/utils';
|
|
|
import { parseTime } from '@/utils/ruoyi';
|
|
|
-import { getLocationVideos } from '@/api/videoMonitor';
|
|
|
+import { getPointInfo2 } from '@/api/videoMonitor';
|
|
|
+import { toLonLat } from 'ol/proj';
|
|
|
|
|
|
//dom元素
|
|
|
const rightMenuRef = ref(null);
|
|
@@ -89,7 +89,6 @@ const communicationSupport = reactive({
|
|
|
show: false,
|
|
|
data: {}
|
|
|
});
|
|
|
-let markerList = ref([]);
|
|
|
let addMarkersTimer;
|
|
|
// 添加打点
|
|
|
const addMarkers = (item) => {
|
|
@@ -100,16 +99,12 @@ const addMarkers = (item) => {
|
|
|
if (index > -1) {
|
|
|
mapStore.pointType.splice(index, 1);
|
|
|
}
|
|
|
- if (mapStore.pointType && mapStore.pointType.length === 0) {
|
|
|
- dom.clearMarker('point');
|
|
|
- return;
|
|
|
- }
|
|
|
} else {
|
|
|
// 右侧图层分析状态
|
|
|
item.checked2 = true;
|
|
|
mapStore.pointType.push(item);
|
|
|
}
|
|
|
- addMarkersMethod();
|
|
|
+ mapStore.setPointOption();
|
|
|
}
|
|
|
};
|
|
|
const adjustPoint = (data) => {
|
|
@@ -137,25 +132,66 @@ const adjustPoint = (data) => {
|
|
|
return data;
|
|
|
};
|
|
|
|
|
|
-const addMarkersMethod = () => {
|
|
|
- const dom = mapStore.isAMap ? mapRef.value : map2Ref.value;
|
|
|
- const path = [];
|
|
|
- mapStore.pointType.forEach((item) => {
|
|
|
- path.push(item.component);
|
|
|
- });
|
|
|
- getPointInfo(path.toString()).then((res) => {
|
|
|
- const data = res.data && res.data.list ? res.data?.list : [];
|
|
|
- markerList.value = adjustPoint(data);
|
|
|
- dom?.addMarker(data);
|
|
|
- });
|
|
|
- if (!path.includes('43') && addMarkersTimer) {
|
|
|
- clearInterval(addMarkersTimer);
|
|
|
- addMarkersTimer = null;
|
|
|
- }
|
|
|
- if (path.includes('43')) {
|
|
|
- addMarkersTimer = setInterval(addMarkersMethod, 60 * 1000);
|
|
|
- }
|
|
|
-};
|
|
|
+const addMarkersMethod = debounce(
|
|
|
+ function () {
|
|
|
+ if (!mapUtils || Object.keys(mapUtils).length === 0) return;
|
|
|
+ const queryParams: PointParams = {
|
|
|
+ zoom_level: mapStore.mapState.zoom,
|
|
|
+ latitude_min: '',
|
|
|
+ latitude_max: '',
|
|
|
+ longitude_min: '',
|
|
|
+ longitude_max: '',
|
|
|
+ // option: '22',
|
|
|
+ option: mapStore.pointParams.option,
|
|
|
+ // dict_value: 'slfh'
|
|
|
+ dict_value: mapStore.pointParams.dict_value.toString()
|
|
|
+ };
|
|
|
+ if (!queryParams.option && !queryParams.dict_value) {
|
|
|
+ return mapUtils.clearMarker2();
|
|
|
+ }
|
|
|
+ if (mapStore.isAMap) {
|
|
|
+ const AMap = mapUtils.getAMap();
|
|
|
+ const pixel = new AMap.Pixel(0, 0);
|
|
|
+ const size = mapRef.value.getMapDomSize();
|
|
|
+ const pixel2 = new AMap.Pixel(size[0], size[1]);
|
|
|
+ const lnglat = map.containerToLngLat(pixel);
|
|
|
+ const lnglat2 = map.containerToLngLat(pixel2);
|
|
|
+ queryParams.longitude_min = lnglat.lng;
|
|
|
+ queryParams.latitude_max = lnglat.lat;
|
|
|
+ queryParams.longitude_max = lnglat2.lng;
|
|
|
+ queryParams.latitude_min = lnglat2.lat;
|
|
|
+ } else {
|
|
|
+ // 获取地图容器尺寸
|
|
|
+ const size = map.getSize();
|
|
|
+ // 获取左上角和右下角像素坐标
|
|
|
+ const topLeftPixel = [0, 0];
|
|
|
+ const bottomRightPixel = [size[0], size[1]];
|
|
|
+ // 转换为地图投影坐标
|
|
|
+ const topLeftMap = map.getCoordinateFromPixel(topLeftPixel);
|
|
|
+ const bottomRightMap = map.getCoordinateFromPixel(bottomRightPixel);
|
|
|
+ // 转换为经纬度
|
|
|
+ const lnglat = toLonLat(topLeftMap, map.getView().getProjection());
|
|
|
+ const lnglat2 = toLonLat(bottomRightMap, map.getView().getProjection());
|
|
|
+ queryParams.longitude_min = lnglat[0];
|
|
|
+ queryParams.latitude_max = lnglat[1];
|
|
|
+ queryParams.longitude_max = lnglat2[0];
|
|
|
+ queryParams.latitude_min = lnglat2[1];
|
|
|
+ }
|
|
|
+ getPointInfo2(queryParams).then((res) => {
|
|
|
+ const data = res.data ? res.data : [];
|
|
|
+ mapUtils.addMarker2(data);
|
|
|
+ });
|
|
|
+ if (!mapStore.pointParams.option.includes('43') && addMarkersTimer) {
|
|
|
+ clearInterval(addMarkersTimer);
|
|
|
+ addMarkersTimer = null;
|
|
|
+ }
|
|
|
+ if (mapStore.pointParams.option.includes('43')) {
|
|
|
+ addMarkersTimer = setInterval(addMarkersMethod, 60 * 1000);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 300,
|
|
|
+ false
|
|
|
+);
|
|
|
// 跳转指定地点
|
|
|
const toAddress = (item) => {
|
|
|
const dom = mapStore.activeMap === 'imageMap' ? map2Ref.value : mapRef.value;
|
|
@@ -274,9 +310,7 @@ const getDrawTool = () => {
|
|
|
};
|
|
|
const getPlaceSearch = () => {
|
|
|
const domRef = mapStore.isAMap ? mapRef.value : map2Ref.value;
|
|
|
- if (!!domRef) {
|
|
|
- domRef.getPlaceSearch();
|
|
|
- }
|
|
|
+ return !!domRef ? domRef.getPlaceSearch() : {};
|
|
|
};
|
|
|
const trackPlayback = (data) => {
|
|
|
const domRef = mapStore.isAMap ? mapRef.value : mapUtils;
|
|
@@ -396,13 +430,19 @@ const initDataToPlay = (data) => {
|
|
|
timeAxisRef.value.initDataToPlay(data);
|
|
|
}
|
|
|
};
|
|
|
-
|
|
|
+const mapMoveEnd = () => {
|
|
|
+ if (!mapStore.pointParams.dict_value && !mapStore.pointParams.option) return;
|
|
|
+ addMarkersMethod();
|
|
|
+};
|
|
|
watch(
|
|
|
() => mapStore.mapLoaded,
|
|
|
(loaded) => {
|
|
|
if (loaded) {
|
|
|
map = getMap();
|
|
|
mapUtils = getMapUtils();
|
|
|
+ if (!!map && Object.keys(map).length !== 0) {
|
|
|
+ map.on('moveend', mapMoveEnd);
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
{
|
|
@@ -411,34 +451,19 @@ watch(
|
|
|
);
|
|
|
// 监听视频打点
|
|
|
watch(
|
|
|
- () => mapStore.videoPointParams,
|
|
|
+ () => mapStore.pointParams,
|
|
|
() => {
|
|
|
- if (!mapStore.videoPointParams.flag) return;
|
|
|
- const queryParams = {
|
|
|
- zoom_level: mapStore.mapState.zoom,
|
|
|
- // zoom_level: 8,
|
|
|
- latitude_min: '',
|
|
|
- latitude_max: '',
|
|
|
- longitude_min: '',
|
|
|
- longitude_max: '',
|
|
|
- dict_value: 'slfh'
|
|
|
- // dict_value: mapStore.videoPointParams.dict_value
|
|
|
- };
|
|
|
- if (mapStore.isAMap) {
|
|
|
- const AMap = mapUtils.getAMap();
|
|
|
- const pixel = new AMap.Pixel(0, 0);
|
|
|
- const size = mapRef.value.getMapDomSize();
|
|
|
- const pixel2 = new AMap.Pixel(size[0], size[1]);
|
|
|
- const lnglat = map.containerToLngLat(pixel);
|
|
|
- const lnglat2 = map.containerToLngLat(pixel2);
|
|
|
- queryParams.longitude_min = lnglat.lng;
|
|
|
- queryParams.latitude_max = lnglat.lat;
|
|
|
- queryParams.longitude_max = lnglat2.lng;
|
|
|
- queryParams.latitude_min = lnglat2.lat;
|
|
|
- }
|
|
|
- getLocationVideos(queryParams).then((res) => {
|
|
|
- mapUtils.addMarker2(res.data);
|
|
|
- });
|
|
|
+ addMarkersMethod();
|
|
|
+ },
|
|
|
+ {
|
|
|
+ deep: true
|
|
|
+ }
|
|
|
+);
|
|
|
+// 监听层级变化
|
|
|
+watch(
|
|
|
+ () => mapStore.mapState.zoom,
|
|
|
+ () => {
|
|
|
+ mapMoveEnd();
|
|
|
},
|
|
|
{
|
|
|
deep: true
|
|
@@ -451,8 +476,10 @@ onBeforeUnmount(() => {
|
|
|
if (!!map) {
|
|
|
if (mapStore.isAMap) {
|
|
|
map.off('click', handleClickMap);
|
|
|
+ map.off('moveend', handleClickMap);
|
|
|
} else {
|
|
|
map.un('click', handleClickMap);
|
|
|
+ map.un('moveend', handleClickMap);
|
|
|
}
|
|
|
mapStore.setIsMapSelect(false);
|
|
|
}
|