井乐禹 2 years ago
parent
commit
84ee90b5b7
  1. 6
      src/views/modules/visual/command/index.vue
  2. 115
      src/views/modules/visual/communityGovern/fivelayers/mapIndex.vue
  3. 71
      src/views/modules/visual/components/screen-map/index.vue
  4. 52
      src/views/modules/visual/plugin/power/components/screen-org-map.vue
  5. 111
      src/views/modules/workSys/mapConfig.vue

6
src/views/modules/visual/command/index.vue

@ -203,14 +203,14 @@
import { requestPost } from "@/js/dai/request"; import { requestPost } from "@/js/dai/request";
import People from "@/views/modules/visual/basicinfo/people"; import People from "@/views/modules/visual/basicinfo/people";
import gridMap from "@/views/modules/visual/command/cpts/map"; import gridMap from "@/views/modules/visual/command/cpts/map";
import cptCard from "@/views/modules/visual/cpts/card";
import { Loading } from "element-ui"; //Loading
import { mapGetters } from "vuex";
// import gridMapOl from "@/views/modules/visual/command/cpts/map-ol"; // import gridMapOl from "@/views/modules/visual/command/cpts/map-ol";
import sidemenuLeft from "@/views/modules/visual/command/cpts/sidemenu-left"; import sidemenuLeft from "@/views/modules/visual/command/cpts/sidemenu-left";
import sidemenu1 from "@/views/modules/visual/command/cpts/yantai-sidemenu1"; import sidemenu1 from "@/views/modules/visual/command/cpts/yantai-sidemenu1";
import sidemenu2 from "@/views/modules/visual/command/cpts/yantai-sidemenu2"; import sidemenu2 from "@/views/modules/visual/command/cpts/yantai-sidemenu2";
import cptCard from "@/views/modules/visual/cpts/card";
import ScreenLoading from "@/views/modules/visual/cpts/loading"; import ScreenLoading from "@/views/modules/visual/cpts/loading";
import { Loading } from "element-ui"; //Loading
import { mapGetters } from "vuex";
import demandInfo from "@/views/modules/visual/command/cpts/demandInfo"; import demandInfo from "@/views/modules/visual/command/cpts/demandInfo";
import eventInfo from "@/views/modules/visual/command/cpts/eventInfo"; import eventInfo from "@/views/modules/visual/command/cpts/eventInfo";

115
src/views/modules/visual/communityGovern/fivelayers/mapIndex.vue

@ -89,7 +89,8 @@
</div> </div>
<div class="m-pagination"> <div class="m-pagination">
<el-pagination hide-on-single-page :current-page="demand.pageNo" <el-pagination hide-on-single-page
:current-page="demand.pageNo"
:page-size="demand.pageSize" :page-size="demand.pageSize"
:total="demand.total" :total="demand.total"
background background
@ -369,30 +370,28 @@
<script> <script>
// import 'ol/ol.css' // import 'ol/ol.css'
import { Map, View } from 'ol' import { Map, View } from 'ol';
import Feature from "ol/Feature.js";
import Overlay from 'ol/Overlay';
import { boundingExtent } from 'ol/extent.js';
import GeoJSON from 'ol/format/GeoJSON.js';
import Point from "ol/geom/Point.js";
import { DoubleClickZoom, Select } from 'ol/interaction.js';
import TileLayer from 'ol/layer/Tile.js'; import TileLayer from 'ol/layer/Tile.js';
import ImageLayer from 'ol/layer/Image';
import { Raster as RasterSource } from 'ol/source';
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 GeoJSON from 'ol/format/GeoJSON.js'; import XYZ from 'ol/source/XYZ.js';
import Point from "ol/geom/Point.js"; import { Fill, Icon, Stroke, Style, Text } from 'ol/style.js';
import Feature from "ol/Feature.js";
import Overlay from 'ol/Overlay';
import { defaults as defaultInteractions, Select, DoubleClickZoom } from 'ol/interaction.js';
import { getCenter, boundingExtent } from 'ol/extent.js';
import { Circle as CircleStyle, Icon, Fill, Stroke, Style, Text } from 'ol/style.js';
import nextTick from 'dai-js/tools/nextTick' import { requestGet, requestPost } from "@/js/dai/request";
import { mapGetters } from "vuex"; import nextTick from 'dai-js/tools/nextTick';
import { Loading } from 'element-ui'; //Loading import { Loading } from 'element-ui'; //Loading
import { requestPost, requestGet } from "@/js/dai/request"; import { mapGetters } from "vuex";
import cptTb from "@/views/modules/visual/cpts/tb";
import cptCard from "@/views/modules/visual/cpts/card"; import cptCard from "@/views/modules/visual/cpts/card";
import ScreenLoading from "@/views/modules/visual/cpts/loading"; import ScreenLoading from "@/views/modules/visual/cpts/loading";
import cptTb from "@/views/modules/visual/cpts/tb";
import People from "../../basicinfo/people"; import People from "../../basicinfo/people";
var centerPointGlobal = [120.664619, 36.504963] var centerPointGlobal = [120.664619, 36.504963]
@ -513,7 +512,7 @@ let reverseFunc = function (pixelsTemp) {
const vueGis = { const vueGis = {
name: 'HomeMap', name: 'HomeMap',
data () { data() {
return { return {
centerPoint: [],// centerPoint: [],//
zoom: 14,//14 zoom: 14,//14
@ -679,7 +678,7 @@ const vueGis = {
} }
}, },
async mounted () { async mounted() {
// //
await this.loadOrgData() await this.loadOrgData()
@ -714,12 +713,12 @@ const vueGis = {
}, },
methods: { methods: {
toPeople () { toPeople() {
this.showPeopleInfo = true this.showPeopleInfo = true
}, },
// //
addOverlay () { addOverlay() {
// 使 DOM // 使 DOM
var container = document.getElementById("popup"); var container = document.getElementById("popup");
var closer = document.getElementById("popup-closer"); var closer = document.getElementById("popup-closer");
@ -751,7 +750,7 @@ const vueGis = {
}, },
// //
addMapClick () { addMapClick() {
let _that = this let _that = this
map.on("click", function (evt) { map.on("click", function (evt) {
@ -768,7 +767,7 @@ const vueGis = {
}, },
// //
async clickMapVolunteer (info) { async clickMapVolunteer(info) {
if (!info.id) { if (!info.id) {
return false return false
@ -816,7 +815,7 @@ const vueGis = {
}, },
async loadResi (info) { async loadResi(info) {
const url = "/epmetuser/icresiuser/resi-brief/" + info.id const url = "/epmetuser/icresiuser/resi-brief/" + info.id
// const url = "http://yapi.elinkservice.cn/mock/245/heart/icpartyunit/distribution" // const url = "http://yapi.elinkservice.cn/mock/245/heart/icpartyunit/distribution"
@ -868,7 +867,7 @@ const vueGis = {
} }
}, },
async loadPublicService (info) { async loadPublicService(info) {
const url = "/gov/org/icPublicService/detail" const url = "/gov/org/icPublicService/detail"
// const url = "http://yapi.elinkservice.cn/mock/245/gov/org/icPublicService/detail" // const url = "http://yapi.elinkservice.cn/mock/245/gov/org/icPublicService/detail"
@ -896,7 +895,7 @@ const vueGis = {
} }
}, },
async loadEvent (info) { async loadEvent(info) {
const url = "/governance/icEvent/detail"; const url = "/governance/icEvent/detail";
//const url = "http://yapi.elinkservice.cn/mock/245/api/gov/project/icEvent/processAnalysis/eventDetail/" + this.eventId; //const url = "http://yapi.elinkservice.cn/mock/245/api/gov/project/icEvent/processAnalysis/eventDetail/" + this.eventId;
@ -917,7 +916,7 @@ const vueGis = {
} }
}, },
async loadDangerousChemicals (info) { async loadDangerousChemicals(info) {
const url = "/gov/org/icDangerousChemicals/detail" const url = "/gov/org/icDangerousChemicals/detail"
// const url = "http://yapi.elinkservice.cn/mock/245/gov/org/icDangerousChemicals/detail" // const url = "http://yapi.elinkservice.cn/mock/245/gov/org/icDangerousChemicals/detail"
@ -948,7 +947,7 @@ const vueGis = {
} }
}, },
async loadCityManagement (info) { async loadCityManagement(info) {
const url = "/gov/org/icCityManagement/detail" const url = "/gov/org/icCityManagement/detail"
// const url = "http://yapi.elinkservice.cn/mock/245/gov/org/icCityManagement/detail" // const url = "http://yapi.elinkservice.cn/mock/245/gov/org/icCityManagement/detail"
@ -976,7 +975,7 @@ const vueGis = {
} }
}, },
async loadCommunityOrg (info) { async loadCommunityOrg(info) {
// const url = "/gov/org/icCityManagement/detail" // const url = "/gov/org/icCityManagement/detail"
const url = "/heart/iccommunityselforganization/community-self-org-detail/" + info.id const url = "/heart/iccommunityselforganization/community-self-org-detail/" + info.id
@ -1004,7 +1003,7 @@ const vueGis = {
} }
}, },
async loadSuperiorResource (info) { async loadSuperiorResource(info) {
const url = "/gov/org/icSuperiorResource/detail" const url = "/gov/org/icSuperiorResource/detail"
// const url = "http://yapi.elinkservice.cn/mock/245/gov/org/icSuperiorResource/detail" // const url = "http://yapi.elinkservice.cn/mock/245/gov/org/icSuperiorResource/detail"
@ -1032,7 +1031,7 @@ const vueGis = {
} }
}, },
async loadEnterprisePartrol (info) { async loadEnterprisePartrol(info) {
const url = "/gov/org/enterprise/detail/" + info.id const url = "/gov/org/enterprise/detail/" + info.id
// const url = "http://yapi.elinkservice.cn/mock/245/gov/org/enterprise/detail" // const url = "http://yapi.elinkservice.cn/mock/245/gov/org/enterprise/detail"
@ -1048,7 +1047,7 @@ const vueGis = {
this.$message.error(msg) this.$message.error(msg)
} }
}, },
async loadGroupRent (info) { async loadGroupRent(info) {
const url = "/gov/org/ichouse/" + info.id const url = "/gov/org/ichouse/" + info.id
const { data, code, msg } = await requestGet(url) const { data, code, msg } = await requestGet(url)
@ -1064,7 +1063,7 @@ const vueGis = {
this.$message.error(msg) this.$message.error(msg)
} }
}, },
async loadPartyUnit (info) { async loadPartyUnit(info) {
const url = '/heart/icpartyunit/detail' const url = '/heart/icpartyunit/detail'
// const url = 'http://yapi.elinkservice.cn/mock/245/heart/icpartyunit/detail' // const url = 'http://yapi.elinkservice.cn/mock/245/heart/icpartyunit/detail'
let params = { let params = {
@ -1089,7 +1088,7 @@ const vueGis = {
}, },
handleShowPopup (coordinate) { handleShowPopup(coordinate) {
// console.log(this.overlay.getElement()) // console.log(this.overlay.getElement())
let content = document.getElementById("popup-content"); let content = document.getElementById("popup-content");
@ -1102,14 +1101,14 @@ const vueGis = {
}, },
// //
handleClosePopup () { handleClosePopup() {
this.overlay.setPosition(undefined); this.overlay.setPosition(undefined);
document.getElementById("popup-closer").blur(); document.getElementById("popup-closer").blur();
return false; return false;
}, },
// //
async handleClickCoverage (index) { async handleClickCoverage(index) {
this.demand.pageNo = 1 this.demand.pageNo = 1
this.coverageTypesList[index].select = !this.coverageTypesList[index].select this.coverageTypesList[index].select = !this.coverageTypesList[index].select
let item = this.coverageTypesList[index] let item = this.coverageTypesList[index]
@ -1130,7 +1129,7 @@ const vueGis = {
}, },
// //
async handleClickCategory (index, colIndex) { async handleClickCategory(index, colIndex) {
this.demand.pageNo = 1 this.demand.pageNo = 1
this.categoryListshow[index][colIndex].sel = !this.categoryListshow[index][colIndex].sel this.categoryListshow[index][colIndex].sel = !this.categoryListshow[index][colIndex].sel
@ -1154,13 +1153,13 @@ const vueGis = {
this.getTable(); this.getTable();
this.getMapTable(); this.getMapTable();
}, },
handleSearch () { handleSearch() {
this.demand.pageNo = 1 this.demand.pageNo = 1
this.getTable(); this.getTable();
this.getMapTable(); this.getMapTable();
}, },
// //
handleClickRow (index) { handleClickRow(index) {
let selData = this.tableList[index] let selData = this.tableList[index]
if (selData.longitude && selData.latitude) { if (selData.longitude && selData.latitude) {
mapView.setCenter([selData.longitude, selData.latitude]); mapView.setCenter([selData.longitude, selData.latitude]);
@ -1171,12 +1170,12 @@ const vueGis = {
// alert(index) // alert(index)
}, },
handlePageNoChange_demand (val) { handlePageNoChange_demand(val) {
this.demand.pageNo = val; this.demand.pageNo = val;
this.getTable(); this.getTable();
}, },
async loadCategoryList () { async loadCategoryList() {
const url = "/gov/org/coverage/categoryList" const url = "/gov/org/coverage/categoryList"
// const url = "http://yapi.elinkservice.cn/mock/245/gov/org/coverage/categoryList" // const url = "http://yapi.elinkservice.cn/mock/245/gov/org/coverage/categoryList"
let params = { let params = {
@ -1219,7 +1218,7 @@ const vueGis = {
}, },
// //
async getTable () { async getTable() {
this.demand.loading = true this.demand.loading = true
const url = "/data/aggregator/coverage/dataList"; const url = "/data/aggregator/coverage/dataList";
// const url = "http://yapi.elinkservice.cn/mock/245/data/aggregator/coverage/dataList"; // const url = "http://yapi.elinkservice.cn/mock/245/data/aggregator/coverage/dataList";
@ -1265,7 +1264,7 @@ const vueGis = {
} }
}, },
// //
async getMapTable () { async getMapTable() {
const url = "/data/aggregator/coverage/dataList"; const url = "/data/aggregator/coverage/dataList";
// const url = "http://yapi.elinkservice.cn/mock/245/data/aggregator/coverage/dataList"; // const url = "http://yapi.elinkservice.cn/mock/245/data/aggregator/coverage/dataList";
@ -1298,7 +1297,7 @@ const vueGis = {
}, },
//icon //icon
loadIcon () { loadIcon() {
iconSource.clear()// iconSource.clear()//
if (this.iconArrays && this.iconArrays.length > 0) { if (this.iconArrays && this.iconArrays.length > 0) {
@ -1346,7 +1345,7 @@ const vueGis = {
}, },
// //
async refreshMap (isRefreshView) { async refreshMap(isRefreshView) {
// //
await this.loadOrgData() await this.loadOrgData()
@ -1368,7 +1367,7 @@ const vueGis = {
}, },
// //
setMapLocation () { setMapLocation() {
if (!this.zoom) { if (!this.zoom) {
this.setZoom(this.orgData.agencyLevel) this.setZoom(this.orgData.agencyLevel)
} }
@ -1419,7 +1418,7 @@ const vueGis = {
}, },
// //
handleClickRouter (index) { handleClickRouter(index) {
this.showPeopleInfo = false this.showPeopleInfo = false
@ -1428,7 +1427,7 @@ const vueGis = {
}, },
// //
async loadOrgData () { async loadOrgData() {
const url = "/gov/org/agency/maporg" const url = "/gov/org/agency/maporg"
let params = { let params = {
@ -1458,7 +1457,7 @@ const vueGis = {
}, },
// //
loadParentPolygon () { loadParentPolygon() {
parentSource.clear()// parentSource.clear()//
let featureData = []// let featureData = []//
@ -1519,7 +1518,7 @@ const vueGis = {
}, },
// //
loadPolygon (subAgencyArray) { loadPolygon(subAgencyArray) {
polygonSource.clear()// polygonSource.clear()//
iconSource.clear()// iconSource.clear()//
@ -1629,7 +1628,7 @@ const vueGis = {
}, },
// //
setZoom (agencyLevel) { setZoom(agencyLevel) {
if (agencyLevel === 'district') { if (agencyLevel === 'district') {
this.zoom = 12 this.zoom = 12
} else if (agencyLevel === 'street') { } else if (agencyLevel === 'street') {
@ -1642,7 +1641,7 @@ const vueGis = {
}, },
firstCenterMap () { firstCenterMap() {
this.centerPoint = [] this.centerPoint = []
if (this.orgData.longitude && this.orgData.latitude) { if (this.orgData.longitude && this.orgData.latitude) {
this.centerPoint.push(this.orgData.longitude) this.centerPoint.push(this.orgData.longitude)
@ -1657,7 +1656,7 @@ const vueGis = {
} }
}, },
initMap () { initMap() {
this.firstCenterMap() this.firstCenterMap()
gaodeMapLayer = new TileLayer({ gaodeMapLayer = new TileLayer({
@ -1707,7 +1706,7 @@ const vueGis = {
}, },
// //
addParentLayer () { addParentLayer() {
parentSource = new VectorSource({ parentSource = new VectorSource({
//features: (new GeoJSON()).readFeatures(geojsonObject) //features: (new GeoJSON()).readFeatures(geojsonObject)
}); });
@ -1725,7 +1724,7 @@ const vueGis = {
}, },
// //
addPolygonLayer () { addPolygonLayer() {
polygonSource = new VectorSource({ polygonSource = new VectorSource({
//features: (new GeoJSON()).readFeatures(geojsonObject) //features: (new GeoJSON()).readFeatures(geojsonObject)
}); });
@ -1777,7 +1776,7 @@ const vueGis = {
}, },
addIconLayer () { addIconLayer() {
iconSource = new VectorSource({ iconSource = new VectorSource({
//features: (new GeoJSON()).readFeatures(geojsonObject) //features: (new GeoJSON()).readFeatures(geojsonObject)
}); });
@ -1792,7 +1791,7 @@ const vueGis = {
}, },
// //
startLoading () { startLoading() {
loading = Loading.service({ loading = Loading.service({
lock: true, // lock: true, //
text: '正在加载……', // text: '正在加载……', //
@ -1802,7 +1801,7 @@ const vueGis = {
}, },
// //
endLoading () { endLoading() {
//clearTimeout(timer); //clearTimeout(timer);
if (loading) { if (loading) {
loading.close(); loading.close();
@ -1818,7 +1817,7 @@ const vueGis = {
}, },
computed: { computed: {
mapHeight () { mapHeight() {
return this.clientHeight - 120; return this.clientHeight - 120;

71
src/views/modules/visual/components/screen-map/index.vue

@ -41,28 +41,25 @@
<script> <script>
// import 'ol/ol.css' // import 'ol/ol.css'
import { Map, View } from 'ol' import { Map, View } from 'ol';
import Feature from "ol/Feature.js";
import Overlay from 'ol/Overlay';
import { boundingExtent } from 'ol/extent.js';
import GeoJSON from 'ol/format/GeoJSON.js';
import Point from "ol/geom/Point.js";
import { DoubleClickZoom, Select } from 'ol/interaction.js';
import TileLayer from 'ol/layer/Tile.js'; import TileLayer from 'ol/layer/Tile.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 GeoJSON from 'ol/format/GeoJSON.js'; import XYZ from 'ol/source/XYZ.js';
import Point from "ol/geom/Point.js";
import Feature from "ol/Feature.js";
import Overlay from 'ol/Overlay';
import { Select, DoubleClickZoom } from 'ol/interaction.js';
import { getCenter, boundingExtent } from 'ol/extent.js';
import { Circle as CircleStyle, Icon, Fill, Stroke, Style, Text } from 'ol/style.js';
import { altKeyOnly, click, pointerMove } from 'ol/events/condition';
import { getDistance } from 'ol/sphere'; import { getDistance } from 'ol/sphere';
import { Fill, Icon, Stroke, Style, Text } from 'ol/style.js';
import { Loading } from 'element-ui'; //Loading
import MousePosition from 'ol/control/MousePosition'; import MousePosition from 'ol/control/MousePosition';
import { createStringXY } from 'ol/coordinate'; import { createStringXY } from 'ol/coordinate';
import { defaults as defaultControls } from 'ol/control';
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import { Loading } from 'element-ui'; //Loading
import { requestPost } from "@/js/dai/request";
var centerPointGlobal = [120.38945519, 36.0722275] var centerPointGlobal = [120.38945519, 36.0722275]
@ -142,7 +139,7 @@ var polygonStyleFunction = (function () {
const vueGis = { const vueGis = {
name: 'HomeMap', name: 'HomeMap',
data () { data() {
return { return {
centerPoint: [],// centerPoint: [],//
zoom: 14,//14 zoom: 14,//14
@ -205,16 +202,16 @@ const vueGis = {
isChangeCenter: true,// isChangeCenter: true,//
} }
}, },
async mounted () { async mounted() {
}, },
methods: { methods: {
showPosition () { showPosition() {
let array = [this.input_lat, this.input_lon] let array = [this.input_lat, this.input_lon]
map.getView().setCenter(array) map.getView().setCenter(array)
}, },
//:icon //:icon
loadMap (mapInfo, polygonArray, polIconUrlArray, iconArrays, iconUrlArray, iconTextStyle, distanceMax) { loadMap(mapInfo, polygonArray, polIconUrlArray, iconArrays, iconUrlArray, iconTextStyle, distanceMax) {
this.mapInfo = mapInfo this.mapInfo = mapInfo
this.polygonArray = polygonArray this.polygonArray = polygonArray
this.polIconUrlArray = polIconUrlArray || [] this.polIconUrlArray = polIconUrlArray || []
@ -261,7 +258,7 @@ const vueGis = {
}, },
//: //:
async refreshMap (mapInfo, polygonArray, iconArrays, isChangeCenter) { async refreshMap(mapInfo, polygonArray, iconArrays, isChangeCenter) {
this.mapInfo = mapInfo this.mapInfo = mapInfo
this.polygonArray = [] this.polygonArray = []
this.polygonArray = polygonArray this.polygonArray = polygonArray
@ -298,7 +295,7 @@ const vueGis = {
}, },
// //
loadPolygon () { loadPolygon() {
polygonSource.clear()// polygonSource.clear()//
// iconSource.clear() // iconSource.clear()
let featureData = []// let featureData = []//
@ -359,7 +356,7 @@ const vueGis = {
}, },
//icon //icon
loadPolIcon (feature) { loadPolIcon(feature) {
polIconSource.clear() polIconSource.clear()
let polyIconFeatures = []; let polyIconFeatures = [];
// console.log('feature-----', feature) // console.log('feature-----', feature)
@ -398,7 +395,7 @@ const vueGis = {
}, },
//icon //icon
loadIcon () { loadIcon() {
iconSource.clear()// iconSource.clear()//
if (this.iconArrays && this.iconArrays.length > 0) { if (this.iconArrays && this.iconArrays.length > 0) {
@ -448,7 +445,7 @@ const vueGis = {
// //
computedDistance (lon, lat, max) { computedDistance(lon, lat, max) {
let c1 = [2]; c1[0] = lon; c1[1] = lat; let c1 = [2]; c1[0] = lon; c1[1] = lat;
let distance = getDistance(this.centerPoint, c1); let distance = getDistance(this.centerPoint, c1);
// console.log(distance) // console.log(distance)
@ -461,7 +458,7 @@ const vueGis = {
}, },
// //
initMap () { initMap() {
this.firstCentermap() this.firstCentermap()
gaodeMapLayer = new TileLayer({ gaodeMapLayer = new TileLayer({
title: "地图", title: "地图",
@ -514,7 +511,7 @@ const vueGis = {
}, },
// //
setMapLocation () { setMapLocation() {
if (!this.zoom) { if (!this.zoom) {
this.setZoom(this.mapInfo.agencyLevel) this.setZoom(this.mapInfo.agencyLevel)
} }
@ -606,7 +603,7 @@ const vueGis = {
mapView.setZoom(this.zoom); mapView.setZoom(this.zoom);
}, },
firstCentermap () { firstCentermap() {
if (this.mapInfo.longitude && this.mapInfo.latitude) { if (this.mapInfo.longitude && this.mapInfo.latitude) {
this.centerPoint = [] this.centerPoint = []
this.centerPoint.push(this.mapInfo.longitude) this.centerPoint.push(this.mapInfo.longitude)
@ -620,7 +617,7 @@ const vueGis = {
}, },
// //
setZoom (level) { setZoom(level) {
if (level === 'district') { if (level === 'district') {
this.zoom = 12 this.zoom = 12
} else if (level === 'street') { } else if (level === 'street') {
@ -634,7 +631,7 @@ const vueGis = {
}, },
// //
initPolygonLayer () { initPolygonLayer() {
polygonSource = new VectorSource({ polygonSource = new VectorSource({
// features: (new GeoJSON()).readFeatures(geojsonObject) // features: (new GeoJSON()).readFeatures(geojsonObject)
wrapX: false wrapX: false
@ -688,7 +685,7 @@ const vueGis = {
}, },
//icon //icon
initPolIconLayer () { initPolIconLayer() {
polIconSource = new VectorSource({ polIconSource = new VectorSource({
//features: (new GeoJSON()).readFeatures(geojsonObject) //features: (new GeoJSON()).readFeatures(geojsonObject)
wrapX: false wrapX: false
@ -704,7 +701,7 @@ const vueGis = {
}, },
//icon //icon
initIconLayer () { initIconLayer() {
iconSource = new VectorSource({ iconSource = new VectorSource({
//features: (new GeoJSON()).readFeatures(geojsonObject) //features: (new GeoJSON()).readFeatures(geojsonObject)
wrapX: false wrapX: false
@ -726,7 +723,7 @@ const vueGis = {
}, },
// //
addOverlay () { addOverlay() {
// 使 DOM // 使 DOM
var container = document.getElementById("popup"); var container = document.getElementById("popup");
var closer = document.getElementById("popup-closer"); var closer = document.getElementById("popup-closer");
@ -762,7 +759,7 @@ const vueGis = {
}, },
// //
addMapClick () { addMapClick() {
let _that = this let _that = this
@ -790,7 +787,7 @@ const vueGis = {
}); });
}, },
handleShowPopup (showData, coordinate, isShowMore) { handleShowPopup(showData, coordinate, isShowMore) {
if (isShowMore) { if (isShowMore) {
document.getElementById("popup-goMore").style.display = 'block' document.getElementById("popup-goMore").style.display = 'block'
} else { } else {
@ -807,19 +804,19 @@ const vueGis = {
}, },
// //
handleClosePopup () { handleClosePopup() {
this.overlay.setPosition(undefined); this.overlay.setPosition(undefined);
document.getElementById("popup-closer").blur(); document.getElementById("popup-closer").blur();
return false; return false;
}, },
// //
getRndBetween (lowerLimit, upperLimit) { getRndBetween(lowerLimit, upperLimit) {
return Math.floor(Math.random() * (upperLimit - lowerLimit + 1)) + lowerLimit; return Math.floor(Math.random() * (upperLimit - lowerLimit + 1)) + lowerLimit;
}, },
// //
startLoading () { startLoading() {
loading = Loading.service({ loading = Loading.service({
lock: true, // lock: true, //
text: '正在加载……', // text: '正在加载……', //
@ -829,7 +826,7 @@ const vueGis = {
}, },
// //
endLoading () { endLoading() {
//clearTimeout(timer); //clearTimeout(timer);
if (loading) { if (loading) {
loading.close(); loading.close();
@ -876,7 +873,7 @@ const vueGis = {
}, },
computed: { computed: {
mapHeight () { mapHeight() {
return this.clientHeight - 120; return this.clientHeight - 120;
}, },

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

@ -1,29 +1,23 @@
<template> <template>
<div class="div_map" id="map" ref="map"></div> <div class="div_map"
id="map"
ref="map"></div>
</template> </template>
<script> <script>
// import 'ol/ol.css' // import 'ol/ol.css'
import { requestPost } from "@/js/dai/request"
import { Map, View } from 'ol' import { Map, View } from 'ol'
import Feature from "ol/Feature.js"
import { boundingExtent } from 'ol/extent.js'
import GeoJSON from 'ol/format/GeoJSON.js'
import Point from "ol/geom/Point.js"
import { Select } from 'ol/interaction.js'
import TileLayer from 'ol/layer/Tile.js' import TileLayer from 'ol/layer/Tile.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 GeoJSON from 'ol/format/GeoJSON.js' import XYZ from 'ol/source/XYZ.js'
import Point from "ol/geom/Point.js" import { Fill, Icon, Stroke, Style, Text } from 'ol/style.js'
import Feature from "ol/Feature.js"
import Overlay from 'ol/Overlay'
import { Select, DoubleClickZoom } from 'ol/interaction.js'
import { getCenter, boundingExtent } from 'ol/extent.js'
import { Circle as CircleStyle, Icon, Fill, Stroke, Style, Text } from 'ol/style.js'
import { altKeyOnly, click, pointerMove } from 'ol/events/condition'
import { getDistance } from 'ol/sphere'
import MousePosition from 'ol/control/MousePosition'
import { createStringXY } from 'ol/coordinate'
import { defaults as defaultControls } from 'ol/control'
import { mapGetters } from "vuex"
import { Loading } from 'element-ui'
import { requestPost } from "@/js/dai/request"
let map let map
let mapView let mapView
@ -159,7 +153,7 @@ export default {
this.setMapLocation() this.setMapLocation()
}, },
methods: { methods: {
initMap () { initMap() {
this.firstCenterMap() this.firstCenterMap()
gaodeMapLayer = new TileLayer({ gaodeMapLayer = new TileLayer({
@ -189,7 +183,7 @@ export default {
}) })
}, },
// //
setMapLocation () { setMapLocation() {
if (!this.zoom) { if (!this.zoom) {
this.setZoom(this.orgData.agencyLevel) this.setZoom(this.orgData.agencyLevel)
} }
@ -227,7 +221,7 @@ export default {
mapView.setZoom(this.zoom); mapView.setZoom(this.zoom);
}, },
firstCenterMap () { firstCenterMap() {
this.centerPoint = [] this.centerPoint = []
if (this.orgData.longitude && this.orgData.latitude) { if (this.orgData.longitude && this.orgData.latitude) {
this.centerPoint.push(this.orgData.longitude) this.centerPoint.push(this.orgData.longitude)
@ -237,7 +231,7 @@ export default {
this.centerPoint = centerPointGlobal this.centerPoint = centerPointGlobal
} }
}, },
addMarker (list, icon=iconArray[0], scale=1) { addMarker(list, icon = iconArray[0], scale = 1) {
if (markerSource) { if (markerSource) {
markerSource.clear() markerSource.clear()
} }
@ -296,7 +290,7 @@ export default {
markerSource.addFeatures(features) markerSource.addFeatures(features)
map.addLayer(markerLayer) map.addLayer(markerLayer)
}, },
addMarker_1 (list, icon=iconArray[0], scale=1) { addMarker_1(list, icon = iconArray[0], scale = 1) {
if (markerSource_1) { if (markerSource_1) {
markerSource_1.clear() markerSource_1.clear()
} }
@ -328,7 +322,7 @@ export default {
markerSource_1.addFeatures(features) markerSource_1.addFeatures(features)
map.addLayer(markerLayer_1) map.addLayer(markerLayer_1)
}, },
addMarker_2 (list, icon=iconArray[0], scale=1) { addMarker_2(list, icon = iconArray[0], scale = 1) {
if (markerSource_2) { if (markerSource_2) {
markerSource_2.clear() markerSource_2.clear()
} }
@ -361,7 +355,7 @@ export default {
map.addLayer(markerLayer_2) map.addLayer(markerLayer_2)
}, },
// //
async loadOrgData () { async loadOrgData() {
const url = "/gov/org/agency/maporg" const url = "/gov/org/agency/maporg"
let params = { let params = {
@ -390,7 +384,7 @@ export default {
}, },
// //
loadParentPolygon () { loadParentPolygon() {
let featureData = []// let featureData = []//
if (this.parentPolygon && this.parentPolygon.length > 0) {// if (this.parentPolygon && this.parentPolygon.length > 0) {//
let oneData = {} let oneData = {}
@ -444,7 +438,7 @@ export default {
}, },
// //
loadPolygon () { loadPolygon() {
let featureData = []// let featureData = []//
if (this.subAgencyArray && this.subAgencyArray.length > 0) {// if (this.subAgencyArray && this.subAgencyArray.length > 0) {//
@ -544,7 +538,7 @@ export default {
}, },
// //
addParentLayer () { addParentLayer() {
parentSource = new VectorSource({ parentSource = new VectorSource({
//features: (new GeoJSON()).readFeatures(geojsonObject) //features: (new GeoJSON()).readFeatures(geojsonObject)
}); });
@ -556,7 +550,7 @@ export default {
map.addLayer(parentLayer) map.addLayer(parentLayer)
}, },
// //
addPolygonLayer () { addPolygonLayer() {
polygonSource = new VectorSource({ polygonSource = new VectorSource({
//features: (new GeoJSON()).readFeatures(geojsonObject) //features: (new GeoJSON()).readFeatures(geojsonObject)
}); });
@ -608,7 +602,7 @@ export default {
}, },
addIconLayer () { addIconLayer() {
iconSource = new VectorSource({ iconSource = new VectorSource({
//features: (new GeoJSON()).readFeatures(geojsonObject) //features: (new GeoJSON()).readFeatures(geojsonObject)
}); });

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

@ -151,33 +151,30 @@
</template> </template>
<script> <script>
import "ol/ol.css"; // import "ol/ol.css";
import { requestPost } from "@/js/dai/request";
import { mapType } from "@/utils/dai-map";
import { Loading } from "element-ui"; //Loading
import { Map, View } from "ol"; import { Map, View } from "ol";
import TileLayer from "ol/layer/Tile.js"; import { altKeyOnly, click } from "ol/events/condition";
import XYZ from "ol/source/XYZ.js"; import { getWidth } from "ol/extent.js";
import VectorLayer from "ol/layer/Vector.js";
import VectorSource from "ol/source/Vector.js";
import GeoJSON from "ol/format/GeoJSON.js"; import GeoJSON from "ol/format/GeoJSON.js";
import { defaults as defaultControls, ZoomToExtent } from "ol/control.js";
import { import {
defaults as defaultInteractions,
Modify,
Select,
DoubleClickZoom, DoubleClickZoom,
Select
} from "ol/interaction.js"; } from "ol/interaction.js";
import { getCenter, getWidth } from "ol/extent.js";
import { Circle as CircleStyle, Fill, Stroke, Style, Text } from "ol/style.js";
import Draw from "ol/interaction/Draw.js"; import Draw from "ol/interaction/Draw.js";
import { mapGetters } from "vuex"; import TileLayer from "ol/layer/Tile.js";
import { Loading } from "element-ui"; //Loading import VectorLayer from "ol/layer/Vector.js";
import { requestPost } from "@/js/dai/request"; import { Projection, addProjection, get as getProjection } from "ol/proj.js";
import { altKeyOnly, click, pointerMove } from "ol/events/condition"; import { register as registerProj4 } from "ol/proj/proj4";
import VectorSource from "ol/source/Vector.js";
import WMTS from "ol/source/WMTS.js"; import WMTS from "ol/source/WMTS.js";
import XYZ from "ol/source/XYZ.js";
import { Fill, Stroke, Style, Text } from "ol/style.js";
import WMTSTileGrid from "ol/tilegrid/WMTS.js"; import WMTSTileGrid from "ol/tilegrid/WMTS.js";
import { mapType } from "@/utils/dai-map";
import { get as getProjection, Projection, addProjection } from "ol/proj.js";
import proj4 from "proj4"; import proj4 from "proj4";
import { register as registerProj4 } from "ol/proj/proj4"; import { mapGetters } from "vuex";
var centerPointGlobal = [120.664619, 36.504963]; var centerPointGlobal = [120.664619, 36.504963];
let loading; // let loading; //
@ -255,7 +252,7 @@ var polygonStyleFunction = (function () {
const vueGis = { const vueGis = {
name: "HomeMap", name: "HomeMap",
data () { data() {
return { return {
method: "", // method: "", //
centerPoint: [], // centerPoint: [], //
@ -301,7 +298,7 @@ const vueGis = {
latitude: undefined, latitude: undefined,
}; };
}, },
async mounted () { async mounted() {
// //
await this.loadOrgData(); await this.loadOrgData();
// this.runAgency.push(this.orgData) // this.runAgency.push(this.orgData)
@ -325,7 +322,7 @@ const vueGis = {
}, },
methods: { methods: {
// //
orgChange (index) { orgChange(index) {
this.selAgencyIndex = index; this.selAgencyIndex = index;
selectedFeatures.clear(); selectedFeatures.clear();
@ -345,7 +342,7 @@ const vueGis = {
}, },
// isRefreshView: // isRefreshView:
async refreshMap (isRefreshView) { async refreshMap(isRefreshView) {
// //
await this.loadOrgData(); await this.loadOrgData();
this.loadParentPolygon(); this.loadParentPolygon();
@ -361,7 +358,7 @@ const vueGis = {
}, },
// //
handleBack () { handleBack() {
this.center = this.runAgency[this.runNum - 1].center; this.center = this.runAgency[this.runNum - 1].center;
this.zoom = this.runAgency[this.runNum - 1].zoom; this.zoom = this.runAgency[this.runNum - 1].zoom;
this.selAgencyId = ""; this.selAgencyId = "";
@ -380,7 +377,7 @@ const vueGis = {
}, },
// //
async loadOrgData () { async loadOrgData() {
const url = "/gov/org/agency/maporg"; const url = "/gov/org/agency/maporg";
// const url = "http://yapi.elinkservice.cn/mock/245/gov/org/agency/maporg" // const url = "http://yapi.elinkservice.cn/mock/245/gov/org/agency/maporg"
let params = { let params = {
@ -415,7 +412,7 @@ const vueGis = {
}, },
// //
loadParentPolygon () { loadParentPolygon() {
parentSource.clear(); // parentSource.clear(); //
let featureData = []; // let featureData = []; //
@ -470,7 +467,7 @@ const vueGis = {
} }
}, },
// //
loadPolygon (subAgencyArray) { loadPolygon(subAgencyArray) {
polygonSource.clear(); // polygonSource.clear(); //
let featureData = []; // let featureData = []; //
@ -527,7 +524,7 @@ const vueGis = {
}, },
//feature //feature
selectFeature (e) { selectFeature(e) {
if (e.selected.length > 0) { if (e.selected.length > 0) {
console.log("selectFeature22222222222222222222222"); console.log("selectFeature22222222222222222222222");
if (this.method === undefined || this.method === "") { if (this.method === undefined || this.method === "") {
@ -542,7 +539,7 @@ const vueGis = {
} }
}, },
// //
toSubAgency (e) { toSubAgency(e) {
if (!e.selected[0]) { if (!e.selected[0]) {
return false; return false;
} }
@ -572,7 +569,7 @@ const vueGis = {
}, },
// //
highlightPolygon () { highlightPolygon() {
let features = polygonSource.getFeatures(); let features = polygonSource.getFeatures();
features.forEach((element) => { features.forEach((element) => {
if (element.id_ === this.selAgencyId) { if (element.id_ === this.selAgencyId) {
@ -585,7 +582,7 @@ const vueGis = {
}); });
}, },
// //
setMapLocation () { setMapLocation() {
this.centerPoint = []; this.centerPoint = [];
if (this.center && this.center.length > 0) { if (this.center && this.center.length > 0) {
@ -603,7 +600,7 @@ const vueGis = {
}, },
// //
setZoom (agencyLevel) { setZoom(agencyLevel) {
if (agencyLevel === "district") { if (agencyLevel === "district") {
this.zoom = 12; this.zoom = 12;
} else if (agencyLevel === "street") { } else if (agencyLevel === "street") {
@ -615,7 +612,7 @@ const vueGis = {
} }
}, },
initMap () { initMap() {
this.setMapLocation(); this.setMapLocation();
gaodeMapLayer = new TileLayer({ gaodeMapLayer = new TileLayer({
@ -677,7 +674,7 @@ const vueGis = {
}, },
// //
initMap2 () { initMap2() {
this.setMapLocation(); this.setMapLocation();
proj4.defs( proj4.defs(
@ -699,7 +696,7 @@ const vueGis = {
let size = getWidth(projectionExtent) / 256; //size let size = getWidth(projectionExtent) / 256; //size
let matrixIds = []; let matrixIds = [];
function getResolutions () { function getResolutions() {
let resolutions = []; let resolutions = [];
for (let z = 7; z < 19; ++z) { for (let z = 7; z < 19; ++z) {
resolutions[z] = size / Math.pow(2, z); resolutions[z] = size / Math.pow(2, z);
@ -734,7 +731,7 @@ const vueGis = {
style: "default", style: "default",
tilematrixset: "c", tilematrixset: "c",
// wrapX: true, // wrapX: true,
tileLoadFunction (imageTile, src) { tileLoadFunction(imageTile, src) {
// 使 // 使
let img = new Image(); let img = new Image();
// img.crossOrigin = '' // img.crossOrigin = ''
@ -790,7 +787,7 @@ const vueGis = {
}, },
// //
addParentLayer () { addParentLayer() {
parentSource = new VectorSource({ parentSource = new VectorSource({
//features: (new GeoJSON()).readFeatures(geojsonObject) //features: (new GeoJSON()).readFeatures(geojsonObject)
}); });
@ -804,7 +801,7 @@ const vueGis = {
map.addLayer(parentLayer); map.addLayer(parentLayer);
}, },
// //
addPolygonLayer () { addPolygonLayer() {
polygonSource = new VectorSource({ polygonSource = new VectorSource({
//features: (new GeoJSON()).readFeatures(geojsonObject) //features: (new GeoJSON()).readFeatures(geojsonObject)
}); });
@ -865,7 +862,7 @@ const vueGis = {
}); });
}, },
// //
handleManually () { handleManually() {
this.dialogVisible = true; this.dialogVisible = true;
this.polygonManullyString = ""; this.polygonManullyString = "";
this.longitude = undefined; this.longitude = undefined;
@ -881,11 +878,11 @@ const vueGis = {
}, },
// //
handleClose () { handleClose() {
this.dialogVisible = false; this.dialogVisible = false;
}, },
handleManuallyOk () { handleManuallyOk() {
if (this.longitude || this.latitude) { if (this.longitude || this.latitude) {
if (!(this.longitude && this.latitude)) { if (!(this.longitude && this.latitude)) {
this.$message({ this.$message({
@ -937,10 +934,10 @@ const vueGis = {
} }
}, },
handleSetOffset () { handleSetOffset() {
this.showOffset = true; this.showOffset = true;
}, },
handleOffsetOk () { handleOffsetOk() {
let selPolygonString = ""; let selPolygonString = "";
this.subAgencyArray.forEach((element) => { this.subAgencyArray.forEach((element) => {
@ -957,7 +954,7 @@ const vueGis = {
this.saveOffset(this.xOffset, this.yOffset, selPolygonString); this.saveOffset(this.xOffset, this.yOffset, selPolygonString);
} }
}, },
saveOffset (xOffset, yOffset, selPolygonString) { saveOffset(xOffset, yOffset, selPolygonString) {
let offsetPolygonString = ""; // let offsetPolygonString = ""; //
let tempArray = selPolygonString.split(","); let tempArray = selPolygonString.split(",");
@ -983,12 +980,12 @@ const vueGis = {
); );
this.addPolygon(offsetPolygonString); this.addPolygon(offsetPolygonString);
}, },
handleSetOffset () { handleSetOffset() {
this.handleOffsetCancel = false; this.handleOffsetCancel = false;
}, },
// //
handleAddPolygon () { handleAddPolygon() {
if (this.method === "mAddPolygon") { if (this.method === "mAddPolygon") {
this.method = ""; this.method = "";
map.removeInteraction(draw); map.removeInteraction(draw);
@ -1005,7 +1002,7 @@ const vueGis = {
}, },
// //
handleEditPolygon () { handleEditPolygon() {
if (this.method === "mEditPolygon") { if (this.method === "mEditPolygon") {
this.method = ""; this.method = "";
map.removeInteraction(draw); map.removeInteraction(draw);
@ -1021,7 +1018,7 @@ const vueGis = {
}, },
// //
handleDelPolygon () { handleDelPolygon() {
map.removeInteraction(draw); map.removeInteraction(draw);
this.$confirm("确认删除" + this.selAgency.name + "?", "提示", { this.$confirm("确认删除" + this.selAgency.name + "?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
@ -1044,7 +1041,7 @@ const vueGis = {
}, },
//Polygon //Polygon
hidePolygon () { hidePolygon() {
let polygonTempArray = []; let polygonTempArray = [];
this.subAgencyArray.forEach((element) => { this.subAgencyArray.forEach((element) => {
@ -1057,7 +1054,7 @@ const vueGis = {
}, },
//Polygon //Polygon
drawPolygon () { drawPolygon() {
draw = new Draw({ draw = new Draw({
source: polygonSource, source: polygonSource,
type: "Polygon", type: "Polygon",
@ -1097,7 +1094,7 @@ const vueGis = {
}, },
// //
async addPolygon (coorString) { async addPolygon(coorString) {
console.log(coorString); console.log(coorString);
const url = "/gov/org/agency/mapaddarea"; const url = "/gov/org/agency/mapaddarea";
@ -1130,7 +1127,7 @@ const vueGis = {
}, },
// //
async delPolygon () { async delPolygon() {
const url = "/gov/org/agency/mapdelarea"; const url = "/gov/org/agency/mapdelarea";
let params = { let params = {
@ -1151,7 +1148,7 @@ const vueGis = {
} }
}, },
// //
startLoading () { startLoading() {
loading = Loading.service({ loading = Loading.service({
lock: true, // lock: true, //
text: "正在加载……", // text: "正在加载……", //
@ -1160,7 +1157,7 @@ const vueGis = {
}, },
// //
endLoading () { endLoading() {
//clearTimeout(timer); //clearTimeout(timer);
if (loading) { if (loading) {
loading.close(); loading.close();
@ -1174,17 +1171,17 @@ const vueGis = {
}, },
}, },
computed: { computed: {
extentXOffset () { extentXOffset() {
if (this.clientHeight < 900) { if (this.clientHeight < 900) {
return 0.88; return 0.88;
} else { } else {
return 0.95; return 0.95;
} }
}, },
extentYOffset () { extentYOffset() {
return 0.95; return 0.95;
}, },
imgExtent () { imgExtent() {
return [ return [
-x * this.extentXOffset, -x * this.extentXOffset,
-y * this.extentYOffset, -y * this.extentYOffset,
@ -1192,7 +1189,7 @@ const vueGis = {
y * this.extentYOffset, y * this.extentYOffset,
]; ];
}, },
mapHeight () { mapHeight() {
return this.clientHeight - 170; return this.clientHeight - 170;
}, },
// zoom: { // zoom: {

Loading…
Cancel
Save