From 70e16a5d80a996fccfc4eecf540711366f9d12ac Mon Sep 17 00:00:00 2001 From: yuzongping <835949940@qq.com> Date: Tue, 17 Jun 2025 14:13:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E4=BA=A7=E5=9B=BE=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/property/main-gis/icon/zc_icon.png | Bin 3866 -> 0 bytes .../property/main-gis/icon/组 4665@2x(1).png | Bin 0 -> 485 bytes .../property/main-gis/icon/组 4665@2x(2).png | Bin 0 -> 495 bytes .../property/main-gis/icon/组 4665@2x(3).png | Bin 0 -> 466 bytes .../property/main-gis/icon/组 4665@2x.png | Bin 0 -> 505 bytes src/views/property/main-gis/index.html | 2 +- src/views/property/main-gis/index.js | 43 +++---- src/views/property/main-gis/index.scss | 3 - src/views/resources/main-gis/index.html | 4 +- src/views/resources/main-gis/index.js | 121 +++++++++--------- 10 files changed, 83 insertions(+), 90 deletions(-) delete mode 100644 src/views/property/main-gis/icon/zc_icon.png create mode 100644 src/views/property/main-gis/icon/组 4665@2x(1).png create mode 100644 src/views/property/main-gis/icon/组 4665@2x(2).png create mode 100644 src/views/property/main-gis/icon/组 4665@2x(3).png create mode 100644 src/views/property/main-gis/icon/组 4665@2x.png diff --git a/src/views/property/main-gis/icon/zc_icon.png b/src/views/property/main-gis/icon/zc_icon.png deleted file mode 100644 index ebc48c957561f180aaef08f10e8f7b0bf4320692..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3866 zcmV+#59RQQP)XEnf|)_KIfI02?+^;5MGLkxS}W+QP9#|)Ga_Mpi10TDYsB@)h)GL%3UqQLPf-_ zEh6qJTZpUp*p){WMif{jEVYCf1Otjj$b%%4Fq3)QSKoeYou2Q%eAD-4GLwv+s;=(a z-E;c?{`dc%GhQ7Z!4ixD01rT$Qx)afMgXA1`|f#zXLr>3Jmy^PoE{EYg{43Rz$Y;v zzz9Hv_e0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1gKB^JPE)~YE+^F(udExjPnu0_sitd^ zM9dl1;fVBk*k_bb@ZVT*Iaau%PnQYuvM3N$SzPmKZr^9gFeB(-9k zYG~z?0ZAkY)+D|&@)CpCSDcfYFDn`o{OB03Cur=MmyE7npAmepkv_FoUHdl1tTAfA zjKrtC{I+?&{o=)YF0%Im76}K;BQ+%psZ*++IFfz5ey{^>-2+H}J2o#g=WvqQPOr1k zd#Qd+sV4SOJwqNQ9qXoPkvwPQRWT3R7bjx1knOm!%s{+2rMt=wG{Y zwC;f;6?Yv_lz-*$T?6R4b zT{*fZsx0xwqiVVHiOxx+duFoT0$e=5o8GP|_S2MPphn5r76%9RfHsvM3*FY|Qx&XE ztI8fH3z`GW3T&mO!NT+oE*zYdY}g9sm$#5m>+ViSay>2STSFve&D`ifo>0d^fhF<* z^Nd5{f*}dBr8;dA=9qCK0gdw9lCIKBF5zwpv#OHaJ8h_o$}b5pJI+T>rEL%|yzJ5i+4Bdog?g97%pUAyV;WYf*W= zK)h7IAY00H^GlzsjOym(rmSfG_}Y1CkJLDk}U~Vj9Lq9L>xdU zi*$Wb@<4#4;?7O2%VLv@{^x?j{f7b#*tS+3QjI#z%bXK2J84NNZ=0KSTZ1iW9nybH z94;^;vYrdp4M~p84vW(1vc)wkjXYU3v4EWahk`#VFdIf_Q(SaQ`Vyh^EcGnh+d;tJ$5Lgos&*mf_fshljdSsD(*iO?{`?B+*m4!xzUT5e8Or;v;LEhrALPi crZWKiKel8X(h#KCSO5S307*qoM6N<$f<|A3xBvhE diff --git a/src/views/property/main-gis/icon/组 4665@2x(1).png b/src/views/property/main-gis/icon/组 4665@2x(1).png new file mode 100644 index 0000000000000000000000000000000000000000..49f3cd872322c4167cfc832ba3f77ef84d81de6c GIT binary patch literal 485 zcmVPx$pGibPR5(wKlD}&dVGxF&cX#h@F9wSXm$Og^0e>~Av=gzhu?UEjRXV}KRM%+Z zAzB4NY%DAUMQr>7EJTrz#=<5=h*2a&jcZ7e3%9pxayPOId)aJ`km+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aAz$#**!!dTYuSPLHGp%!Z2%TVNL1plmO@3%kj?isp;KAR?mB~sS_y88xtt=E& zwX9uF-~ivpCs(^ff$mn#y?+;gknTzhoD2U{f5piJyH1g&?%gliO@mpFP@mDf_v$5jKCAV}T{ z6MxNx?kY7Fwr;-MRb}GTNknY30P<-VmOq|lUT(9nc^wZe
-
+

{{item.name}}

diff --git a/src/views/property/main-gis/index.js b/src/views/property/main-gis/index.js index e6079e9..15fc0a4 100644 --- a/src/views/property/main-gis/index.js +++ b/src/views/property/main-gis/index.js @@ -8,6 +8,13 @@ import { getResourceListByDeptId, listResource } from "@/api/asset/resource.js"; import { attachmentList } from "@/api/common/uploadAttachment.js"; let gis = null; import Legend from '@/components/legend/index.vue'; + +const iconMap = { + '1': require('./icon/组 4665@2x.png'), // 自用 + '2': require('./icon/组 4665@2x(1).png'), // 闲置 + '3': require('./icon/组 4665@2x(2).png'), // 出租或出借 + '4': require('./icon/组 4665@2x(3).png') // 其他 +} export default { components: { Legend @@ -16,31 +23,19 @@ export default { return { LegendData: [ { - iconStyle: { - background: 'rgba(38,252,128,0.45)', - border: '2px solid #26FC80' - }, + icon: require('./icon/组 4665@2x.png'), name: '自用' }, { - iconStyle: { - background: 'rgba(232,246,0,0.45)', - border: '2px solid #E8F600' - }, + icon: require('./icon/组 4665@2x(1).png'), name: '闲置' }, { - iconStyle: { - background: 'rgba(16,252,252,0.45)', - border: '2px solid #10FCFC' - }, + icon: require('./icon/组 4665@2x(2).png'), name: '出租' }, { - iconStyle: { - background: 'rgba(198,0,255,0.45)', - border: '2px solid #C600FF' - }, + icon: require('./icon/组 4665@2x(3).png'), name: '其他' } ], @@ -53,7 +48,6 @@ export default { checkStrictly: true, }, yellowIcon: require('./icon/yellow.png'), - zcIcon: require('./icon/zc_icon.png'), mapGeoServerUrl: "", villageBorderLayerName: "", headerTitle: '', @@ -321,7 +315,7 @@ export default { this.addDeptLayer(deptList, 'yellow.png'); gis.getMapContainer().getView().animate({ // 只设置需要的属性即可 - center: ol.proj.fromLonLat([dept.lng, dept.lat]), // 中心点 + center: fromLonLat([dept.lng, dept.lat]), // 中心点 duration: 500, // 缩放持续时间,默认不需要设置 }); }, @@ -344,7 +338,10 @@ export default { let features = []; permanentList.forEach(item => { if (item.theGeom != null && item.theGeom !== '') { - let fs = gis.getFeature2(item, this.zcIcon) + // console.log(222, useType, item); + const { useType } = item + let icon = iconMap[useType + ''] + let fs = gis.getFeature2(item, icon) features.push(fs); } }); @@ -370,8 +367,6 @@ export default { let fs = gis.getFeature(item, this.yellowIcon) features.push(fs); }); - - gis.getVectorLayerByFs(features) gis.mapSetFit(features) }, @@ -531,8 +526,6 @@ export default { this.addDeptLayer(deptList); // // 获取资产列表 this.getPermanentList(deptId); - // // 获取资源列表 - this.getResourceList(deptId); var that = this; //点击查询详细信息 @@ -543,7 +536,6 @@ export default { ); if (feature) { var ifConsole = feature.values_.level; - console.log(ifConsole); if (ifConsole == "permanent") { that.listDialogHidden('detail'); that.openPermanentDialog(feature.values_.detail); @@ -571,10 +563,7 @@ export default { let fs = gis.getFeature3(item) features.push(fs); } - }); - - gis.getVectorLayerByFs(features) gis.mapSetFit(features) }, diff --git a/src/views/property/main-gis/index.scss b/src/views/property/main-gis/index.scss index d8e9c7d..7b84e3d 100644 --- a/src/views/property/main-gis/index.scss +++ b/src/views/property/main-gis/index.scss @@ -24,9 +24,6 @@ align-items: center; .icon { - width: 16px; - height: 16px; - border-radius: 50%; margin-right: 10px; } } diff --git a/src/views/resources/main-gis/index.html b/src/views/resources/main-gis/index.html index 4daf291..b876b7b 100644 --- a/src/views/resources/main-gis/index.html +++ b/src/views/resources/main-gis/index.html @@ -9,7 +9,7 @@
- + diff --git a/src/views/resources/main-gis/index.js b/src/views/resources/main-gis/index.js index b89498b..cedbe57 100644 --- a/src/views/resources/main-gis/index.js +++ b/src/views/resources/main-gis/index.js @@ -4,7 +4,7 @@ import { fromLonLat } from 'ol/proj' import { getUserGeo, getUserGeoList } from "@/api/dataScreen/stockCooperative/index.js"; - +import { getInfo } from "@/api/login"; import { getResourceListByDeptId, listResource } from "@/api/asset/resource.js"; import Legend from '@/components/legend/index.vue'; let gis = null; @@ -51,72 +51,78 @@ export default { created () { }, mounted () { - this.initMap(); + getInfo().then(res => { + this.initMap(res.user.loginDeptId); + // 加载地图 + }) + }, methods: { // 加载地图 - initMap () { + initMap (deptId) { gis = new GisUtils('map2') gis.addTianDiTuLayer() gis.addAnnotationLayer() const initZoom = 11; + // // 获取资源列表 + this.getResourceList(deptId); //初始加载当前用户级别的geojson数据 - getUserGeo().then((res) => { - if (res.code == 200) { - // 存在geojson数据,加载边界图层,定位到当前位置 - if (res.data.geoJson != null && res.data.geoJson != "") { - // 解析geojson数据,添加轮廓图层 - require(["@/assets/maps/" + res.data.geoJson], (data) => { + // getUserGeo().then((res) => { + // if (res.code == 200) { + // // 存在geojson数据,加载边界图层,定位到当前位置 + // if (res.data.geoJson != null && res.data.geoJson != "") { + // // 解析geojson数据,添加轮廓图层 + // require(["@/assets/maps/" + res.data.geoJson], (data) => { - this.map.addLayer(boundaryLayer); + // this.map.addLayer(boundaryLayer); - //定位查询位置 - const maxXMap = boundaryLayer.values_.source.featuresRtree_.rbush_.data.maxX; - const maxYMap = boundaryLayer.values_.source.featuresRtree_.rbush_.data.maxY; - const minXMap = boundaryLayer.values_.source.featuresRtree_.rbush_.data.minX; - const minYMap = boundaryLayer.values_.source.featuresRtree_.rbush_.data.minY; - //获取边界区域的中心位置 - const center = ol.extent.getCenter([maxXMap, maxYMap, minXMap, minYMap]); - this.map.getView().animate({ - // 只设置需要的属性即可 - center: center, // 中心点 - zoom: initZoom, // 缩放级别 - rotation: undefined, // 缩放完成view视图旋转弧度 - duration: 1000, // 缩放持续时间,默认不需要设置 - }); - }); - } else { // 不存在geojson数据,直接定位到当前位置 - gis.getMapContainer().getView().animate({ - // 只设置需要的属性即可 - center: fromLonLat([res.data.lng, res.data.lat]), // 中心点 - zoom: initZoom, // 缩放级别 - rotation: undefined, // 缩放完成view视图旋转弧度 - duration: 1000, // 缩放持续时间,默认不需要设置 - }); - } - //村级组级只定位坐标点 deptLevel: 1 组级、2 村级、3 乡镇级、4 区县级 - if (res.data.deptLevel === '3' || res.data.deptLevel === '4') { - let locationIcon; - if (res.data.deptLevel === '3') { - locationIcon = "red.png"; - } else if (res.data.deptLevel === '4') { - locationIcon = "yellow.png"; - } - //获取用户级别的下级区域 - setTimeout(() => { - getUserGeoList(res.data.deptId).then((res) => { - if (res.code == 200) { - this.addDeptLayer(res.data, require(`./icon/${locationIcon}`)) - } - }); - }, 500); - } else { - let lowestOrder = []; - lowestOrder.push(res.data); - this.addDeptLayer(lowestOrder, require('./icon/green.png')); - } - } - }); + // //定位查询位置 + // const maxXMap = boundaryLayer.values_.source.featuresRtree_.rbush_.data.maxX; + // const maxYMap = boundaryLayer.values_.source.featuresRtree_.rbush_.data.maxY; + // const minXMap = boundaryLayer.values_.source.featuresRtree_.rbush_.data.minX; + // const minYMap = boundaryLayer.values_.source.featuresRtree_.rbush_.data.minY; + // //获取边界区域的中心位置 + // const center = ol.extent.getCenter([maxXMap, maxYMap, minXMap, minYMap]); + // this.map.getView().animate({ + // // 只设置需要的属性即可 + // center: center, // 中心点 + // zoom: initZoom, // 缩放级别 + // rotation: undefined, // 缩放完成view视图旋转弧度 + // duration: 1000, // 缩放持续时间,默认不需要设置 + // }); + // }); + // } else { // 不存在geojson数据,直接定位到当前位置 + // gis.getMapContainer().getView().animate({ + // // 只设置需要的属性即可 + // center: fromLonLat([res.data.lng, res.data.lat]), // 中心点 + // zoom: initZoom, // 缩放级别 + // rotation: undefined, // 缩放完成view视图旋转弧度 + // duration: 1000, // 缩放持续时间,默认不需要设置 + // }); + // } + // //村级组级只定位坐标点 deptLevel: 1 组级、2 村级、3 乡镇级、4 区县级 + // if (res.data.deptLevel === '3' || res.data.deptLevel === '4') { + // let locationIcon; + // if (res.data.deptLevel === '3') { + // locationIcon = "red.png"; + // } else if (res.data.deptLevel === '4') { + // locationIcon = "yellow.png"; + // } + // //获取用户级别的下级区域 + // setTimeout(() => { + // getUserGeoList(res.data.deptId).then((res) => { + // if (res.code == 200) { + // this.addDeptLayer(res.data, require(`./icon/${locationIcon}`)) + // } + // }); + // }, 500); + // } else { + // let lowestOrder = []; + // lowestOrder.push(res.data); + // this.addDeptLayer(lowestOrder, require('./icon/green.png')); + // } + // } + // }); gis.getMapContainer().on("click", (evt) => { let feature = gis.getMapContainer().forEachFeatureAtPixel( @@ -169,6 +175,7 @@ export default { // 获取资源列表 getResourceList (deptId) { getResourceListByDeptId(deptId).then(response => { + console.log(22222, response); if (response.data && response.data.length > 0) { this.addResourceLayer(response.data); }