From b768ae8d4bcc6f7d345b049e2ad450406f584b8a Mon Sep 17 00:00:00 2001 From: SunTao <328867980@qq.com> Date: Tue, 29 Oct 2024 10:58:53 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E5=A4=A7=E5=B1=8F=E5=9C=B0?= =?UTF-8?q?=E5=9B=BE=E5=9D=90=E6=A0=87=E8=AE=BE=E7=BD=AE=EF=BC=8C=E5=9B=9E?= =?UTF-8?q?=E9=80=80=E5=9D=90=E6=A0=87=E8=BD=AC=E6=8D=A2=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=B8=BA84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/big-screen/index.vue | 21 +++++++--- .../inspection/disease-management/index.vue | 42 +++++-------------- .../road-management/components/road-add.vue | 16 ++----- .../road-management/components/road-view.vue | 23 +++------- .../components/event-add.vue | 16 ++----- .../components/event-view.vue | 26 +++--------- 6 files changed, 41 insertions(+), 103 deletions(-) diff --git a/src/views/big-screen/index.vue b/src/views/big-screen/index.vue index 70e4082..a822892 100644 --- a/src/views/big-screen/index.vue +++ b/src/views/big-screen/index.vue @@ -2,7 +2,7 @@ * @Author: SunTao 328867980@qq.com * @Date: 2024-10-17 11:34:00 * @LastEditors: SunTao 328867980@qq.com - * @LastEditTime: 2024-10-29 09:40:35 + * @LastEditTime: 2024-10-29 10:25:21 * @FilePath: \znxjxt-ui\src\views\big-screen\index.vue * @Description: 大屏首页 --> @@ -452,6 +452,8 @@ export default { } else { this.mapClick = ""; this.mapZoom = ""; + this.clusters = null; + this.markLayerLines = null; } }, /* 获取地图点位信息 */ @@ -494,8 +496,8 @@ export default { features.push(feature); }); const clusterSource = new Cluster({ - distance: 30, - minDistance: 30, + distance: 40, + minDistance: 40, source: new VectorSource({ features, }), @@ -537,7 +539,7 @@ export default { /* 获取地图线段点位信息 */ getLinePoint() { if (!this.markLayerLines) { - mapPciList().then(({ code, data }) => { + mapPciList({ type: this.mapClick }).then(({ code, data }) => { if (code === 200) { this.lineString = data.map((item) => { return item.coordinates.split(";").map((it) => { @@ -597,6 +599,13 @@ export default { changeIconType(value) { if (this.mapClick !== value) { this.mapClick = value; + if (this.$refs.roadMap) { + const map = this.$refs.roadMap.instance.get("map"); + map.removeLayer(this.markLayerLines); + map.removeLayer(this.clusters); + this.clusters = null; + this.markLayerLines = null; + } // 获取对应右上角icon类型 this.getIconType(value); // 请求地图打点/绘制线段接口 @@ -666,9 +675,9 @@ export default { /* 地图缩放完成事件 */ mapMoveend(zoom) { if (this.clusters && zoom > 13) { - this.clusters.getSource().setDistance(1); + this.clusters.getSource().setDistance(0); } else if (this.clusters && zoom <= 13) { - this.clusters.getSource().setDistance(30); + this.clusters.getSource().setDistance(40); } }, /* 地图选中feature事件 */ diff --git a/src/views/xj/inspection/disease-management/index.vue b/src/views/xj/inspection/disease-management/index.vue index 0317afe..ad8a3e6 100644 --- a/src/views/xj/inspection/disease-management/index.vue +++ b/src/views/xj/inspection/disease-management/index.vue @@ -2,7 +2,7 @@ * @Author: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git * @Date: 2024-10-08 10:58:25 * @LastEditors: SunTao 328867980@qq.com - * @LastEditTime: 2024-10-25 11:29:20 + * @LastEditTime: 2024-10-29 10:32:48 * @FilePath: \znxjxt-ui\src\views\xj\inspection\disease-management .vue * @Description: 巡检信息管理-病害管理 --> @@ -540,7 +540,6 @@ import { changeDefectStatus, } from "@/api/xj/disease"; import { getToken } from "@/utils/auth"; -import { gcj02ToWgs84, wgs84ToGcj02 } from "@/api/xj/map"; export default { name: "Defect", @@ -898,22 +897,16 @@ export default { handleUpdate(row) { this.dialogVisible = true; this.dialogTitle = "修改缺陷"; - this.centerPoint = gcj02ToWgs84([ + this.centerPoint = [ row.geometry.coordinates[0], row.geometry.coordinates[1], - ]); + ]; this.$nextTick(() => { this.initMap("addMap"); const e = { lnglat: { - lng: gcj02ToWgs84([ - row.geometry.coordinates[0], - row.geometry.coordinates[1], - ])[0], - lat: gcj02ToWgs84([ - row.geometry.coordinates[0], - row.geometry.coordinates[1], - ])[1], + lng: row.geometry.coordinates[0], + lat: row.geometry.coordinates[1], }, }; this.onMapClick(e); @@ -979,10 +972,7 @@ export default { }), geometry: { type: "Point", - coordinates: wgs84ToGcj02([ - this.markers[0].lng, - this.markers[0].lat, - ]), + coordinates: [this.markers[0].lng, this.markers[0].lat], id: this.form?.geometry?.id, }, }; @@ -1070,26 +1060,14 @@ export default { this.viewForm = defect; this.$nextTick(() => { this.centerPoint = [ - gcj02ToWgs84([ - defect.geometry.coordinates[0], - defect.geometry.coordinates[1], - ])[0], - gcj02ToWgs84([ - defect.geometry.coordinates[0], - defect.geometry.coordinates[1], - ])[1], + defect.geometry.coordinates[0], + defect.geometry.coordinates[1], ]; this.initMap("viewMap"); const e = { lnglat: { - lng: gcj02ToWgs84([ - defect.geometry.coordinates[0], - defect.geometry.coordinates[1], - ])[0], - lat: gcj02ToWgs84([ - defect.geometry.coordinates[0], - defect.geometry.coordinates[1], - ])[1], + lng: defect.geometry.coordinates[0], + lat: defect.geometry.coordinates[1], }, }; this.onMapClick(e); diff --git a/src/views/xj/inspection/road-management/components/road-add.vue b/src/views/xj/inspection/road-management/components/road-add.vue index 4b8f2f4..85b39c6 100644 --- a/src/views/xj/inspection/road-management/components/road-add.vue +++ b/src/views/xj/inspection/road-management/components/road-add.vue @@ -156,7 +156,6 @@