From 4fabfe4dbd2eb28d07a4350597d314958cc1c281 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期四, 09 十月 2025 11:16:43 +0800
Subject: [PATCH] 优化

---
 admin/src/views/operation/components/AMap.vue |   28 ++++++++++++++++++++++------
 1 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/admin/src/views/operation/components/AMap.vue b/admin/src/views/operation/components/AMap.vue
index 9b6a4c1..5627175 100644
--- a/admin/src/views/operation/components/AMap.vue
+++ b/admin/src/views/operation/components/AMap.vue
@@ -1,6 +1,6 @@
 <template>
   <GlobalWindow title="缁樺埗杩愯惀鍖哄煙" :visible.sync="isShowModal" :confirm-working="isWorking" @close="close"
-    @confirm="confirm" width="1000px">
+    @confirm="confirm" width="100%">
     <div class="map_title">缁樺埗锛氶紶鏍囧乏閿偣鍑诲強绉诲姩鍗冲彲缁樺埗鍥惧舰锛岀粯鍒惰繃绋嬩腑鎸変笅esc閿彲涓柇璇ヨ繃绋�</div>
     <div class="map_title">榧犳爣宸﹂敭鍙屽嚮鍗冲彲缁撴潫褰撳墠澶氳竟褰㈢粯鍒讹紝澶氳竟褰細鑷姩闂悎锛�</div>
     <div class="map_wrap">
@@ -10,7 +10,7 @@
         <!-- <el-button plain @click="reset">閲嶆柊缁樺埗</el-button> -->
         <!-- <el-button plain  type="danger" @click="deleteObj">鍒犻櫎</el-button> -->
       </div>
-      <div id="container" style="width: 100%; height: 100%"></div>
+      <div id="containera" style="width: 100%; height: 100%"></div>
     </div>
   </GlobalWindow>
 </template>
@@ -38,9 +38,25 @@
   },
   methods: {
     initMap() {
-      map = new TMap.Map("container", {
-        zoom: 15, // 璁剧疆鍦板浘缂╂斁绾у埆
-        center: new TMap.LatLng(31.722763, 117.385480) // 璁剧疆鍦板浘涓績鐐瑰潗鏍�
+      // navigator.geolocation.getCurrentPosition(
+      //   (position) => {
+      //     const { latitude, longitude } = position.coords
+      //     console.log(`褰撳墠瀹氫綅: 绾害 ${latitude}, 缁忓害 ${longitude}`)
+      //   },
+      //   (error) => {
+      //     console.error("瀹氫綅澶辫触:", error.message)
+      //   },
+      //   {
+      //     enableHighAccuracy: true, // 鎻愰珮瀹氫綅绮惧害
+      //     timeout: 5000, // 瓒呮椂鏃堕棿
+      //     maximumAge: 0 // 绂佺敤缂撳瓨
+      //   }
+      // )
+      console.log('-----', this.row)
+
+      map = new TMap.Map("containera", {
+        zoom: this.polygons.length > 0 ? 20 : 16, // 璁剧疆鍦板浘缂╂斁绾у埆
+        center: this.polygons.length > 0 ? new TMap.LatLng(this.polygons[0].lat, this.polygons[0].lng) : new TMap.LatLng(31.722763, 117.385480) // 璁剧疆鍦板浘涓績鐐瑰潗鏍�
       })
       var tempList = []
       if (this.polygons.length > 0) {
@@ -141,4 +157,4 @@
     z-index: 99999999999;
   }
 }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.9.3