Browse Source

基础信息

shibei_master
jiangyy 4 years ago
parent
commit
be60f7f88c
  1. 119
      src/views/modules/visual/basicinfo/basicInfoMain.vue

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

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

Loading…
Cancel
Save