Hwf 1 ay önce
ebeveyn
işleme
cf20fc0466

+ 4 - 29
src/hooks/AMap/useAMap.ts

@@ -288,7 +288,7 @@ export function useAMap(options) {
         data.lnglat = [data.longitude, data.latitude];
         const marker = new AMap.Marker({
           position: [data.longitude, data.latitude],
-          content: getContent(data.image, data.size),
+          content: getContent(data.isHover ? data.imageHover : data.image, data.size),
           anchor: 'bottom-center',
           offset: new AMap.Pixel(0, 0),
           map: map
@@ -318,6 +318,9 @@ export function useAMap(options) {
         });
         plotLayers['points2'].addOverlay(marker);
         addPoints.push(data);
+        if (data.isHover) {
+          options.onMarkerClick(data);
+        }
       }
     });
   };
@@ -348,34 +351,6 @@ export function useAMap(options) {
     }
   };
 
-  const handleHover = (extData, dataType) => {
-    map.setZoom(18);
-    map.setCenter([extData.lng, extData.lat]);
-    setTimeout(() => {
-      let index = 0;
-      let index2 = 0;
-      let data = {};
-      for (let i = 0; i < addPoints.length; i++) {
-        if (addPoints[i].id === extData.id.toString() && addPoints[i].dataType === dataType) {
-          addPoints[i].icon = addPoints[i].imageHover;
-          index++;
-          data = addPoints[i];
-        } else if (!!clickMarker) {
-          const extData2 = clickMarker.getExtData ? clickMarker.getExtData() : clickMarker;
-          if (addPoints[i].id === extData2.id) {
-            addPoints[i].icon = addPoints[i].image;
-            index2++;
-          }
-        }
-        if ((!!clickMarker && index === 1 && index2 === 1) || (!clickMarker && index === 1)) {
-          break;
-        }
-      }
-      addMarker(addPoints);
-      options.onMarkerClick(data);
-    }, 2000);
-  };
-
   // 显示信息框
   let infoWindow;
   const showInfo = (content, position, offsetY, isCustom) => {

+ 1 - 1
src/store/modules/map.ts

@@ -94,7 +94,7 @@ export const useMapStore = defineStore('map', () => {
                   data3[z].checked = false;
                 }
               }
-              updateMenu.value = [selectItem];
+              updateMenu.value = selectItem;
               let selecData = [];
               menuState.value.menuData.forEach((item) => {
                 if (!item.isVideo || (item.isVideo && selectItem.component === item.component)) {

+ 8 - 0
src/types/components.d.ts

@@ -45,23 +45,29 @@ declare module 'vue' {
     ElIcon: typeof import('element-plus/es')['ElIcon']
     ElImage: typeof import('element-plus/es')['ElImage']
     ElInput: typeof import('element-plus/es')['ElInput']
+    ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
     ElMenu: typeof import('element-plus/es')['ElMenu']
     ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
     ElOption: typeof import('element-plus/es')['ElOption']
     ElPagination: typeof import('element-plus/es')['ElPagination']
     ElPopover: typeof import('element-plus/es')['ElPopover']
+    ElRadio: typeof import('element-plus/es')['ElRadio']
+    ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
     ElRow: typeof import('element-plus/es')['ElRow']
     ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
     ElSelect: typeof import('element-plus/es')['ElSelect']
     ElSlider: typeof import('element-plus/es')['ElSlider']
     ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
     ElSwitch: typeof import('element-plus/es')['ElSwitch']
+    ElTable: typeof import('element-plus/es')['ElTable']
+    ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
     ElTag: typeof import('element-plus/es')['ElTag']
     ElText: typeof import('element-plus/es')['ElText']
     ElTimeline: typeof import('element-plus/es')['ElTimeline']
     ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem']
     ElTooltip: typeof import('element-plus/es')['ElTooltip']
     ElTree: typeof import('element-plus/es')['ElTree']
+    ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect']
     ElUpload: typeof import('element-plus/es')['ElUpload']
     ExcelEditor: typeof import('./../components/ExcelEditor/index.vue')['default']
     FileUpload: typeof import('./../components/FileUpload/index.vue')['default']
@@ -74,6 +80,8 @@ declare module 'vue' {
     HikvisionPlayer: typeof import('./../components/HKVideo/hikvision-player.vue')['default']
     HKVideo: typeof import('./../components/HKVideo/index.vue')['default']
     IconSelect: typeof import('./../components/IconSelect/index.vue')['default']
+    IEpCaretBottom: typeof import('~icons/ep/caret-bottom')['default']
+    IEpCaretTop: typeof import('~icons/ep/caret-top')['default']
     IFrame: typeof import('./../components/iFrame/index.vue')['default']
     ImagePreview: typeof import('./../components/ImagePreview/index.vue')['default']
     ImageUpload: typeof import('./../components/ImageUpload/index.vue')['default']

+ 4 - 1
src/utils/olMap/olMap.ts

@@ -770,7 +770,7 @@ export class olMap {
           feature.setStyle(
             new Style({
               image: new Icon({
-                src: data.image,
+                src: data.isHover ? data.imageHover : data.image,
                 scale: scale,
                 anchor: [0.5, 0.5],
                 anchorXUnits: 'fraction',
@@ -782,6 +782,9 @@ export class olMap {
         };
         img.src = data.image; // 设置图片的 URL,触发加载
         this.markers.push(data);
+        if (data.isHover) {
+          this.options.onMarkerClick(data);
+        }
       }
     });
   }

+ 1 - 1
src/views/globalMap/LeftMenu.vue

@@ -231,7 +231,7 @@ const handleClick = (item) => {
 
 const setMenuIndex = (index) => {
   menuState.activeIndex = index;
-}
+};
 
 const setMenuChange = (item, flag) => {
   for (let i = 0; i < menuData.value.length; i++) {

+ 28 - 1
src/views/globalMap/index.vue

@@ -177,6 +177,17 @@ const addMarkersMethod = debounce(
     }
     getPointInfo2(queryParams).then((res) => {
       const data = res.data ? res.data : [];
+      if (!!detailsData.value.id) {
+        data.forEach((item) => {
+          if (item.id === detailsData.value.id) {
+            item.isHover = true;
+          }
+        });
+        detailsData.value = {
+          id: '',
+          dataType: ''
+        };
+      }
       mapUtils.addMarker2(data);
     });
     if (!mapStore.pointParams.option.includes('43') && addMarkersTimer) {
@@ -233,6 +244,12 @@ const clickMenu = (item, dataList) => {
     // 通讯保障
     communicationSupport.show = !communicationSupport.show;
     communicationSupport.data = item;
+  } else if (item.path === '4' && ['定点分析', '格点雨量'].includes(item.name)) {
+    // 定点分析、格点雨量
+    tempMenu.value = item;
+    //为地图注册click事件获取鼠标点击出的经纬度坐标
+    map.on('click', handleClickMap);
+    mapStore.setIsMapSelect(true);
   }
   if (['重点车辆'].includes(item.name) && !item.checked) {
     timeAxisRef.value.clearData();
@@ -286,10 +303,20 @@ const getMap = () => {
   const domRef = mapStore.isAMap ? mapRef.value : map2Ref.value;
   return !!domRef ? domRef.getMap() : {};
 };
+let detailsData = ref({
+  id: '',
+  dataType: ''
+});
 const showDetail = (data, dataType) => {
   const domRef = mapStore.isAMap ? mapRef.value : map2Ref.value;
   if (!!domRef) {
-    domRef.handleHover(data, dataType);
+    const newMap = mapStore.isAMap ? map : map.getView();
+    newMap.setCenter([data.lng, data.lat]);
+    newMap.setZoom(18);
+    detailsData.value = {
+      id: data.id.toString(),
+      dataType: dataType
+    };
   }
 };
 const getDrawTool = () => {