From 803b93038ca16e21ea60a260ca4ac882b84a87ef Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 18 七月 2025 17:31:53 +0800
Subject: [PATCH] 2025.7.18 监管任务模块 1. 监管场景样式优化; 2. 新增监管场景GIS地图展示(待完成);

---
 src/utils/map/marks.js |   36 +++++++++++++++++++++++++-----------
 1 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/src/utils/map/marks.js b/src/utils/map/marks.js
index a72dcdf..bf01656 100644
--- a/src/utils/map/marks.js
+++ b/src/utils/map/marks.js
@@ -2,7 +2,7 @@
  * 楂樺痉鍦板浘鐐规爣璁扮粯鍒剁浉鍏�
  */
 
-import { map } from './index_old';
+import { map, AMap } from './index';
 import { useToolboxStore } from '@/stores/toolbox';
 
 const toolboxStore = useToolboxStore();
@@ -25,7 +25,7 @@
     for (let i = 0; i < lnglats.length; i++) {
       data.push({
         lnglat: lnglats[i], //鐐规爣璁颁綅缃�
-        name: `${fDatas.times[i]}<br/>${_factor.factorName}: ${_factor.datas[i].factorData} mg/m鲁`,
+        name: `${fDatas.times[i]}<br/>${_factor.factorName}: ${_factor.datas[i].factorData} 渭g/m鲁`,
         id: i
       });
     }
@@ -34,12 +34,12 @@
     var styleObject = {
       url: 'https://a.amap.com/jsapi_demos/static/images/mass1.png',
       // url: './asset/mipmap/ic_up_white.png', // 鍥炬爣鍦板潃
-      // eslint-disable-next-line no-undef
+
       size: new AMap.Size(11, 11), // 鍥炬爣澶у皬
-      // eslint-disable-next-line no-undef
+
       anchor: new AMap.Pixel(5, 5) // 鍥炬爣鏄剧ず浣嶇疆鍋忕Щ閲忥紝鍩哄噯鐐逛负鍥炬爣宸︿笂瑙�
     };
-    // eslint-disable-next-line no-undef
+
     var massMarks = new AMap.MassMarks(data, {
       zIndex: 5, // 娴烽噺鐐瑰浘灞傚彔鍔犵殑椤哄簭
       zooms: [15, 18], // 鍦ㄦ寚瀹氬湴鍥剧缉鏀剧骇鍒寖鍥村唴灞曠ず娴烽噺鐐瑰浘灞�
@@ -50,11 +50,11 @@
       // 3. 鑷畾涔夌偣鍑讳簨浠�
       onClick(i);
     });
-    // eslint-disable-next-line no-undef
+
     var marker = new AMap.Marker({
       content: ' ',
       map: map,
-      // eslint-disable-next-line no-undef
+
       offset: new AMap.Pixel(13, 12)
     });
     var timeout;
@@ -86,8 +86,7 @@
    * @param {boolean} collision 鏍囨敞閬胯
    * @returns
    */
-  createLabelMarks(img, dataList, collision = true) {
-    // eslint-disable-next-line no-undef
+  createLabelMarks(img, dataList, collision = true, showTxt = true) {
     const layer = new AMap.LabelsLayer({
       zooms: [3, 20],
       zIndex: 1000,
@@ -119,7 +118,7 @@
           retina: true
         },
         text: {
-          content: data.name,
+          content: showTxt ? data.name : '',
           direction: 'top',
           offset: [0, -5],
           style: {
@@ -136,7 +135,6 @@
         index: i
       };
 
-      // eslint-disable-next-line no-undef
       var labelMarker = new AMap.LabelMarker(curData);
 
       // markers.push(labelMarker);
@@ -145,5 +143,21 @@
     }
 
     return layer;
+  },
+
+  createMarker({ position, icon, label, extData }) {
+    const marker = new AMap.Marker({
+      position: position,
+      offset: new AMap.Pixel(-10, -10),
+      icon: icon, //娣诲姞 icon 鍥炬爣 URL
+      title: label,
+      label: {
+        content: label,
+        direction: 'bottom'
+      },
+      extData
+    });
+    map.add(marker);
+    return marker;
   }
 };

--
Gitblit v1.9.3