From 4a836815f12e8ba717702cc8ed431e1b4f96134c Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 25 四月 2025 13:55:34 +0800
Subject: [PATCH] 新增内部线索相关管理逻辑

---
 src/components/map/MapSearch.vue |   84 +++++++++++++++++++++++++++++-------------
 1 files changed, 58 insertions(+), 26 deletions(-)

diff --git a/src/components/map/MapSearch.vue b/src/components/map/MapSearch.vue
index 909e355..624f146 100644
--- a/src/components/map/MapSearch.vue
+++ b/src/components/map/MapSearch.vue
@@ -1,9 +1,16 @@
 <template>
-  <el-dialog v-model="dialogShow" width="70%" destroy-on-close>
+  <el-dialog
+    class="dialog"
+    v-model="dialogShow"
+    width="70%"
+    destroy-on-close
+  >
     <template #header>
-      <div> 鍧愭爣鎷惧彇</div>
+      <div>鍧愭爣鎷惧彇</div>
     </template>
-    <div class="fy-tip-red">宸﹂敭鐐瑰嚮鍦板浘閫夊彇鍧愭爣鐐癸紝鎴栬�呮牴鎹叧閿瓧鎼滅储鍦扮偣</div>
+    <div class="fy-tip-red">
+      宸﹂敭鐐瑰嚮鍦板浘閫夊彇鍧愭爣鐐癸紝鎴栬�呮牴鎹叧閿瓧鎼滅储鍦扮偣
+    </div>
     <el-row>
       <el-col :span="10">
         <el-form
@@ -45,11 +52,14 @@
           <span>{{ searchResult.address }}</span>
           <div>
             <span>{{
-              searchResult.lon + ', ' + searchResult.lat
+              '楂樺痉锛�' + searchResult.lon + ', ' + searchResult.lat
             }}</span>
             <el-divider direction="vertical" />
             <span>{{
-              searchResult.gpsLon + ', ' + searchResult.gpsLat
+              'GPS锛�' +
+              searchResult.gpsLon +
+              ', ' +
+              searchResult.gpsLat
             }}</span>
           </div>
         </div>
@@ -94,7 +104,10 @@
     };
   },
   props: {
-    show: Boolean
+    // 瀵硅瘽妗嗘樉绀洪殣钘�
+    show: Boolean,
+    // 榛樿鎼滅储鐐圭粡绾害锛孾lng, lat]
+    defaultCoor: Array
   },
   data() {
     return {
@@ -146,29 +159,21 @@
         geocoder = new AMap.Geocoder({
           city: '涓婃捣' // city 鎸囧畾杩涜缂栫爜鏌ヨ鐨勫煄甯傦紝鏀寔浼犲叆鍩庡競鍚嶃�乤dcode 鍜� citycode
         });
+        if (this.defaultCoor) {
+          const [lng, lat] = baseMapUtil.wgs84togcj02(
+            this.defaultCoor[0],
+            this.defaultCoor[1]
+          );
+          const lnglat = new AMap.LngLat(lng, lat);
+          this.setMarker(lnglat);
+          this.getAddress(lnglat);
+          this.map.setFitView();
+        }
         this.map.on('click', (ev) => {
           // this.formObj.lon = ev.lnglat.getLng();
           // this.formObj.lat = ev.lnglat.getLat();
-          this.map.clearMap();
-          const marker = new AMap.Marker({
-            position: ev.lnglat
-          });
-          this.map.add(marker);
-
-          geocoder.getAddress(ev.lnglat, (status, result) => {
-            if (status === 'complete' && result.info === 'OK') {
-              this.searchResult.address =
-                result.regeocode.formattedAddress;
-              this.searchResult.lon = ev.lnglat.getLng();
-              this.searchResult.lat = ev.lnglat.getLat();
-              const [gpsLon, gpsLat] = baseMapUtil.gcj02towgs84(
-                this.searchResult.lon,
-                this.searchResult.lat
-              );
-              this.searchResult.gpsLon = gpsLon;
-              this.searchResult.gpsLat = gpsLat;
-            }
-          });
+          this.setMarker(ev.lnglat);
+          this.getAddress(ev.lnglat);
         });
       });
       // inited = true;
@@ -199,6 +204,29 @@
         }
       });
     },
+    getAddress(lnglat) {
+      geocoder.getAddress(lnglat, (status, result) => {
+        if (status === 'complete' && result.info === 'OK') {
+          this.searchResult.address =
+            result.regeocode.formattedAddress;
+          this.searchResult.lon = lnglat.getLng();
+          this.searchResult.lat = lnglat.getLat();
+          const [gpsLon, gpsLat] = baseMapUtil.gcj02towgs84(
+            this.searchResult.lon,
+            this.searchResult.lat
+          );
+          this.searchResult.gpsLon = gpsLon;
+          this.searchResult.gpsLat = gpsLat;
+        }
+      });
+    },
+    setMarker(lnglat) {
+      this.map.clearMap();
+      const marker = new AMap.Marker({
+        position: lnglat
+      });
+      this.map.add(marker);
+    },
     submit() {
       this.$emit('onSubmit', this.searchResult);
       this.dialogShow = false;
@@ -218,4 +246,8 @@
   border-radius: var(--el-border-radius-round);
   box-shadow: var(--el-box-shadow);
 }
+
+.dialog {
+  pointer-events: auto;
+}
 </style>

--
Gitblit v1.9.3