From 67c1051591ce86d262e3423730a46e91f812b7ca Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Thu, 17 Jul 2025 11:28:33 +0800
Subject: [PATCH] feat:事件工单---新建工单, 选择位置默认位置显示处理

---
 src/views/tickets/ticket.vue |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/views/tickets/ticket.vue b/src/views/tickets/ticket.vue
index 3fe0bc4..7e64864 100644
--- a/src/views/tickets/ticket.vue
+++ b/src/views/tickets/ticket.vue
@@ -741,6 +741,8 @@
     }
   },
   created () {
+    this.inputMapShowDefaultCenter = null
+
     this.loadAMapScripts()
     this.fetchDropdownData()
     console.log('permission.tickets_processing_btn', this.permission.tickets_processing_btn)
@@ -1042,19 +1044,21 @@
 
         // 直接从返回对象中获取正确的路径
         const center = adcodeObj?.payload?.objects?.collection?.geometries?.[0]?.properties?.center
+
         if (Array.isArray(center) && center.length === 2) {
-          this.mapParams.center = center
+          this.inputMapShowDefaultCenter = center
         } else {
           // 如果找不到中心点,尝试使用 bbox 的中心点
           const bbox = adcodeObj?.payload?.bbox
           if (Array.isArray(bbox) && bbox.length === 4) {
             const centerX = (bbox[0] + bbox[2]) / 2
             const centerY = (bbox[1] + bbox[3]) / 2
-            this.mapParams.center = [centerX, centerY]
+            this.inputMapShowDefaultCenter = [centerX, centerY]
           } else {
-            this.mapParams.center = [115.861365, 28.621311]
+            this.inputMapShowDefaultCenter = [115.861365, 28.621311]
           }
         }
+        this.mapParams.center = [...this.inputMapShowDefaultCenter]
 
         this.mapLoaded = true
       } catch (error) {
@@ -1526,10 +1530,9 @@
     },
 
     handleAdd () {
-
       this.createoredit = 1
       this.dialogVisible = true
-      this.mapParams.center = null
+      this.mapParams.center = [...this.inputMapShowDefaultCenter]
       this.form.location = []
     },
 
@@ -2137,7 +2140,7 @@
       if (Array.isArray(this.form.location) && this.form.location.length >= 2) {
         this.mapParams.center = [Number(this.form.location[0]), Number(this.form.location[1])]
       } else {
-        this.mapParams.center = null // 没有经纬度时用默认
+        this.mapParams.center = [...this.inputMapShowDefaultCenter]
       }
       // 如果有图片,添加到表单中
       if (row.photo_url) {

--
Gitblit v1.9.3