井乐禹 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 People from "@/views/modules/visual/basicinfo/people";
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 sidemenuLeft from "@/views/modules/visual/command/cpts/sidemenu-left";
import sidemenu1 from "@/views/modules/visual/command/cpts/yantai-sidemenu1";
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 { Loading } from "element-ui"; //Loading
import { mapGetters } from "vuex";
import demandInfo from "@/views/modules/visual/command/cpts/demandInfo";
import eventInfo from "@/views/modules/visual/command/cpts/eventInfo";

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

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

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

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

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

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

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

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

Loading…
Cancel
Save