Browse Source

地图分析

shibei_master
jiangyy 4 years ago
parent
commit
3d68830190
  1. 141
      src/views/modules/visual/basicinfo/basicInfoMain.vue
  2. 4
      src/views/modules/workSys/mapConfig.vue
  3. 2
      vue.config.js

141
src/views/modules/visual/basicinfo/basicInfoMap.vue → src/views/modules/visual/basicinfo/basicInfoMain.vue

@ -2,18 +2,15 @@
<div style="position: relative"> <div style="position: relative">
<!-- 组织路由 --> <!-- 组织路由 -->
<div>组织路由</div> <div>
<div class="router_line"></div>
<div class="div_search"> <div calss="div_router">
<el-input style="width:200px" <span class="router_parents"
v-model="selAgencyId" v-for="(item,index) in runAgency"
placeholder="请输入姓名"></el-input> :key="index">{{runAgency.name}} <span class="router_parents arrow">{{">"}}</span></span>
<el-button style="margin-left:10px" <span class="router_child">{{orgData.name}}</span>
type="primary" </div>
icon="el-icon-plus"
@click="handleSearch">搜索</el-button>
</div> </div>
<div class="div_content"> <div class="div_content">
@ -21,8 +18,19 @@
<div id="map" <div id="map"
class="div_map" class="div_map"
:style="{height:mapHeight+'px'}"></div> :style="{height:mapHeight+'px'}"></div>
<div class="div_data"> <div class="div_data">
<div class="div_search">
<el-input style="width:200px"
v-model="selAgencyId"
placeholder="请输入姓名"></el-input>
<el-button style="margin-left:10px"
type="primary"
icon="el-icon-plus"
@click="handleSearch">搜索</el-button>
</div>
</div> </div>
</div> </div>
@ -98,11 +106,9 @@ const vueGis = {
name: 'HomeMap', name: 'HomeMap',
data () { data () {
return { return {
method: "",//
centerPoint: [],// centerPoint: [],//
zoom: 14,//14 zoom: 14,//14
minZoom: 1,// minZoom: 1,//
isMapLoaded: false,//
orgData: {},// orgData: {},//
orgId: '', orgId: '',
@ -120,7 +126,11 @@ const vueGis = {
// //
runNum: 0, runNum: 0,
runAgency: [], runAgency: [
{
name: '111'
}
],
} }
}, },
@ -139,26 +149,8 @@ const vueGis = {
}, },
methods: { methods: {
//
handleSearch (index) {
this.selAgencyIndex = index
selectedFeatures.clear()
if (index || index === 0) { handleSearch () {
this.showBtn = true
this.selAgency = this.subAgencyArray[index]
if (this.selAgency.coordinates) {
this.hasPolygon = true
this.highlightPolygon()
} else {
this.hasPolygon = false
}
} else {
this.showBtn = false
}
}, },
@ -178,19 +170,6 @@ const vueGis = {
} }
}, },
//
highlightPolygon () {
let features = polygonSource.getFeatures()
features.forEach(element => {
if (element.id_ === this.selAgencyId) {
selectedFeatures.push(element)
}
});
},
// //
handleBack () { handleBack () {
@ -222,7 +201,6 @@ const vueGis = {
if (code === 0) { if (code === 0) {
this.orgData = data this.orgData = data
this.runAgency.push(data)
if (data.children && data.children.length > 0) { if (data.children && data.children.length > 0) {
this.subAgencyArray = data.children this.subAgencyArray = data.children
@ -310,24 +288,24 @@ const vueGis = {
// //
toSubAgency (e) { toSubAgency (e) {
console.log(e) console.log(e)
if (this.method != 'mAddPolygon' && this.level != 'neighborHood') {
//
this.subAgencyArray.forEach(item => {
if (item.id === e.selected[0].id_) {
this.selPolygonId = item.id
this.selPolygon = item
this.orgId = item.id
this.orgLevel = item.level
} //
}); this.subAgencyArray.forEach(item => {
if (item.id === e.selected[0].id_) {
this.selPolygonId = item.id
this.selPolygon = item
this.orgId = item.id
this.orgLevel = item.level
}
});
this.runNum++
this.runAgency.push(this.selPolygon)
this.selAgencyIndex = 0
this.refreshMap(true)
this.runNum++
this.runAgency.push(this.selPolygon)
this.selAgencyIndex = 0
this.refreshMap(true)
}
}, },
// //
@ -407,6 +385,7 @@ const vueGis = {
polygonSource = new VectorSource({ polygonSource = new VectorSource({
//features: (new GeoJSON()).readFeatures(geojsonObject) //features: (new GeoJSON()).readFeatures(geojsonObject)
}); });
debugger
polygonLayer = new VectorLayer({ polygonLayer = new VectorLayer({
source: polygonSource, source: polygonSource,
@ -445,12 +424,6 @@ const vueGis = {
style: overlayStyle style: overlayStyle
}); });
selectAltClick = new Select({
condition: function (mapBrowserEvent) {
return click(mapBrowserEvent) && altKeyOnly(mapBrowserEvent);
},
});
selectedFeatures = select.getFeatures(); selectedFeatures = select.getFeatures();
map.addLayer(polygonLayer) map.addLayer(polygonLayer)
@ -458,12 +431,10 @@ const vueGis = {
map.addInteraction(selectAltClick); map.addInteraction(selectAltClick);
select.on('select', e => { select.on('select', e => {
this.selectFeature(e)
});
selectAltClick.on('select', e => {
this.toSubAgency(e) this.toSubAgency(e)
}); });
}, },
@ -527,7 +498,27 @@ const vueGis = {
export default vueGis; export default vueGis;
</script> </script>
<style > <style lang="scss">
.router_line {
width: 106px;
height: 1px;
border: 1px solid #000000;
/* opacity: 0.09; */
}
.div_router {
margin-top: 2px;
.router_parents {
color: #a0c3d9;
font-size: 8px;
}
.router_child {
color: #ffffff;
font-size: 8px;
}
}
.div_search { .div_search {
text-align: center; text-align: center;
margin-top: 20px; margin-top: 20px;
@ -551,7 +542,9 @@ export default vueGis;
background-color: rgb(233, 235, 235); background-color: rgb(233, 235, 235);
border-radius: 5px; border-radius: 5px;
} }
</style>
<style>
.ol-overlaycontainer-stopevent { .ol-overlaycontainer-stopevent {
display: none; display: none;
} }
</style> </style>

4
src/views/modules/workSys/mapConfig.vue

@ -735,7 +735,9 @@ export default vueGis;
.div_map { .div_map {
width: 100%; width: 100%;
} }
</style>
<style>
.ol-overlaycontainer-stopevent { .ol-overlaycontainer-stopevent {
display: none; display: none;
} }
</style> </style>

2
vue.config.js

@ -3,7 +3,7 @@
*/ */
const IS_PROD = ['production', 'test'].includes(process.env.NODE_ENV) const IS_PROD = ['production', 'test'].includes(process.env.NODE_ENV)
module.exports = { module.exports = {
baseUrl: process.env.NODE_ENV === 'production' ? '' : '/dist', baseUrl: process.env.NODE_ENV === 'production' ? '' : '/epmet-oper',
css: { css: {
// 是否使用css分离插件 ExtractTextPlugin // 是否使用css分离插件 ExtractTextPlugin
extract: IS_PROD, extract: IS_PROD,

Loading…
Cancel
Save