From 3bee63a68b8e10dde8e082c5e63a6d4b4cdbf320 Mon Sep 17 00:00:00 2001 From: QI_YUJIE <2878090898@qq.com> Date: Sun, 23 Apr 2023 17:36:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=A4=E6=B8=85=E4=B8=89=E5=8C=96=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=AB=AF=E5=9C=B0=E5=9B=BE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/plotPremisesMobile/index.vue | 38 +++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/views/plotPremisesMobile/index.vue b/src/views/plotPremisesMobile/index.vue index c8fcf0ce..cb6592b3 100644 --- a/src/views/plotPremisesMobile/index.vue +++ b/src/views/plotPremisesMobile/index.vue @@ -219,7 +219,7 @@ export default { cityId: null, // 记录市的deptId countyId: null, // 记录区县的deptId townId: null, // 记录乡镇的deptId - deptPointLevel: null, // 地图上显示的坐标点级别 + currentDeptLevel: null, // 当前所处的部门级别 mapGeoServerUrl: "", // 加载geoserver地址 countyBorderLayerName: "", // 区县边界图层名称 @@ -338,14 +338,14 @@ export default { // 登录身份为市级领导 this.userRole = 'cityLeader'; this.cityId = dept.id; - this.deptPointLevel = '4'; + this.currentDeptLevel = '5'; // 添加区县边界 this.addCountyBorder(); } else if (dept.deptLevel === '4') { // 登录身份为县级领导 this.userRole = 'countyLeader'; this.countyId = dept.id; - this.deptPointLevel = '3'; + this.currentDeptLevel = '4'; // 添加乡镇边界 this.addTownBorder(dept.id); this.map.getView().setZoom(10.5); @@ -354,7 +354,7 @@ export default { // // 登录身份为镇级领导 // this.userRole = 'townLeader'; // this.townId = dept.id; - // this.deptPointLevel = '2'; + // this.currentDeptLevel = '3'; // // 添加村边界 // this.addVillageBorder(dept.id); // this.map.getView().setZoom(12.5); @@ -378,7 +378,7 @@ export default { if (deptLevel === '4' || deptLevel === '3') { if (deptLevel === '4') { this.countyId = deptId; - this.deptPointLevel = '3'; + this.currentDeptLevel = '4'; this.map.removeLayer(this.borderLayer); this.borderLayer = ''; // 添加乡镇边界 @@ -391,7 +391,7 @@ export default { }); } else if (deptLevel === '3') { this.townId = deptId; - this.deptPointLevel = '2'; + this.currentDeptLevel = '3'; this.map.removeLayer(this.borderLayer); this.borderLayer = ''; // 添加村边界 @@ -411,6 +411,7 @@ export default { this.addDeptLayer(deptNode.children); } } else if (deptLevel === '2') { + this.currentDeptLevel = '2'; this.map.removeLayer(this.borderLayer); this.borderLayer = ''; // 添加村边界 @@ -422,9 +423,8 @@ export default { label: feature.get('deptName'), lng: lng, lat: lat, - deptLevel: '-1', // -1代表最末级的坐标点 + deptLevel: deptLevel, }; - this.deptPointLevel = '-1'; // -1代表最末级的坐标点 let depts = []; depts.push(villagePoint); this.map.removeLayer(this.deptLayer); @@ -432,7 +432,7 @@ export default { this.addDeptLayer(depts); this.map.getView().animate({ center: ol.proj.fromLonLat([lng, lat]), // 中心点 - zoom: 16, // 缩放级别 + zoom: 17, // 缩放级别 rotation: undefined, // 缩放完成view视图旋转弧度 duration: 1000, // 缩放持续时间,默认不需要设置 }); @@ -445,8 +445,8 @@ export default { this.map.on("moveend", (evt) => { const zoom = this.map.getView().getZoom(); if (this.userRole === 'cityLeader') { - if (this.deptPointLevel === '-1' && zoom < 13) { - this.deptPointLevel = '2'; + if (this.currentDeptLevel === '2' && zoom < 13) { + this.currentDeptLevel = '3'; this.map.removeLayer(this.borderLayer); this.borderLayer = ""; const cqlFilter = "parent_id = '" + this.townId + "'"; @@ -458,8 +458,8 @@ export default { if (deptNode && deptNode.children) { this.addDeptLayer(deptNode.children); } - } else if (this.deptPointLevel === '2' && zoom < 11) { - this.deptPointLevel = '3'; + } else if (this.currentDeptLevel === '3' && zoom < 11) { + this.currentDeptLevel = '4'; this.map.removeLayer(this.borderLayer); this.borderLayer = ""; this.addTownBorder(this.countyId); @@ -470,8 +470,8 @@ export default { if (deptNode && deptNode.children) { this.addDeptLayer(deptNode.children); } - } else if (this.deptPointLevel === '3' && zoom < 9.5) { - this.deptPointLevel = '4'; + } else if (this.currentDeptLevel === '4' && zoom < 9.5) { + this.currentDeptLevel = '5'; this.map.removeLayer(this.borderLayer); this.borderLayer = ""; this.addCountyBorder(); @@ -484,8 +484,8 @@ export default { } } } else if (this.userRole === 'countyLeader') { - if (this.deptPointLevel === '-1' && zoom < 13) { - this.deptPointLevel = '2'; + if (this.currentDeptLevel === '2' && zoom < 13) { + this.currentDeptLevel = '3'; this.map.removeLayer(this.borderLayer); this.borderLayer = ""; const cqlFilter = "parent_id = '" + this.townId + "'"; @@ -497,8 +497,8 @@ export default { if (deptNode && deptNode.children) { this.addDeptLayer(deptNode.children); } - } else if (this.deptPointLevel === '2' && zoom < 11) { - this.deptPointLevel = '3'; + } else if (this.currentDeptLevel === '3' && zoom < 11) { + this.currentDeptLevel = '4'; this.map.removeLayer(this.borderLayer); this.borderLayer = ""; this.addTownBorder(this.countyId);