| @@ -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); | |||