From 9df9c98fa031136e7a2245b7a5081f3d6837bbdd Mon Sep 17 00:00:00 2001 From: dai <851733175@qq.com> Date: Wed, 3 Aug 2022 18:03:35 +0800 Subject: [PATCH 1/4] 111 --- src/views/modules/visual/command/cpts/map.vue | 78 ++++++++++++++++++- src/views/modules/visual/command/index.vue | 2 +- 2 files changed, 78 insertions(+), 2 deletions(-) diff --git a/src/views/modules/visual/command/cpts/map.vue b/src/views/modules/visual/command/cpts/map.vue index fccd8c225..90a24bde8 100644 --- a/src/views/modules/visual/command/cpts/map.vue +++ b/src/views/modules/visual/command/cpts/map.vue @@ -48,6 +48,7 @@ let dotLayer2; let countTextLayer; let countTextBgLayer; let searchMarker; +let searchBgLayer; export default { name: "l7", @@ -627,8 +628,82 @@ export default { } }, + drawSearchBg(lng, lat) { + function getPoints(lng, lat) { + // lng 经度;lat 纬度;dis 距离(千米) + let r = 6371; //地球半径千米 + let dis = 1.5; //3千米距离 + let dlng = + 2 * + Math.asin(Math.sin(dis / (2 * r)) / Math.cos((lat * Math.PI) / 180)); + dlng = (dlng * 180) / Math.PI; // 经度半径 + let dlat = dis / r; + dlat = (dlat * 180) / Math.PI; // 纬度半径 + // 圆形每一度 都算出一个经纬度 + for (let sides = 1; sides <= 360; sides++) { + var angle = Math.PI * (1 / sides - 1 / 2); + var rotatedAngle, x, y; + var points = []; + for (var i = 0; i < sides; ++i) { + rotatedAngle = angle + (i * 2 * Math.PI) / sides; + x = lng + dlng * Math.cos(rotatedAngle); + y = lat + dlat * Math.sin(rotatedAngle); + points.push([x, y]); + } + } + console.log("points=======", points); + return points; + } + + let sourceData; + if (lng) { + sourceData = { + type: "FeatureCollection", + features: [ + { + type: "Feature", + properties: { + center: [lng, lat], + }, + geometry: { + type: "Polygon", + coordinates: [getPoints(lng, lat)], + }, + }, + ], + }; + } else { + sourceData = { + type: "FeatureCollection", + features: [], + }; + } + + if (searchBgLayer) { + searchBgLayer.setData(sourceData); + } else { + searchBgLayer = new PolygonLayer({ + // autoFit: true, + }) + .source(sourceData) + .color("#f0f") + .shape("fill") + .style({ + opacityLinear: { + enable: true, // true - false + dir: "out", // in - out + }, + opacity: 0.3, + raisingHeight: 0, + }); + + scene.addLayer(searchBgLayer); + } + }, + async setDotMarker(item, posArr) { this.removeDotMarker(); + this.drawSearchBg(...posArr); const marker = new Marker({ offsets: [0, -20], }).setLnglat(posArr); @@ -652,7 +727,7 @@ export default { }); scene.addMarker(marker); - scene.setZoomAndCenter(18, posArr); + scene.setZoomAndCenter(14, posArr); marker.openPopup(); searchMarker = marker; }, @@ -661,6 +736,7 @@ export default { if (searchMarker) { searchMarker.remove(); } + this.drawSearchBg(); }, // 把地图缩放等级在原来基础上大一点 diff --git a/src/views/modules/visual/command/index.vue b/src/views/modules/visual/command/index.vue index dd29faae3..f06adb938 100644 --- a/src/views/modules/visual/command/index.vue +++ b/src/views/modules/visual/command/index.vue @@ -50,7 +50,7 @@ @keyup.enter="handleSearch" v-model="searchName" /> - Date: Thu, 4 Aug 2022 09:14:29 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E7=94=BB=E5=9C=88=E5=9C=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/visual/command/cpts/sidemenu-left.vue | 14 ++++++++++++-- src/views/modules/visual/command/index.vue | 6 +++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/views/modules/visual/command/cpts/sidemenu-left.vue b/src/views/modules/visual/command/cpts/sidemenu-left.vue index 4efcf3374..4b775ec12 100644 --- a/src/views/modules/visual/command/cpts/sidemenu-left.vue +++ b/src/views/modules/visual/command/cpts/sidemenu-left.vue @@ -145,9 +145,19 @@ export default { }, handleClickItem(item) { + console.log("handleClickItem", item); if (item.categoryKey) { - this.currentKey = item.categoryKey; - this.currentItem = { ...item }; + if (item.categoryKey != this.currentKey) { + this.currentKey = item.categoryKey; + this.currentItem = { ...item }; + } else { + this.currentKey = ""; + this.currentItem = { + categoryKey: "", + coverageType: "", + placeType: "", + }; + } } else { this.currentUnfolded = this.currentUnfolded == item.placeType ? "" : item.placeType; diff --git a/src/views/modules/visual/command/index.vue b/src/views/modules/visual/command/index.vue index f06adb938..299e8364e 100644 --- a/src/views/modules/visual/command/index.vue +++ b/src/views/modules/visual/command/index.vue @@ -50,7 +50,8 @@ @keyup.enter="handleSearch" v-model="searchName" /> - Date: Thu, 4 Aug 2022 09:58:33 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=94=B9bug=E5=96=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/modules/cpts/base/cpts/edit.vue | 2 +- src/views/modules/visual/command/cpts/map.vue | 36 +++++++++++-------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/views/modules/cpts/base/cpts/edit.vue b/src/views/modules/cpts/base/cpts/edit.vue index f68dc9f78..436a923bd 100644 --- a/src/views/modules/cpts/base/cpts/edit.vue +++ b/src/views/modules/cpts/base/cpts/edit.vue @@ -628,7 +628,7 @@ export default { // 定义map变量,调用 TMap.Map() 构造函数创建地图 map = new window.TMap.Map(document.getElementById("app"), { center: center, // 设置地图中心点坐标 - zoom: 15, // 设置地图缩放级别 + zoom: 13, // 设置地图缩放级别 pitch: 43.5, // 设置俯仰角 rotation: 45, // 设置地图旋转角度 }); diff --git a/src/views/modules/visual/command/cpts/map.vue b/src/views/modules/visual/command/cpts/map.vue index 90a24bde8..675c056fd 100644 --- a/src/views/modules/visual/command/cpts/map.vue +++ b/src/views/modules/visual/command/cpts/map.vue @@ -147,25 +147,12 @@ export default { }, }, - computed: {}, - components: { cptCard, cptTb, cptPopup, }, - watch: {}, - - async mounted() { - // 临时这么用吧 - window._AMapSecurityConfig = { - securityJsCode: "92ea2c965c6cf1ba7ee3a8fe01449ef2", - }; - - this.iniMap(); - }, - computed: { polygonData() { const { srcGridData } = this; @@ -314,6 +301,20 @@ export default { }, }, + async mounted() { + console.log("指挥调度map初始化啦"); + // 临时这么用吧 + window._AMapSecurityConfig = { + securityJsCode: "92ea2c965c6cf1ba7ee3a8fe01449ef2", + }; + + this.iniMap(); + + // 为了避免刷新残留 + searchMarker = null; + searchBgLayer = null; + }, + methods: { iniMap() { const { darkStyle, lightStyle, srcGridData } = this; @@ -680,10 +681,11 @@ export default { } if (searchBgLayer) { + console.log("searchBgLayer已经存在了", searchBgLayer); searchBgLayer.setData(sourceData); } else { searchBgLayer = new PolygonLayer({ - // autoFit: true, + // autoFit: true, }) .source(sourceData) .color("#f0f") @@ -733,10 +735,14 @@ export default { }, removeDotMarker() { + console.log("removeDotMarker"); if (searchMarker) { searchMarker.remove(); } - this.drawSearchBg(); + if (searchBgLayer) { + console.log("removeDotMarker-----searchBgLayer"); + this.drawSearchBg(); + } }, // 把地图缩放等级在原来基础上大一点 From 82ca8fb4542c0645e45115e1d83286fedd6059c8 Mon Sep 17 00:00:00 2001 From: dai <851733175@qq.com> Date: Thu, 4 Aug 2022 16:49:35 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../communityService/fuwujilu/addForm.vue | 1528 +++++++++-------- src/views/modules/visual/command/cpts/map.vue | 7 + .../modules/visual/command/cpts/popup.vue | 76 +- .../visual/command/cpts/serviceInfo.vue | 45 +- src/views/modules/visual/command/index.vue | 19 +- 5 files changed, 896 insertions(+), 779 deletions(-) diff --git a/src/views/modules/communityService/fuwujilu/addForm.vue b/src/views/modules/communityService/fuwujilu/addForm.vue index 2dc0956d8..d3243c35c 100644 --- a/src/views/modules/communityService/fuwujilu/addForm.vue +++ b/src/views/modules/communityService/fuwujilu/addForm.vue @@ -1,256 +1,304 @@ - - diff --git a/src/views/modules/visual/command/cpts/serviceInfo.vue b/src/views/modules/visual/command/cpts/serviceInfo.vue index 4fe108cad..b3c55bcb1 100644 --- a/src/views/modules/visual/command/cpts/serviceInfo.vue +++ b/src/views/modules/visual/command/cpts/serviceInfo.vue @@ -15,6 +15,7 @@ ref="demandEditForm" :source="'visiual'" :formType="'add'" + :defaultData="defaultData" @close="handleClose" @handleClose="handleClose" @handleOk="handleOk" @@ -27,14 +28,17 @@