Browse Source

Merge branch 'master' into shibei_master

shibei_master
YUJT 3 years ago
parent
commit
c8567af692
  1. 122
      src/views/modules/visual/plugin/power/components/screen-org-map.vue
  2. 48
      src/views/modules/visual/plugin/power/organization.vue

122
src/views/modules/visual/plugin/power/components/screen-org-map.vue

@ -31,6 +31,12 @@ let gaodeMapLayer // 背景地图图层
let markerSource
let markerLayer
let markerSource_1
let markerLayer_1
let markerSource_2
let markerLayer_2
let parentLayer;//
@ -130,7 +136,8 @@ export default {
orgData: {},//
iconCoordinators: [],
parentPolygon: [],
subAgencyArray: []
subAgencyArray: [],
centerFlag: 'point',//flag point fit
}
},
async mounted() {
@ -148,6 +155,8 @@ export default {
//
this.loadPolygon()
this.setMapLocation()
},
methods: {
initMap () {
@ -179,6 +188,45 @@ export default {
// console.log(transform(e.coordinate, 'EPSG:3857', 'EPSG:4326'));
})
},
//
setMapLocation () {
if (!this.zoom) {
this.setZoom(this.orgData.agencyLevel)
}
this.centerPoint = []
//
if (parentLayer.getSource().getFeatures()[0]) {//
this.centerFlag = 'flag_parent'
} else if (polygonLayer.getSource().getFeatures()[0]) {//,
this.centerFlag = 'flag_polygon'
} else if (this.orgData.longitude && this.orgData.latitude) {
this.centerPoint.push(this.orgData.longitude)
this.centerPoint.push(this.orgData.latitude)
this.centerFlag = 'point'
} else {
this.centerPoint = centerPointGlobal
this.centerFlag = 'point'
}
// debugger
if (this.centerFlag === 'flag_parent') {
let parentFeatures = parentLayer.getSource().getFeatures()[0]
let polygon = parentFeatures.getGeometry();
map.getView().fit(polygon, map.getSize());
this.zoom = map.getView().getZoom() - 1
} else if (this.centerFlag === 'flag_polygon') {
let polygonFeatures = polygonLayer.getSource().getFeatures()[0]
let polygon = polygonFeatures.getGeometry();
map.getView().fit(polygon, map.getSize());
this.zoom = map.getView().getZoom() - 1
} else {
mapView.setCenter(this.centerPoint);
}
mapView.setZoom(this.zoom);
},
firstCenterMap () {
this.centerPoint = []
if (this.orgData.longitude && this.orgData.latitude) {
@ -190,6 +238,9 @@ export default {
}
},
addMarker (list, icon=iconArray[0], scale=1) {
if (markerSource) {
markerSource.clear()
}
markerSource = new VectorSource({
// features: new GeoJSON().readFeatures(geojsonObject)
})
@ -245,6 +296,70 @@ export default {
markerSource.addFeatures(features)
map.addLayer(markerLayer)
},
addMarker_1 (list, icon=iconArray[0], scale=1) {
if (markerSource_1) {
markerSource_1.clear()
}
markerSource_1 = new VectorSource({
// features: new GeoJSON().readFeatures(geojsonObject)
})
markerLayer_1 = new VectorLayer({
source: markerSource_1,
zIndex: 50
})
let features = []
list.forEach((item, index) => {
const point = [parseFloat(item.longitude), parseFloat(item.latitude)]
let marker = new Feature({
geometry: new Point(point),
properties: {
...item
}
})
let iconStyle = new Style({
image: new Icon({
scale: scale,
src: icon
})
})
marker.setStyle(iconStyle)
features.push(marker)
})
markerSource_1.addFeatures(features)
map.addLayer(markerLayer_1)
},
addMarker_2 (list, icon=iconArray[0], scale=1) {
if (markerSource_2) {
markerSource_2.clear()
}
markerSource_2 = new VectorSource({
// features: new GeoJSON().readFeatures(geojsonObject)
})
markerLayer_2 = new VectorLayer({
source: markerSource_2,
zIndex: 50
})
let features = []
list.forEach((item, index) => {
const point = [parseFloat(item.longitude), parseFloat(item.latitude)]
let marker = new Feature({
geometry: new Point(point),
properties: {
...item
}
})
let iconStyle = new Style({
image: new Icon({
scale: scale,
src: icon
})
})
marker.setStyle(iconStyle)
features.push(marker)
})
markerSource_2.addFeatures(features)
map.addLayer(markerLayer_2)
},
//
async loadOrgData () {
@ -276,8 +391,6 @@ export default {
},
//
loadParentPolygon () {
parentSource.clear()//
let featureData = []//
if (this.parentPolygon && this.parentPolygon.length > 0) {//
let oneData = {}
@ -435,7 +548,6 @@ export default {
parentSource = new VectorSource({
//features: (new GeoJSON()).readFeatures(geojsonObject)
});
parentLayer = new VectorLayer({
source: parentSource,
style: parentStyleFunction,
@ -505,9 +617,7 @@ export default {
source: iconSource,
zIndex: 70
});
map.addLayer(iconLayer);
},
},

48
src/views/modules/visual/plugin/power/organization.vue

@ -17,8 +17,8 @@
:options="agencytree"
v-model="agencyId"
:show-all-levels="false"
:props="{ expandTrigger: 'hover', emitPath: false, label: 'orgName', value: 'orgId', children: 'subOrgList' }"
clearable/>
@change="handleChangeAgencytree"
:props="{ expandTrigger: 'hover', emitPath: false, label: 'orgName', value: 'orgId', children: 'subOrgList' }"/>
</div>
<!-- <div class="second-select ">
@ -202,6 +202,7 @@ export default {
let params = {
axisStructId: this.axisStructId,
pageSize: this.pageSize,
agencyId: this.agencyId,
pageNo: this.pageNo,
}
const url = "/pli/power/data/kernelHousehold/list"
@ -284,6 +285,7 @@ export default {
getMapData() {
const params1 = {
axisStructId: this.axisStructId,
agencyId: this.agencyId,
limit: 99
}
//
@ -321,7 +323,7 @@ export default {
this.xiaozuList.push(ob)
})
this.$nextTick(() => {
this.$refs.orgMap.addMarker(this.xiaozuList, lyxzIcon)
this.$refs.orgMap.addMarker_1(this.xiaozuList, lyxzIcon)
})
}).catch(err => {
this.$message.error(err)
@ -339,7 +341,7 @@ export default {
this.zhongxinhuList.push(ob)
})
this.$nextTick(() => {
this.$refs.orgMap.addMarker(this.zhongxinhuList, dyzxhIcon)
this.$refs.orgMap.addMarker_2(this.zhongxinhuList, dyzxhIcon)
})
}).catch(err => {
this.$message.error(err)
@ -354,7 +356,6 @@ export default {
//
async getAgencylist () {
const url = '/data/aggregator/org/agencytree'
let params = {
agencyId: this.agencyId,
client:'gov'
@ -366,13 +367,13 @@ export default {
_data = this.removeByOrgType(data, 'agency')
if (_data) {
this.agencytree = this.removeEmptySubOrgList(_data)
this.agencyId = this.agencytree ? this.agencytree[0].orgId : ''
// id
this.agencyId = this.agencytree[0].subOrgList && this.agencytree[0].subOrgList.length > 0 ? this.setListAgencyId_one(this.agencytree[0].subOrgList) : this.agencytree[0].orgId
}
}
} else {
this.$message.error(msg)
}
},
removeByOrgType (orgArray, orgType) {
if (orgArray && orgArray.length > 0) {
@ -401,12 +402,33 @@ export default {
})
return orgArray;
},
async handleChangeAgency (value) {
let selAgency = this.$refs["myCascader"].getCheckedNodes()[0].data
// this.agencyName = this.$refs["myCascader"].getCheckedNodes()[0].label
this.agencyName = selAgency.name
this.agencyId = selAgency.agencyId
this.level = selAgency.level === 'grid' ? 'grid' : 'agency'
// orgId
setListAgencyId_one(subOrgList) {
if (subOrgList[0].subOrgList && subOrgList[0].subOrgList.length > 0) {
this.setAgencyId_two(subOrgList[0].subOrgList)
} else {
return subOrgList[0].orgId
}
},
setAgencyId_two(subOrgList) {
if (subOrgList[0].subOrgList && subOrgList[0].subOrgList.length > 0) {
this.setListAgencyId_one(subOrgList[0].subOrgList)
} else {
return subOrgList[0].orgId
}
},
async handleChangeAgencytree() {
this.pageNo = 1
this.pageSize = 5
this.total = 0
this.dangqunList = [] //
this.xiaozuList = [] //
this.zhongxinhuList = [] //
this.tableData = []
this.axisStructId = ''
await this.getStructTree()
await this.getCount()
await this.getMapData()
},
},
}

Loading…
Cancel
Save