From e90c2a5d98a7e93c0d0c0b150f787768ff657a1d Mon Sep 17 00:00:00 2001 From: zhaodengke Date: Thu, 3 Jul 2025 16:49:46 +0800 Subject: [PATCH 1/2] =?UTF-8?q?Task=20=E5=AE=9A=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/images/location/mark.png | Bin 0 -> 482 bytes src/components/Map/MapGisLine.vue | 61 +++++++++++++++++++++++- src/components/Map/MapGisTagDTGCopy.vue | 61 +++++++++++++++++++++++- 3 files changed, 118 insertions(+), 4 deletions(-) create mode 100644 src/assets/images/location/mark.png diff --git a/src/assets/images/location/mark.png b/src/assets/images/location/mark.png new file mode 100644 index 0000000000000000000000000000000000000000..782d405aaebfaa8619eee83932fbff08b8ae571e GIT binary patch literal 482 zcmV<80UiE{P)In|=CC66C0ctU6-ObF$ zw8Ed^U~9j(9+E&^Nrizxv5AC4LV;4LTP6|`2_3A2o;zdESXv216FhrgG(79h$Ju(o z*@>6qb7zH4KUN%vci3FOv2Z1USe1_c9*C8gNGMjNMM8gF>8K3QEA-$qodT*Gw=wBC z9OX0Y!=~**pqn0mx(otV^cZ3Z=qa6>!(acvBz=p+yi90MP-#I%zIEmA`rahawN*I@ zd%&zpiVL4LFqrfUk6?qtZGZ3Kt@S99hv2hV%xDP!yqVETuhj%BW+fpbqkvGfiX { + if (response.code == 200) { + let InsertCode = response.data; + if (InsertCode != null) { + var lat = InsertCode.lat; + var lng = InsertCode.lng; + if(lat !=null && lng !=null && lat !="" && lng !=""){ + callback(response); + return; + } + } + } + this.getCurrentLocation(callback); + }); + }, //地图查看 drawingPaceCountryLine() { //加载地图编辑 @@ -132,6 +148,45 @@ export default { //var hc_land; var draw; // global so we can remove it later var vector_drawing; + + var mark_layer = null; + function addMark(lng, lat) { + if(!mark_layer) + { + mark_layer = new ol.layer.Vector({ + source: new ol.source.Vector(), + }); + map.addLayer(mark_layer); + } + else + mark_layer.getSource().clear(); + + let newFeature = new ol.Feature({ + geometry: new ol.geom.Point(ol.proj.fromLonLat([lng, lat])), //几何信息 + //name: "标注点", + }); + newFeature.setStyle(new ol.style.Style({ + image: new ol.style.Icon({ + //设置图标偏移 + anchor: [0.5, 1], + //标注样式的起点位置 + anchorOrigin: "top-right", + //X方向单位:分数 + anchorXUnits: "fraction", + //Y方向单位:像素 + anchorYUnits: "fraction", + //偏移起点位置的方向 + offsetOrigin: "top-right", + //透明度 + opacity: 0.9, + //图片路径 + src: require('../../assets/images/location/mark.png'), + }), + zIndex: 9999, + })); + mark_layer.getSource().addFeature(newFeature); + } + if (that.message != null && that.message != "" && that.message != undefined) { document.getElementById(that.uuidMap).innerHTML = ''; @@ -359,6 +414,7 @@ export default { }else { Zb =[115.452752, 31.789033]; } + addMark(lng,lat); map.getView().animate({ // 只设置需要的属性即可 center: ol.proj.fromLonLat(Zb), // 中心点 @@ -398,7 +454,7 @@ export default { }); //获取坐标是否存在 var Zb; - this.getCurrentLocation((response) => { + this.getDeptLocation((response) => { if (response.code == 200) { let InsertCode = response.data; if (InsertCode != null) { @@ -524,6 +580,7 @@ export default { }else { Zb =[115.452752, 31.789033]; } + addMark(lng,lat); map.getView().animate({ // 只设置需要的属性即可 center: ol.proj.fromLonLat(Zb), // 中心点 diff --git a/src/components/Map/MapGisTagDTGCopy.vue b/src/components/Map/MapGisTagDTGCopy.vue index 6f2e7bf0..640e8784 100644 --- a/src/components/Map/MapGisTagDTGCopy.vue +++ b/src/components/Map/MapGisTagDTGCopy.vue @@ -111,7 +111,7 @@ console.log('定位失败: ' + error.message); getQueryLand().then(callback); }, - { enableHighAccuracy: true, timeout: 10000 } + { enableHighAccuracy: true, timeout: 5000 } ); return; } @@ -120,6 +120,22 @@ console.log('使用地区坐标定位'); getQueryLand().then(callback); }, + getDeptLocation(callback) { + getQueryLand().then((response) => { + if (response.code == 200) { + let InsertCode = response.data; + if (InsertCode != null) { + var lat = InsertCode.lat; + var lng = InsertCode.lng; + if(lat !=null && lng !=null && lat !="" && lng !=""){ + callback(response); + return; + } + } + } + this.getCurrentLocation(callback); + }); + }, //地图查看 pointPaceCountryDarw() { //加载地图编辑 @@ -128,6 +144,45 @@ //var hc_land; var draw; // global so we can remove it later var vector_drawing; + + var mark_layer = null; + function addMark(lng, lat) { + if(!mark_layer) + { + mark_layer = new ol.layer.Vector({ + source: new ol.source.Vector(), + }); + map.addLayer(mark_layer); + } + else + mark_layer.getSource().clear(); + + let newFeature = new ol.Feature({ + geometry: new ol.geom.Point(ol.proj.fromLonLat([lng, lat])), //几何信息 + //name: "标注点", + }); + newFeature.setStyle(new ol.style.Style({ + image: new ol.style.Icon({ + //设置图标偏移 + anchor: [0.5, 1], + //标注样式的起点位置 + anchorOrigin: "top-right", + //X方向单位:分数 + anchorXUnits: "fraction", + //Y方向单位:像素 + anchorYUnits: "fraction", + //偏移起点位置的方向 + offsetOrigin: "top-right", + //透明度 + opacity: 0.9, + //图片路径 + src: require('../../assets/images/location/mark.png'), + }), + zIndex: 9999, + })); + mark_layer.getSource().addFeature(newFeature); + } + //矢量标注样式设置函数,设置image为图标ol.style.Icon function createLabelStyle() { return new ol.style.Style({ @@ -399,6 +454,7 @@ }else { Zb =[115.452752, 31.789033]; } + addMark(lng,lat); map.getView().animate({ // 只设置需要的属性即可 center: ol.proj.fromLonLat(Zb), // 中心点 @@ -440,7 +496,7 @@ //获取坐标是否存在 var Zb; //开始定位当前位置 - this.getCurrentLocation(res => { + this.getDeptLocation(res => { if (res.code == 200) { let lat = res.data.lat; let lng = res.data.lng; @@ -601,6 +657,7 @@ }else { Zb =[115.452752, 31.789033]; } + addMark(lng,lat); map.getView().animate({ // 只设置需要的属性即可 center: ol.proj.fromLonLat(Zb), // 中心点 From 531503783b0b5d9a83b9c8a1aa16bd3deb50eac1 Mon Sep 17 00:00:00 2001 From: zhaodengke Date: Fri, 4 Jul 2025 16:42:19 +0800 Subject: [PATCH 2/2] =?UTF-8?q?Task=20=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Map/MapGisLine.vue | 2 +- src/components/Map/MapGisTagDTGCopy.vue | 2 +- src/views/sunVillage_info/fixedAssets.vue | 42 ++++++++++++++++++++--- src/views/sunVillage_info/resource.vue | 42 +++++++++++++++++++---- src/views/sunVillage_info/three.vue | 42 +++++++++++++++++++---- 5 files changed, 111 insertions(+), 19 deletions(-) diff --git a/src/components/Map/MapGisLine.vue b/src/components/Map/MapGisLine.vue index 2739d302..04d74b8c 100644 --- a/src/components/Map/MapGisLine.vue +++ b/src/components/Map/MapGisLine.vue @@ -168,7 +168,7 @@ export default { newFeature.setStyle(new ol.style.Style({ image: new ol.style.Icon({ //设置图标偏移 - anchor: [0.5, 1], + anchor: [0.5, 0.5], //标注样式的起点位置 anchorOrigin: "top-right", //X方向单位:分数 diff --git a/src/components/Map/MapGisTagDTGCopy.vue b/src/components/Map/MapGisTagDTGCopy.vue index 640e8784..7b504b70 100644 --- a/src/components/Map/MapGisTagDTGCopy.vue +++ b/src/components/Map/MapGisTagDTGCopy.vue @@ -164,7 +164,7 @@ newFeature.setStyle(new ol.style.Style({ image: new ol.style.Icon({ //设置图标偏移 - anchor: [0.5, 1], + anchor: [0.5, 0.5], //标注样式的起点位置 anchorOrigin: "top-right", //X方向单位:分数 diff --git a/src/views/sunVillage_info/fixedAssets.vue b/src/views/sunVillage_info/fixedAssets.vue index ee13bfd5..bfb4f1b3 100644 --- a/src/views/sunVillage_info/fixedAssets.vue +++ b/src/views/sunVillage_info/fixedAssets.vue @@ -9,11 +9,8 @@
- - - + +
共{{listLength}}个资产
@@ -74,6 +71,34 @@ + +
+ + +
筛选
+
+ + 未上图 + + + 无附件 + + +
+
+ 搜索 +
+
+
+