From 57c370b2dd54a8c4f65a04ebdf96221c047fe6e8 Mon Sep 17 00:00:00 2001 From: wuxw <928255095@qq.com> Date: Thu, 30 Oct 2025 14:51:12 +0800 Subject: [PATCH] =?UTF-8?q?v1.9=20=E4=BC=98=E5=8C=96=E5=B7=A1=E6=A3=80?= =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E5=B1=95=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inspection/inspectionRouteMap.vue | 18 ++++++++++++++++ .../inspection/inspectionTaskMap.vue | 21 +++++++++++++++++++ src/components/inspection/pointPlan.vue | 2 +- src/components/inspection/pointRoute.vue | 7 +++---- src/components/inspection/pointTask.vue | 6 +++--- src/components/inspection/pointTaskDetail.vue | 2 +- .../inspection/inspectionItemManageList.vue | 4 ++-- .../inspectionItemTitleManageList.vue | 2 +- src/views/inspection/inspectionPointList.vue | 1 - src/views/inspection/inspectionRouteList.vue | 1 - 10 files changed, 50 insertions(+), 14 deletions(-) diff --git a/src/components/inspection/inspectionRouteMap.vue b/src/components/inspection/inspectionRouteMap.vue index 41dfa039b..fb18552bb 100644 --- a/src/components/inspection/inspectionRouteMap.vue +++ b/src/components/inspection/inspectionRouteMap.vue @@ -29,6 +29,24 @@ export default { }, initMap() { + // 若已有地图或图层,先清理避免重复初始化 + if (this.markerLayer) { + this.markerLayer.setMap(null) + this.markerLayer = null + } + if (this.labelLayer) { + this.labelLayer.setMap(null) + this.labelLayer = null + } + if (this.polylineLayer) { + this.polylineLayer.setMap(null) + this.polylineLayer = null + } + if (this.map) { + this.map.destroy() + this.map = null + } + // 默认中心点(北京) const center = new window.TMap.LatLng(39.916527, 116.397128) diff --git a/src/components/inspection/inspectionTaskMap.vue b/src/components/inspection/inspectionTaskMap.vue index 4d586addd..e9b18832d 100644 --- a/src/components/inspection/inspectionTaskMap.vue +++ b/src/components/inspection/inspectionTaskMap.vue @@ -26,12 +26,33 @@ export default { }, methods: { loadData(task) { + console.log('loadData',task) this.initMap() this.loadTask(task) }, initMap() { + // 若已有地图或图层,先清理避免重复初始化 + if (this.markerLayer) { + this.markerLayer.setMap(null) + this.markerLayer = null + } + if (this.labelLayer) { + this.labelLayer.setMap(null) + this.labelLayer = null + } + if (this.polylineLayer) { + this.polylineLayer.setMap(null) + this.polylineLayer = null + } + if (this.map) { + this.map.destroy() + this.map = null + } + console.log('initMap',this.map) + // 默认中心点(北京) const center = new window.TMap.LatLng(39.916527, 116.397128) + console.log('center',center) // 创建地图实例 this.map = new window.TMap.Map(document.getElementById('inspectionTaskMap'), { diff --git a/src/components/inspection/pointPlan.vue b/src/components/inspection/pointPlan.vue index 31e902a25..c0f5537d4 100644 --- a/src/components/inspection/pointPlan.vue +++ b/src/components/inspection/pointPlan.vue @@ -129,7 +129,7 @@ export default {