From 316933d9c51ad4f966838a8bd4ca388961243369 Mon Sep 17 00:00:00 2001 From: chenchenzai Date: Sun, 27 Nov 2022 18:28:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E4=B8=8A=E9=9D=A2=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=82=B9=E5=87=BB=E5=87=BA=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/supermap/advance-init.js | 21 +++++++++++++++++++ src/supermap/createMarkerPopup.js | 1 - .../areaMonitor/components/SiteListMore.vue | 3 +-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/supermap/advance-init.js b/src/supermap/advance-init.js index 8405fcd..aba1bfe 100644 --- a/src/supermap/advance-init.js +++ b/src/supermap/advance-init.js @@ -146,6 +146,7 @@ export function MapFun(mapObj) { * @param {*} feature */ const _openPopupEventDetailNew = function(feature) { + debugger if (feature.type == 'cameraTree') { const elementHtml = createCameraDetailsPop(feature) const arr = [0, 0.0, '', '0', '0.0'] @@ -2024,6 +2025,25 @@ export function MapFun(mapObj) { polygon.addTo(map) PolygonArr.push(polygon) } + + const _addAreaToMapNew = function(latLng, data) { + //console.log('llllll', latLng) + //debugger + const polygon = L.polygon(latLng, { color: 'red' }) + // map.fitBounds(polyline.getBounds()) + polygon.addTo(map) + PolygonArr.push(polygon) + polygon.on('click', async e => { + console.log('pppooooo', e, data); + let feature = { + data: data, + type: "site", + latLng: latLng[0] + }; + const elementHtml = createImportantAreaPopNew(feature) + L.popup({ className: 'site-popup', keepInView: false }).setLatLng(feature.latLng).setContent(elementHtml).openOn(map) + }) + } return { // 按图层配置名称删除 removeLayerByLayerName: _removeLayerByLayerName, @@ -2100,5 +2120,6 @@ export function MapFun(mapObj) { addPathToMap: _addPathToMap, addPointTestOnMap: _addPointTestOnMap, addAreaToMap: _addAreaToMap, + addAreaToMapNew: _addAreaToMapNew, } } \ No newline at end of file diff --git a/src/supermap/createMarkerPopup.js b/src/supermap/createMarkerPopup.js index 626eda9..15a0f6b 100644 --- a/src/supermap/createMarkerPopup.js +++ b/src/supermap/createMarkerPopup.js @@ -244,7 +244,6 @@ function createImportantAreaPop(feature) { // 重点区域弹窗 function createImportantAreaPopNew(feature) { bus.$emit('areaCauseAnalysis', feature.data) - const popupDom = new Dom({ template: '', data() { diff --git a/src/views/pages/areaMonitor/components/SiteListMore.vue b/src/views/pages/areaMonitor/components/SiteListMore.vue index a61c3b6..bdd842a 100644 --- a/src/views/pages/areaMonitor/components/SiteListMore.vue +++ b/src/views/pages/areaMonitor/components/SiteListMore.vue @@ -199,7 +199,6 @@ import { createImportantAreaPopNew } from '../../../../supermap/createMarkerPopu }, // 行点击 analyse(row) { - debugger // bus.$emit("openCauseAnalysis", row); this.$parent.hiMapFun.removerPolygon() this.$parent.removeRoadCauseAnalysis() @@ -224,7 +223,7 @@ import { createImportantAreaPopNew } from '../../../../supermap/createMarkerPopu let lonLat = gcjLL2wgs84LL(item[0], item[1]); areaLatLng.push([lonLat[1],lonLat[0]]) }) - this.$parent.hiMapFun.addAreaToMap(areaLatLng) + this.$parent.hiMapFun.addAreaToMapNew(areaLatLng,row) } // else { // selectByAreaName({areaName:row.areaName}).then((res) => {