|
|
@@ -7,8 +7,11 @@ import { getPermanentListByDeptId, listPermanent } from "@/api/asset/permanent.j |
|
|
|
import { getResourceListByDeptId, listResource } from "@/api/asset/resource.js"; |
|
|
|
import { attachmentList } from "@/api/common/uploadAttachment.js"; |
|
|
|
let gis = null; |
|
|
|
import { treeselectByDeptId } from "@/api/system/dept"; |
|
|
|
import Legend from '@/components/legend/index.vue'; |
|
|
|
|
|
|
|
import { |
|
|
|
fromLonLat |
|
|
|
} from 'ol/proj' |
|
|
|
const iconMap = { |
|
|
|
'1': require('./icon/组 4665@2x.png'), // 自用 |
|
|
|
'2': require('./icon/组 4665@2x(1).png'), // 闲置 |
|
|
@@ -22,6 +25,11 @@ export default { |
|
|
|
data () { |
|
|
|
return { |
|
|
|
showPermanentDetail: false, |
|
|
|
deptLayer: "", // 坐标点图层 |
|
|
|
countyBorderLayerName: "", // 区县边界图层名称 |
|
|
|
townBorderLayerName: "", // 乡镇边界图层名称 |
|
|
|
villageBorderLayerName: "", // 村边界图层名称 |
|
|
|
groupBorderLayerName: "", // 组边界图层名称 |
|
|
|
LegendData: [ |
|
|
|
{ |
|
|
|
icon: require('./icon/组 4665@2x.png'), |
|
|
@@ -217,6 +225,8 @@ export default { |
|
|
|
computed: { |
|
|
|
}, |
|
|
|
created () { |
|
|
|
// 获取geoserver的地址 |
|
|
|
this.getGeoServerUrl(); |
|
|
|
}, |
|
|
|
mounted () { |
|
|
|
treeselect().then((resp) => this.addrOptions = resp.data); |
|
|
@@ -230,32 +240,35 @@ export default { |
|
|
|
this.resourceTypeOptions = response.data; |
|
|
|
}); |
|
|
|
getInfo().then(res => { |
|
|
|
this.headerTitle = res.user.deptName + '阳光村务一张图'; |
|
|
|
listDeptExcludeChild(res.user.loginDeptId).then((resp) => { |
|
|
|
let deptOptions = [res.user.loginDeptId]; |
|
|
|
resp.data.map(resm => { |
|
|
|
if (res.user.parentDeptName == resm.deptName) { |
|
|
|
deptOptions.unshift(resm.deptId) |
|
|
|
deptOptions.unshift(resm.parentId) |
|
|
|
} |
|
|
|
}) |
|
|
|
this.addrText = deptOptions; |
|
|
|
treeselectByDeptId({ deptId: res.user.deptId }).then((resp) => { |
|
|
|
this.addrOptions = resp.data; |
|
|
|
this.headerTitle = res.user.deptName + '阳光村务一张图'; |
|
|
|
listDeptExcludeChild(res.user.loginDeptId).then((resp) => { |
|
|
|
let deptOptions = [res.user.loginDeptId]; |
|
|
|
resp.data.map(resm => { |
|
|
|
if (res.user.parentDeptName == resm.deptName) { |
|
|
|
deptOptions.unshift(resm.deptId) |
|
|
|
deptOptions.unshift(resm.parentId) |
|
|
|
} |
|
|
|
}) |
|
|
|
this.addrText = deptOptions; |
|
|
|
}); |
|
|
|
this.queryParams.deptId = res.user.loginDeptId; |
|
|
|
this.tempWorkerOpenQueryParams.deptId = res.user.loginDeptId; |
|
|
|
this.majorEventOpenQueryParams.deptId = res.user.loginDeptId; |
|
|
|
this.subsidyFundsQueryParams.deptId = res.user.loginDeptId; |
|
|
|
this.permanentQueryParams.deptId = res.user.loginDeptId; |
|
|
|
this.resourceListQueryParams.deptId = res.user.loginDeptId; |
|
|
|
this.contractionByPermanentQueryParams.deptId = res.user.loginDeptId; |
|
|
|
//列表请求 |
|
|
|
this.getAllList(); |
|
|
|
// 加载地图 |
|
|
|
this.initMap(res.user.loginDeptId); |
|
|
|
|
|
|
|
// 获取村边界的图层名称 |
|
|
|
this.getVillageBorderLayerName(); |
|
|
|
}); |
|
|
|
this.queryParams.deptId = res.user.loginDeptId; |
|
|
|
this.tempWorkerOpenQueryParams.deptId = res.user.loginDeptId; |
|
|
|
this.majorEventOpenQueryParams.deptId = res.user.loginDeptId; |
|
|
|
this.subsidyFundsQueryParams.deptId = res.user.loginDeptId; |
|
|
|
this.permanentQueryParams.deptId = res.user.loginDeptId; |
|
|
|
this.resourceListQueryParams.deptId = res.user.loginDeptId; |
|
|
|
this.contractionByPermanentQueryParams.deptId = res.user.loginDeptId; |
|
|
|
//列表请求 |
|
|
|
this.getAllList(); |
|
|
|
// 加载地图 |
|
|
|
this.initMap(res.user.loginDeptId); |
|
|
|
// 获取geoserver的地址 |
|
|
|
this.getGeoServerUrl(); |
|
|
|
// 获取村边界的图层名称 |
|
|
|
this.getVillageBorderLayerName(); |
|
|
|
|
|
|
|
}) |
|
|
|
}, |
|
|
|
methods: { |
|
|
@@ -263,7 +276,98 @@ export default { |
|
|
|
this.dialogImageUrl = url; |
|
|
|
this.dialogVisible = true; |
|
|
|
}, |
|
|
|
selectAddress (value) { |
|
|
|
// 绘制地图 |
|
|
|
drawMap (node, isLocated) { // isLocated 控制地图是否跳转 |
|
|
|
const dept = node.data; |
|
|
|
gis.getMapContainer().removeLayer(this.mapBorder); |
|
|
|
this.mapBorder = ''; |
|
|
|
gis.getMapContainer().removeLayer(this.deptLayer); |
|
|
|
this.deptLayer = ''; |
|
|
|
if (dept.deptLevel === '5') { |
|
|
|
this.cityId = dept.id; |
|
|
|
this.currentDeptLevel = '5'; |
|
|
|
if (dept.children && dept.children.length > 0) { |
|
|
|
// 添加区县边界 |
|
|
|
this.addCountyBorder(dept.children.map(item => item.id)); |
|
|
|
// 添加坐标点图层 |
|
|
|
this.addDeptLayer(dept.children, 'yellow.png'); |
|
|
|
} |
|
|
|
if (isLocated) { |
|
|
|
gis.getMapContainer().getView().setZoom(9); |
|
|
|
gis.getMapContainer().getView().setCenter(fromLonLat([dept.lng, dept.lat])); |
|
|
|
} |
|
|
|
} else if (dept.deptLevel === '4') { |
|
|
|
this.countyId = dept.id; |
|
|
|
this.currentDeptLevel = '4'; |
|
|
|
if (dept.children && dept.children.length > 0) { |
|
|
|
// 添加乡镇边界 |
|
|
|
this.addTownBorder(dept.children.map(item => item.id)); |
|
|
|
// 添加坐标点图层 |
|
|
|
this.addDeptLayer(dept.children, 'yellow.png'); |
|
|
|
} |
|
|
|
if (isLocated) { |
|
|
|
gis.getMapContainer().getView().setZoom(11); |
|
|
|
gis.getMapContainer().getView().setCenter(fromLonLat([dept.lng, dept.lat])); |
|
|
|
} |
|
|
|
// this.villageIds = this.findLeafNodeIds(dept); |
|
|
|
} else if (dept.deptLevel === '3') { |
|
|
|
this.townId = dept.id; |
|
|
|
this.countyId = node.path.slice(-2)[0]; |
|
|
|
this.currentDeptLevel = '3'; |
|
|
|
if (dept.children && dept.children.length > 0) { |
|
|
|
// 添加村边界 |
|
|
|
this.addVillageBorder(dept.children.map(item => item.id)); |
|
|
|
// 添加坐标点图层 |
|
|
|
this.addDeptLayer(dept.children, 'yellow.png'); |
|
|
|
} |
|
|
|
if (isLocated) { |
|
|
|
gis.getMapContainer().getView().setZoom(13); |
|
|
|
gis.getMapContainer().getView().setCenter(fromLonLat([dept.lng, dept.lat])); |
|
|
|
} |
|
|
|
// this.villageIds = this.findLeafNodeIds(dept); |
|
|
|
} else if (dept.deptLevel === '2') { |
|
|
|
this.ruralId = dept.id; |
|
|
|
this.townId = node.path.slice(-2)[0]; |
|
|
|
this.countyId = node.path.slice(-3)[0]; |
|
|
|
this.currentDeptLevel = '2'; |
|
|
|
if (dept.children && dept.children.length > 0) { |
|
|
|
const groupIds = dept.children.map(item => item.id); |
|
|
|
// 添加组边界 |
|
|
|
this.addGroupBorder(groupIds); |
|
|
|
// 添加组的坐标点图层,并且跳转到图层的中心点位置 |
|
|
|
this.addGroupPointLayer(groupIds, isLocated); |
|
|
|
} else { |
|
|
|
// 添加村边界 |
|
|
|
this.addVillageBorder(dept.id); |
|
|
|
// 添加坐标点图层 |
|
|
|
let deptList = []; |
|
|
|
deptList.push(dept); |
|
|
|
// this.addDeptLayer(deptList, 'yellow.png'); |
|
|
|
if (isLocated) { |
|
|
|
gis.getMapContainer().getView().setCenter(fromLonLat([dept.lng, dept.lat])); |
|
|
|
} |
|
|
|
} |
|
|
|
if (isLocated) { |
|
|
|
gis.getMapContainer().getView().setZoom(15); |
|
|
|
} |
|
|
|
// this.villageIds = this.findLeafNodeIds(dept); |
|
|
|
} else if (dept.deptLevel === '1') { |
|
|
|
this.ruralId = node.path.slice(-2)[0]; |
|
|
|
this.townId = node.path.slice(-3)[0]; |
|
|
|
this.countyId = node.path.slice(-4)[0]; |
|
|
|
this.currentDeptLevel = '1'; |
|
|
|
// 添加组边界 |
|
|
|
this.addGroupBorder(dept.id); |
|
|
|
// 添加组的坐标点图层,并且跳转到图层的中心点位置 |
|
|
|
this.addGroupPointLayer(dept.id, isLocated); |
|
|
|
if (isLocated) { |
|
|
|
gis.getMapContainer().getView().setZoom(17); |
|
|
|
} |
|
|
|
// this.villageIds = this.findLeafNodeIds(dept); |
|
|
|
} |
|
|
|
// this.changeLayerByDept(); |
|
|
|
}, |
|
|
|
selectAddress (value, isLocated = true) { |
|
|
|
const deptId = value[value.length - 1]; |
|
|
|
this.queryParams.deptId = deptId; |
|
|
|
this.tempWorkerOpenQueryParams.deptId = deptId; |
|
|
@@ -301,6 +405,7 @@ export default { |
|
|
|
// 获取资源列表 |
|
|
|
this.getResourceList(deptId); |
|
|
|
let node = this.$refs["cascader"].panel.getNodeByValue(value); |
|
|
|
this.drawMap(node, isLocated); |
|
|
|
const dept = node.data; |
|
|
|
const deptData = { |
|
|
|
deptId: dept.id, |
|
|
@@ -359,9 +464,26 @@ export default { |
|
|
|
}, |
|
|
|
// 获取geoserver的地址 |
|
|
|
getGeoServerUrl () { |
|
|
|
// 获取geoserver的地址 |
|
|
|
getConfigKey("system.geoServer.url").then(response => { |
|
|
|
this.mapGeoServerUrl = response.msg; |
|
|
|
}); |
|
|
|
// 获取区县边界图层名称 |
|
|
|
getConfigKey("geoserver.layer.countyBorder").then(response => { |
|
|
|
this.countyBorderLayerName = response.msg; |
|
|
|
}); |
|
|
|
// 获取乡镇边界的图层名称 |
|
|
|
getConfigKey("geoserver.layer.townBorder").then(response => { |
|
|
|
this.townBorderLayerName = response.msg; |
|
|
|
}); |
|
|
|
// 获取村边界的图层名称 |
|
|
|
getConfigKey("geoserver.layer.villageBorder").then(response => { |
|
|
|
this.villageBorderLayerName = response.msg; |
|
|
|
}); |
|
|
|
// 获取组边界的图层名称 |
|
|
|
getConfigKey("geoserver.layer.groupBorder").then(response => { |
|
|
|
this.groupBorderLayerName = response.msg; |
|
|
|
}); |
|
|
|
}, |
|
|
|
// 创建矢量数据源 |
|
|
|
addDeptLayer (nextDeptSet) { |
|
|
@@ -468,6 +590,7 @@ export default { |
|
|
|
initMap (deptId) { |
|
|
|
getDept(deptId).then(response => { |
|
|
|
const dept = response.data; |
|
|
|
|
|
|
|
let mapCenterLocation; |
|
|
|
// 定义地图中心坐标 |
|
|
|
if (dept.lng && dept.lat) { |
|
|
@@ -487,6 +610,35 @@ export default { |
|
|
|
// // 获取资产列表 |
|
|
|
this.getPermanentList(deptId); |
|
|
|
|
|
|
|
let dept2 = this.addrOptions[0]; |
|
|
|
if (dept2.deptLevel === '5') { |
|
|
|
// 登录身份为市级领导 |
|
|
|
this.userRole = 'cityLeader'; |
|
|
|
this.cityId = dept.id; |
|
|
|
this.currentDeptLevel = '5'; |
|
|
|
// 添加区县边界 |
|
|
|
this.addCountyBorder(dept.children.map(item => item.id)); |
|
|
|
} else if (dept2.deptLevel === '4') { |
|
|
|
// 登录身份为县级领导 |
|
|
|
this.userRole = 'countyLeader'; |
|
|
|
this.countyId = dept2.id; |
|
|
|
this.currentDeptLevel = '4'; |
|
|
|
// 添加乡镇边界 |
|
|
|
this.addTownBorder(dept2.children.map(item => item.id)); |
|
|
|
gis.getView().setZoom(11); |
|
|
|
} else if (dept2.deptLevel === '3') { |
|
|
|
// 登录身份为镇级领导 |
|
|
|
this.userRole = 'townLeader'; |
|
|
|
this.townId = dept2.id; |
|
|
|
this.currentDeptLevel = '3'; |
|
|
|
// 添加村边界 |
|
|
|
this.addVillageBorder(dept2.children.map(item => item.id)); |
|
|
|
gis.getView().setZoom(13); |
|
|
|
} |
|
|
|
// 添加坐标点图层 |
|
|
|
if (dept2.children) { |
|
|
|
this.addDeptLayer(dept2.children); |
|
|
|
} |
|
|
|
var that = this; |
|
|
|
//点击查询详细信息 |
|
|
|
gis.getMapContainer().on("singleclick", function (evt) { |
|
|
@@ -511,6 +663,19 @@ export default { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
// 添加区县边界 |
|
|
|
addCountyBorder (deptIds) { |
|
|
|
gis.addImageLayer(this.mapGeoServerUrl, this.countyBorderLayerName, deptIds) |
|
|
|
}, |
|
|
|
// 添加乡镇边界 |
|
|
|
addTownBorder (deptIds) { |
|
|
|
console.log(this.townBorderLayerName); |
|
|
|
gis.addImageLayer(this.mapGeoServerUrl, this.townBorderLayerName, deptIds) |
|
|
|
}, |
|
|
|
// 添加村边界 |
|
|
|
addVillageBorder (deptIds) { |
|
|
|
gis.addImageLayer(this.mapGeoServerUrl, this.villageBorderLayerName, deptIds) |
|
|
|
}, |
|
|
|
// 获取资源列表 |
|
|
|
getResourceList (deptId) { |
|
|
|
getResourceListByDeptId(deptId).then(response => { |
|
|
|