Browse Source

Merge branch 'dev-shuju' of http://git.elinkit.com.cn:7070/r/epmet-oper-gov into dev-shuju

feature
dai 4 years ago
parent
commit
640860a620
  1. 119
      src/views/modules/visual/basicinfo/basicInfoMain.vue

119
src/views/modules/visual/basicinfo/basicInfoMain.vue

@ -1,13 +1,14 @@
<template>
<div style="position: relative">
<div calss="div_main"
style="position: relative">
<!-- 组织路由 -->
<div>
<div class="router_line"></div>
<div calss="div_router">
<div class="div_router">
<span class="router_parents"
v-for="(item,index) in runAgency"
:key="index">{{runAgency.name}} <span class="router_parents arrow">{{">"}}</span></span>
:key="index">{{item.name}}<span class="arrow">></span></span>
<span class="router_child">{{orgData.name}}</span>
</div>
@ -22,7 +23,7 @@
<div class="div_data">
<div class="div_search">
<el-input style="width:200px"
v-model="selAgencyId"
v-model="name"
placeholder="请输入姓名"></el-input>
<el-button style="margin-left:10px"
@ -41,33 +42,31 @@
<script>
import 'ol/ol.css'
import { Map, View } from 'ol'
import TileLayer from 'ol/layer/Tile.js';
import XYZ from 'ol/source/XYZ.js';
import VectorLayer from 'ol/layer/Vector.js';
import VectorSource from 'ol/source/Vector.js';
import Projection from 'ol/proj/Projection.js';
import GeoJSON from 'ol/format/GeoJSON.js';
import { defaults as Select, DoubleClickZoom } from 'ol/interaction.js';
import { Circle as Fill, Stroke, Style, Text } from 'ol/style.js';
import { defaults as defaultInteractions, Select, DoubleClickZoom } from 'ol/interaction.js';
import { Circle as CircleStyle, Fill, Stroke, Style, Text } from 'ol/style.js';
import { mapGetters } from "vuex";
import { Loading } from 'element-ui'; //Loading
import { requestPost } from "@/js/dai/request";
import { altKeyOnly, click } from 'ol/events/condition';
let loading;//
let x = 1500
let y = 700
let map;
let mapView;
let gaodeMapLayer;//
let polygonLayer;//
let polygonSource;//
let select;//
let selectAltClick;
let selectedFeatures;
//
var createTextStyle = function (feature) {
@ -115,22 +114,16 @@ const vueGis = {
orgLevel: '',
subAgencyArray: [],//
selAgencyIndex: 0,
selAgencyId: '',//id
selAgency: {},//
hasPolygon: false,//
showBtn: false,
selPolygonId: '',//id
selPolygon: {},
//
name: "",
//
runNum: 0,
runAgency: [
{
name: '111'
}
],
runAgency: [],
}
},
@ -145,22 +138,22 @@ const vueGis = {
this.addPolygonLayer()
//
this.loadPolygon()
this.loadPolygon(this.subAgencyArray)
},
methods: {
handleSearch () {
},
//
async refreshMap (isRefreshView) {
//
await this.loadOrgData()
//
await this.loadPolygon()
await this.loadPolygon(this.subAgencyArray)
//
if (isRefreshView) {
@ -201,10 +194,11 @@ const vueGis = {
if (code === 0) {
this.orgData = data
this.runAgency.push(data)
if (data.children && data.children.length > 0) {
this.subAgencyArray = data.children
this.selAgencyId = this.subAgencyArray[0].id
}
} else {
@ -214,14 +208,14 @@ const vueGis = {
},
//
loadPolygon () {
loadPolygon (subAgencyArray) {
polygonSource.clear()//
let featureData = []//
if (this.subAgencyArray && this.subAgencyArray.length > 0) {//
if (subAgencyArray && subAgencyArray.length > 0) {//
let oneData = {}
this.subAgencyArray.forEach(agencyItem => {
subAgencyArray.forEach(agencyItem => {
if (agencyItem.coordinates && agencyItem.coordinates !== '') {//
oneData = {
@ -269,22 +263,9 @@ const vueGis = {
polygonSource.addFeatures(feature)
}
this.orgChange(this.selAgencyIndex)
},
//feature
selectFeature (e) {
console.log(e)
this.selAgencyId = e.selected[0].id_
this.subAgencyArray.forEach((element, index) => {
if (element.id === e.selected[0].id_) {
this.selAgencyIndex = index
this.orgChange(index)
}
});
},
//
toSubAgency (e) {
console.log(e)
@ -302,7 +283,7 @@ const vueGis = {
this.runNum++
this.runAgency.push(this.selPolygon)
this.selAgencyIndex = 0
this.refreshMap(true)
@ -385,7 +366,6 @@ const vueGis = {
polygonSource = new VectorSource({
//features: (new GeoJSON()).readFeatures(geojsonObject)
});
debugger
polygonLayer = new VectorLayer({
source: polygonSource,
@ -424,23 +404,16 @@ const vueGis = {
style: overlayStyle
});
selectedFeatures = select.getFeatures();
map.addLayer(polygonLayer)
map.addInteraction(select);
map.addInteraction(selectAltClick);
select.on('select', e => {
this.toSubAgency(e)
});
},
//
startLoading () {
loading = Loading.service({
@ -468,28 +441,23 @@ const vueGis = {
},
computed: {
extentXOffset () {
if (this.clientHeight < 900) {
return 0.88
} else {
return 0.95
}
},
extentYOffset () {
return 0.95
},
imgExtent () {
return [-x * this.extentXOffset, -y * this.extentYOffset, x * this.extentXOffset, y * this.extentYOffset]
},
mapHeight () {
return this.clientHeight - 240;
return this.clientHeight - 120;
},
// zoom: {
// get () {
// //zoom
// if (this.clientHeight < 900) {
// return 2.3
// } else {
// return 2.8
// }
// },
// set (value) {
// }
// },
...mapGetters(["clientHeight"])
},
@ -499,6 +467,9 @@ export default vueGis;
</script>
<style lang="scss">
.div_main {
background-color: #12a3ff;
}
.router_line {
width: 106px;
height: 1px;
@ -506,11 +477,15 @@ export default vueGis;
/* opacity: 0.09; */
}
.div_router {
margin-top: 2px;
margin-top: 5px;
.router_parents {
color: #a0c3d9;
font-size: 8px;
.arrow {
padding: 0 5px;
}
}
.router_child {

Loading…
Cancel
Save