|
@@ -1,17 +1,13 @@
|
|
|
<template>
|
|
|
<div
|
|
|
id="viewDiv"
|
|
|
- ref="back_box"
|
|
|
- v-loading="loading"
|
|
|
- :element-loading-text="loadText"
|
|
|
- element-loading-spinner="el-icon-loading"
|
|
|
- element-loading-background="rgba(255, 255, 255, 0.8)"
|
|
|
+
|
|
|
>
|
|
|
- <tf-dialog
|
|
|
+ <!-- <tf-dialog
|
|
|
:show.sync="panels.tfDialog.Show"
|
|
|
:hide.sync="panels.tfDialog.Hide"
|
|
|
:set-size.sync="panels.tfDialog.setSize"
|
|
|
- />
|
|
|
+ /> -->
|
|
|
<el-container style="height: 100%; width: 100%">
|
|
|
<el-container
|
|
|
:style="{
|
|
@@ -202,51 +198,51 @@
|
|
|
</template>
|
|
|
<script lang="ts">
|
|
|
import { Vue, Component, Watch, Prop } from 'vue-property-decorator'
|
|
|
-import 'ol/ol.css'
|
|
|
-import Map from 'ol/Map'
|
|
|
-import View from 'ol/View'
|
|
|
-import TileLayer from 'ol/layer/Tile'
|
|
|
-import { Logo, TileSuperMapRest, SuperMap, LayerInfoService } from '@supermap/iclient-ol'
|
|
|
-import axios from 'axios'
|
|
|
-import Comps from '@/layout/components/loadComps'
|
|
|
+// import 'ol/ol.css'
|
|
|
+// import Map from 'ol/Map'
|
|
|
+// import View from 'ol/View'
|
|
|
+// import TileLayer from 'ol/layer/Tile'
|
|
|
+// import { Logo, TileSuperMapRest, SuperMap, LayerInfoService } from '@supermap/iclient-ol'
|
|
|
+// import axios from 'axios'
|
|
|
+// import Comps from '@/layout/components/loadComps'
|
|
|
import { HalfPanels, FullPanels, FloatPanels, SidePanels } from '@/layout/components/index'
|
|
|
-import { appconfig } from 'staticPub/config'
|
|
|
-import { loadCss } from '@/utils/loadResources'
|
|
|
-import request from '@/utils/request'
|
|
|
-import tfDialog from './common/Dialog.vue'
|
|
|
-import WidgetGroup from './tongyonggongju/widgetGroup/widget.vue'
|
|
|
-import MeasureTool from './tongyonggongju/measureTool/widget.vue'
|
|
|
-import QueryTool from './tongyonggongju/queryTool/widget.vue'
|
|
|
-import SimpleQueryTool from './tongyonggongju/simpleQueryTool/widget.vue'
|
|
|
-import leftBottomTool from './tongyonggongju/leftBottomTool/widget.vue'
|
|
|
-import leftTopTool from './tongyonggongju/leftTopTool/widget.vue'
|
|
|
-import rightBottomTool from './tongyonggongju/rightBottomTool/widget.vue'
|
|
|
-import rightTopTool from './tongyonggongju/rightTopTool/widget.vue'
|
|
|
-import popupWindow from '@/components/PopupWindow/popupWindow.vue'
|
|
|
+// import { appconfig } from 'staticPub/config'
|
|
|
+// import { loadCss } from '@/utils/loadResources'
|
|
|
+// import request from '@/utils/request'
|
|
|
+// import tfDialog from './common/Dialog.vue'
|
|
|
+// import WidgetGroup from './tongyonggongju/widgetGroup/widget.vue'
|
|
|
+// import MeasureTool from './tongyonggongju/measureTool/widget.vue'
|
|
|
+// import QueryTool from './tongyonggongju/queryTool/widget.vue'
|
|
|
+// import SimpleQueryTool from './tongyonggongju/simpleQueryTool/widget.vue'
|
|
|
+// import leftBottomTool from './tongyonggongju/leftBottomTool/widget.vue'
|
|
|
+// import leftTopTool from './tongyonggongju/leftTopTool/widget.vue'
|
|
|
+// import rightBottomTool from './tongyonggongju/rightBottomTool/widget.vue'
|
|
|
+// import rightTopTool from './tongyonggongju/rightTopTool/widget.vue'
|
|
|
+// import popupWindow from '@/components/PopupWindow/popupWindow.vue'
|
|
|
import cesiumMap from '@/views/widgets/cesiumMap.vue'
|
|
|
// 投影
|
|
|
-import { Projection, addProjection, get as getProjection, fromLonLat, transform } from 'ol/proj'
|
|
|
-import { register as olRegisterProj } from 'ol/proj/proj4'
|
|
|
-import proj4 from 'proj4'
|
|
|
-import { Feature } from 'ol'
|
|
|
-import { LineString } from 'ol/geom'
|
|
|
-import VectorLayer from 'ol/layer/Vector'
|
|
|
-import VectorSource from 'ol/source/Vector'
|
|
|
-import { comSymbol } from '@/utils/comSymbol'
|
|
|
-import { LegendConfig } from '@/views/zhpt/common/legendConfig'
|
|
|
+// import { Projection, addProjection, get as getProjection, fromLonLat, transform } from 'ol/proj'
|
|
|
+// import { register as olRegisterProj } from 'ol/proj/proj4'
|
|
|
+// import proj4 from 'proj4'
|
|
|
+// import { Feature } from 'ol'
|
|
|
+// import { LineString } from 'ol/geom'
|
|
|
+// import VectorLayer from 'ol/layer/Vector'
|
|
|
+// import VectorSource from 'ol/source/Vector'
|
|
|
+// import { comSymbol } from '@/utils/comSymbol'
|
|
|
+// import { LegendConfig } from '@/views/zhpt/common/legendConfig'
|
|
|
|
|
|
-import { mapUtil } from '@/views/zhpt/common/mapUtil/common'
|
|
|
-import { TF_Layer } from '@/views/zhpt/common/mapUtil/layer'
|
|
|
-import { Polygon } from 'ol/geom'
|
|
|
-import { WMTS } from 'ol/source'
|
|
|
-import * as olExtent from 'ol/extent'
|
|
|
-import WMTSTileGrid from 'ol/tilegrid/WMTS'
|
|
|
-import * as olProj from 'ol/proj'
|
|
|
-import { defaults as controls } from 'ol/control'
|
|
|
-import * as turf from '@turf/turf'
|
|
|
-import iQuery from './common/mapUtil/query'
|
|
|
-import { unByKey } from 'ol/Observable'
|
|
|
-import GeoJSON from 'ol/format/GeoJSON'
|
|
|
+// import { mapUtil } from '@/views/zhpt/common/mapUtil/common'
|
|
|
+// import { TF_Layer } from '@/views/zhpt/common/mapUtil/layer'
|
|
|
+// import { Polygon } from 'ol/geom'
|
|
|
+// import { WMTS } from 'ol/source'
|
|
|
+// import * as olExtent from 'ol/extent'
|
|
|
+// import WMTSTileGrid from 'ol/tilegrid/WMTS'
|
|
|
+// import * as olProj from 'ol/proj'
|
|
|
+// import { defaults as controls } from 'ol/control'
|
|
|
+// import * as turf from '@turf/turf'
|
|
|
+// import iQuery from './common/mapUtil/query'
|
|
|
+// import { unByKey } from 'ol/Observable'
|
|
|
+// import GeoJSON from 'ol/format/GeoJSON'
|
|
|
|
|
|
@Component({
|
|
|
components: {
|
|
@@ -254,16 +250,16 @@ import GeoJSON from 'ol/format/GeoJSON'
|
|
|
FullPanels,
|
|
|
FloatPanels,
|
|
|
SidePanels,
|
|
|
- tfDialog,
|
|
|
- WidgetGroup,
|
|
|
- MeasureTool,
|
|
|
- QueryTool,
|
|
|
- SimpleQueryTool,
|
|
|
- leftBottomTool,
|
|
|
- leftTopTool,
|
|
|
- rightBottomTool,
|
|
|
- rightTopTool,
|
|
|
- popupWindow,
|
|
|
+ // tfDialog,
|
|
|
+ // WidgetGroup,
|
|
|
+ // MeasureTool,
|
|
|
+ // QueryTool,
|
|
|
+ // SimpleQueryTool,
|
|
|
+ // leftBottomTool,
|
|
|
+ // leftTopTool,
|
|
|
+ // rightBottomTool,
|
|
|
+ // rightTopTool,
|
|
|
+ // popupWindow,
|
|
|
cesiumMap
|
|
|
}
|
|
|
})
|
|
@@ -342,7 +338,7 @@ export default class BaseMap extends Vue {
|
|
|
PanelsChange(n, o) {
|
|
|
if (n.length === 0) {
|
|
|
this.$nextTick(() => {
|
|
|
- this.view.updateSize()
|
|
|
+ // this.view.updateSize()
|
|
|
})
|
|
|
}
|
|
|
}
|
|
@@ -350,7 +346,7 @@ export default class BaseMap extends Vue {
|
|
|
HalfPanelsChange(n, o) {
|
|
|
if (n.length === 0) {
|
|
|
this.$nextTick(() => {
|
|
|
- this.view.updateSize()
|
|
|
+ // this.view.updateSize()
|
|
|
})
|
|
|
}
|
|
|
}
|
|
@@ -388,11 +384,11 @@ export default class BaseMap extends Vue {
|
|
|
this.currTitle = n
|
|
|
}
|
|
|
created() {
|
|
|
- console.log('=====', this.Comps)
|
|
|
+ // console.log('=====', this.Comps)
|
|
|
}
|
|
|
mounted() {
|
|
|
- console.log('地图重新加载')
|
|
|
- this.loading = false
|
|
|
+ // console.log('地图重新加载')
|
|
|
+ // this.loading = false
|
|
|
// this.initConfig() // 加载配置 ==> 加载地图
|
|
|
}
|
|
|
// 页面初始化
|
|
@@ -418,312 +414,312 @@ export default class BaseMap extends Vue {
|
|
|
handelClose() {
|
|
|
this.show = false
|
|
|
}
|
|
|
- async initMap() {
|
|
|
- let { initCenter, initZoom } = appconfig
|
|
|
+ // async initMap() {
|
|
|
+ // let { initCenter, initZoom } = appconfig
|
|
|
|
|
|
- let layerResource = appconfig.gisResource['iserver_resource'].layerService.layers
|
|
|
- let map = new Map({
|
|
|
- target: 'mapView',
|
|
|
- controls: controls({
|
|
|
- zoom: false,
|
|
|
- attribution: false
|
|
|
- }),
|
|
|
- view: new View({
|
|
|
- center: initCenter,
|
|
|
- zoom: initZoom,
|
|
|
- maxZoom: 21,
|
|
|
- minZoom: 5,
|
|
|
- projection: 'EPSG:4326'
|
|
|
- })
|
|
|
- })
|
|
|
- this.panels.mapView = this.view = this.$store.state.gis.map = map
|
|
|
- this.addLayers(layerResource)
|
|
|
+ // let layerResource = appconfig.gisResource['iserver_resource'].layerService.layers
|
|
|
+ // let map = new Map({
|
|
|
+ // target: 'mapView',
|
|
|
+ // controls: controls({
|
|
|
+ // zoom: false,
|
|
|
+ // attribution: false
|
|
|
+ // }),
|
|
|
+ // view: new View({
|
|
|
+ // center: initCenter,
|
|
|
+ // zoom: initZoom,
|
|
|
+ // maxZoom: 21,
|
|
|
+ // minZoom: 5,
|
|
|
+ // projection: 'EPSG:4326'
|
|
|
+ // })
|
|
|
+ // })
|
|
|
+ // this.panels.mapView = this.view = this.$store.state.gis.map = map
|
|
|
+ // this.addLayers(layerResource)
|
|
|
|
|
|
- this.loading = false
|
|
|
- this.$store.commit('map/LOADING', false)
|
|
|
- this.$nextTick(this.controlToolDisplay)
|
|
|
- // 触发地图视野变化
|
|
|
- let timer = null,
|
|
|
- time = 500
|
|
|
- this.view.getView().on('change', (evt) => {
|
|
|
- // console.log('级别变化', this.view)
|
|
|
- timer && clearTimeout(timer)
|
|
|
- timer = setTimeout(() => {
|
|
|
- let extent = new mapUtil(this.view).getCurrentViewExtent()
|
|
|
- this.$store.state.gis.mapExtent = extent
|
|
|
- }, time)
|
|
|
- })
|
|
|
- // 点击查询管段详情
|
|
|
- this.view.on('click', (evt) => {
|
|
|
- let filter = this.$store.state.routeSetting.routes[0].name === 'leftBottomTool'
|
|
|
- if (!filter || !this.openPopupSwitch) return
|
|
|
- this.spaceQuery(evt.coordinate)
|
|
|
- })
|
|
|
- this.vectorLayer = new VectorLayer({
|
|
|
- source: new VectorSource(),
|
|
|
- style: comSymbol.getAllStyle(3, 'f00', 5, '#00ffff', 'rgba(255, 255, 255, 0.6)')
|
|
|
- })
|
|
|
+ // this.loading = false
|
|
|
+ // this.$store.commit('map/LOADING', false)
|
|
|
+ // this.$nextTick(this.controlToolDisplay)
|
|
|
+ // // 触发地图视野变化
|
|
|
+ // let timer = null,
|
|
|
+ // time = 500
|
|
|
+ // this.view.getView().on('change', (evt) => {
|
|
|
+ // // console.log('级别变化', this.view)
|
|
|
+ // timer && clearTimeout(timer)
|
|
|
+ // timer = setTimeout(() => {
|
|
|
+ // let extent = new mapUtil(this.view).getCurrentViewExtent()
|
|
|
+ // this.$store.state.gis.mapExtent = extent
|
|
|
+ // }, time)
|
|
|
+ // })
|
|
|
+ // // 点击查询管段详情
|
|
|
+ // this.view.on('click', (evt) => {
|
|
|
+ // let filter = this.$store.state.routeSetting.routes[0].name === 'leftBottomTool'
|
|
|
+ // if (!filter || !this.openPopupSwitch) return
|
|
|
+ // this.spaceQuery(evt.coordinate)
|
|
|
+ // })
|
|
|
+ // this.vectorLayer = new VectorLayer({
|
|
|
+ // source: new VectorSource(),
|
|
|
+ // style: comSymbol.getAllStyle(3, 'f00', 5, '#00ffff', 'rgba(255, 255, 255, 0.6)')
|
|
|
+ // })
|
|
|
|
|
|
- this.view.addLayer(this.vectorLayer)
|
|
|
- // this.view.getView().setCenter([101.724022, 26.580702])
|
|
|
- }
|
|
|
+ // this.view.addLayer(this.vectorLayer)
|
|
|
+ // // this.view.getView().setCenter([101.724022, 26.580702])
|
|
|
+ // }
|
|
|
|
|
|
- spaceQuery(position) {
|
|
|
- console.log('查询')
|
|
|
- let queryFeature = turf.buffer(turf.point(position), 2, { units: 'meters' }) as any
|
|
|
- queryFeature = new GeoJSON().readFeature(queryFeature)
|
|
|
- let dataServerConfig = appconfig.gisResource.iserver_resource.dataService
|
|
|
- new iQuery().spaceQuery(queryFeature).then((queryData) => {
|
|
|
- let showData = []
|
|
|
- for (let data of queryData as any) {
|
|
|
- let features = data ? data.result.features.features : []
|
|
|
- if (features.length !== 0) {
|
|
|
- showData.push(data)
|
|
|
- }
|
|
|
- }
|
|
|
- if (showData.length !== 0) {
|
|
|
- let openData = showData.find((data) => data.result.features.features[0].geometry.type === 'Point')
|
|
|
- // 点优于线显示
|
|
|
- let featureData = openData ? openData : showData[0]
|
|
|
- let layerName = featureData.tableName
|
|
|
- //
|
|
|
- let layer = mapUtil.getAllSubLayerNames('pipemap', 'smlayergroup')
|
|
|
- let feature = featureData.result.features.features[0]
|
|
|
- let findLayer
|
|
|
- layer.sublayers.forEach((p) => {
|
|
|
- let layername = p.title
|
|
|
- let sublayer = p.sublayers.find((sub) => sub.name.split('@')[0] === layerName)
|
|
|
- if (sublayer) {
|
|
|
- feature.layerName = layername
|
|
|
- feature.tableName = sublayer.name.split('@')[0]
|
|
|
- }
|
|
|
- })
|
|
|
+ // spaceQuery(position) {
|
|
|
+ // console.log('查询')
|
|
|
+ // let queryFeature = turf.buffer(turf.point(position), 2, { units: 'meters' }) as any
|
|
|
+ // queryFeature = new GeoJSON().readFeature(queryFeature)
|
|
|
+ // let dataServerConfig = appconfig.gisResource.iserver_resource.dataService
|
|
|
+ // new iQuery().spaceQuery(queryFeature).then((queryData) => {
|
|
|
+ // let showData = []
|
|
|
+ // for (let data of queryData as any) {
|
|
|
+ // let features = data ? data.result.features.features : []
|
|
|
+ // if (features.length !== 0) {
|
|
|
+ // showData.push(data)
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // if (showData.length !== 0) {
|
|
|
+ // let openData = showData.find((data) => data.result.features.features[0].geometry.type === 'Point')
|
|
|
+ // // 点优于线显示
|
|
|
+ // let featureData = openData ? openData : showData[0]
|
|
|
+ // let layerName = featureData.tableName
|
|
|
+ // //
|
|
|
+ // let layer = mapUtil.getAllSubLayerNames('pipemap', 'smlayergroup')
|
|
|
+ // let feature = featureData.result.features.features[0]
|
|
|
+ // let findLayer
|
|
|
+ // layer.sublayers.forEach((p) => {
|
|
|
+ // let layername = p.title
|
|
|
+ // let sublayer = p.sublayers.find((sub) => sub.name.split('@')[0] === layerName)
|
|
|
+ // if (sublayer) {
|
|
|
+ // feature.layerName = layername
|
|
|
+ // feature.tableName = sublayer.name.split('@')[0]
|
|
|
+ // }
|
|
|
+ // })
|
|
|
|
|
|
- let com = this.$refs.popupWindow as any
|
|
|
- com.showPopup(position, feature, afterClosePopup, true)
|
|
|
- let vectorLayer = new VectorLayer({
|
|
|
- source: new VectorSource(),
|
|
|
- style: mapUtil.getCommonStyle()
|
|
|
- })
|
|
|
- let ifeature = new GeoJSON().readFeature(feature)
|
|
|
- if (ifeature) {
|
|
|
- vectorLayer.getSource().addFeature(ifeature)
|
|
|
- this.view.addLayer(vectorLayer)
|
|
|
- }
|
|
|
- // 关闭弹窗后
|
|
|
- function afterClosePopup() {
|
|
|
- vectorLayer.getSource().removeFeature(ifeature)
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
+ // let com = this.$refs.popupWindow as any
|
|
|
+ // com.showPopup(position, feature, afterClosePopup, true)
|
|
|
+ // let vectorLayer = new VectorLayer({
|
|
|
+ // source: new VectorSource(),
|
|
|
+ // style: mapUtil.getCommonStyle()
|
|
|
+ // })
|
|
|
+ // let ifeature = new GeoJSON().readFeature(feature)
|
|
|
+ // if (ifeature) {
|
|
|
+ // vectorLayer.getSource().addFeature(ifeature)
|
|
|
+ // this.view.addLayer(vectorLayer)
|
|
|
+ // }
|
|
|
+ // // 关闭弹窗后
|
|
|
+ // function afterClosePopup() {
|
|
|
+ // vectorLayer.getSource().removeFeature(ifeature)
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // }
|
|
|
|
|
|
- // 设置是否开启弹窗
|
|
|
- setPopupSwitch(isopen) {
|
|
|
- this.openPopupSwitch = isopen
|
|
|
- }
|
|
|
- // 加载图层
|
|
|
- addLayers(layersSource) {
|
|
|
- new TF_Layer().createLayers(layersSource).then((layers) => {
|
|
|
- layers.forEach((layer) => {
|
|
|
- layer && this.view.addLayer(layer)
|
|
|
- })
|
|
|
- })
|
|
|
- }
|
|
|
+ // // 设置是否开启弹窗
|
|
|
+ // setPopupSwitch(isopen) {
|
|
|
+ // this.openPopupSwitch = isopen
|
|
|
+ // }
|
|
|
+ // // 加载图层
|
|
|
+ // addLayers(layersSource) {
|
|
|
+ // new TF_Layer().createLayers(layersSource).then((layers) => {
|
|
|
+ // layers.forEach((layer) => {
|
|
|
+ // layer && this.view.addLayer(layer)
|
|
|
+ // })
|
|
|
+ // })
|
|
|
+ // }
|
|
|
|
|
|
- legendClick() {
|
|
|
- this.legendHide = !this.legendHide
|
|
|
- var whichP = [
|
|
|
- ['收缩', 350, '▼'],
|
|
|
- ['展开', 0, '▲']
|
|
|
- ][this.legendHide ? 0 : 1]
|
|
|
- //@ts-ignore
|
|
|
- this.$refs.legend_close.title = whichP[0]
|
|
|
- //@ts-ignore
|
|
|
- this.$refs.legend.style.height = whichP[1] + 'px'
|
|
|
- //@ts-ignore
|
|
|
- this.$refs.legend_close.innerHTML = whichP[2]
|
|
|
- }
|
|
|
+ // legendClick() {
|
|
|
+ // this.legendHide = !this.legendHide
|
|
|
+ // var whichP = [
|
|
|
+ // ['收缩', 350, '▼'],
|
|
|
+ // ['展开', 0, '▲']
|
|
|
+ // ][this.legendHide ? 0 : 1]
|
|
|
+ // //@ts-ignore
|
|
|
+ // this.$refs.legend_close.title = whichP[0]
|
|
|
+ // //@ts-ignore
|
|
|
+ // this.$refs.legend.style.height = whichP[1] + 'px'
|
|
|
+ // //@ts-ignore
|
|
|
+ // this.$refs.legend_close.innerHTML = whichP[2]
|
|
|
+ // }
|
|
|
|
|
|
- // 定位某条管线
|
|
|
- setPipesView(pipes) {
|
|
|
- let coors = pipes || [
|
|
|
- [113.14459646427814, 29.365111002105298],
|
|
|
- [113.14462310850658, 29.36565173168358]
|
|
|
- ]
|
|
|
- let feature = new Feature({ geometry: new LineString(coors) })
|
|
|
- if (!this.vectorLayer) {
|
|
|
- this.vectorLayer = new VectorLayer({
|
|
|
- source: new VectorSource(),
|
|
|
- style: comSymbol.getAllStyle(3, 'f00', 5, '#00ffff', 'fff6')
|
|
|
- })
|
|
|
- this.view.addLayer(this.vectorLayer)
|
|
|
- }
|
|
|
- this.vectorLayer.getSource().clear()
|
|
|
- this.vectorLayer.getSource().addFeature(feature)
|
|
|
- //
|
|
|
- let extent = feature.getGeometry().getExtent()
|
|
|
- this.view.getView().setCenter([(extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2])
|
|
|
- this.view.getView().setZoom(20)
|
|
|
- }
|
|
|
+ // // 定位某条管线
|
|
|
+ // setPipesView(pipes) {
|
|
|
+ // let coors = pipes || [
|
|
|
+ // [113.14459646427814, 29.365111002105298],
|
|
|
+ // [113.14462310850658, 29.36565173168358]
|
|
|
+ // ]
|
|
|
+ // let feature = new Feature({ geometry: new LineString(coors) })
|
|
|
+ // if (!this.vectorLayer) {
|
|
|
+ // this.vectorLayer = new VectorLayer({
|
|
|
+ // source: new VectorSource(),
|
|
|
+ // style: comSymbol.getAllStyle(3, 'f00', 5, '#00ffff', 'fff6')
|
|
|
+ // })
|
|
|
+ // this.view.addLayer(this.vectorLayer)
|
|
|
+ // }
|
|
|
+ // this.vectorLayer.getSource().clear()
|
|
|
+ // this.vectorLayer.getSource().addFeature(feature)
|
|
|
+ // //
|
|
|
+ // let extent = feature.getGeometry().getExtent()
|
|
|
+ // this.view.getView().setCenter([(extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2])
|
|
|
+ // this.view.getView().setZoom(20)
|
|
|
+ // }
|
|
|
// 清除地图
|
|
|
- clearMap() {
|
|
|
- this.vectorLayer.getSource().clear()
|
|
|
- }
|
|
|
+ // clearMap() {
|
|
|
+ // this.vectorLayer.getSource().clear()
|
|
|
+ // }
|
|
|
// 根据 extent 查询 数据
|
|
|
- queryForExtent(extent) {
|
|
|
- new mapUtil(this.view).queryForExtent(extent, this.vectorLayer)
|
|
|
- }
|
|
|
+ // queryForExtent(extent) {
|
|
|
+ // new mapUtil(this.view).queryForExtent(extent, this.vectorLayer)
|
|
|
+ // }
|
|
|
// 显示图例
|
|
|
- showLegend(legendName, visible) {
|
|
|
- if (!legendName) return
|
|
|
- this.legendData = LegendConfig[legendName]
|
|
|
- this.showMapLengend = visible
|
|
|
- }
|
|
|
- legendChange() {
|
|
|
- this.showLegendBox = !this.showLegendBox
|
|
|
- let dom: any = this.$refs.legendCloser
|
|
|
- dom.innerHTML = this.showLegendBox ? '▼' : '▲'
|
|
|
- }
|
|
|
+ // showLegend(legendName, visible) {
|
|
|
+ // if (!legendName) return
|
|
|
+ // this.legendData = LegendConfig[legendName]
|
|
|
+ // this.showMapLengend = visible
|
|
|
+ // }
|
|
|
+ // legendChange() {
|
|
|
+ // this.showLegendBox = !this.showLegendBox
|
|
|
+ // let dom: any = this.$refs.legendCloser
|
|
|
+ // dom.innerHTML = this.showLegendBox ? '▼' : '▲'
|
|
|
+ // }
|
|
|
|
|
|
- closeAny() {
|
|
|
- //@ts-ignore
|
|
|
- this.$refs.any.style.display = 'none'
|
|
|
- }
|
|
|
- initConfig() {
|
|
|
- var resource = appconfig.gisResource['iserver_resource']
|
|
|
- var nextDo = () => {
|
|
|
- this.loadText = '地图加载中'
|
|
|
- this.$nextTick(this.initMap)
|
|
|
- }
|
|
|
+ // closeAny() {
|
|
|
+ // //@ts-ignore
|
|
|
+ // this.$refs.any.style.display = 'none'
|
|
|
+ // }
|
|
|
+ // initConfig() {
|
|
|
+ // var resource = appconfig.gisResource['iserver_resource']
|
|
|
+ // var nextDo = () => {
|
|
|
+ // this.loadText = '地图加载中'
|
|
|
+ // this.$nextTick(this.initMap)
|
|
|
+ // }
|
|
|
|
|
|
- if (appconfig.isloadServer) {
|
|
|
- this.loadText = '服务加载中'
|
|
|
- request({ url: '/base/sourcedic/getTreeService', method: 'get' }).then((res1) => {
|
|
|
- if (res1.code == 1) {
|
|
|
- const res = res1.result
|
|
|
- //通过访问天地图地址判断是否可以连接外网,先获取编码isOnlineAddress下的外网地址
|
|
|
- let onlineIndex = res.findIndex((item) => item.code == 'isOnlineAddress')
|
|
|
- if (onlineIndex !== -1) {
|
|
|
- let isOnline = true
|
|
|
- let onLineAddress = res[onlineIndex].child[0].cval
|
|
|
- axios
|
|
|
- .get(onLineAddress)
|
|
|
- .then(
|
|
|
- (res) => {
|
|
|
- isOnline = res.status === 200
|
|
|
- },
|
|
|
- (error) => {
|
|
|
- isOnline = false // 异常返回
|
|
|
- }
|
|
|
- )
|
|
|
- .catch((e) => {
|
|
|
- isOnline = false //异常返回
|
|
|
- })
|
|
|
- .finally(() => {
|
|
|
- // 服务配置名称
|
|
|
- const MAP_CONFIG = {
|
|
|
- mapService: '地图配置服务',
|
|
|
- layerService: '图层服务',
|
|
|
- dataService: '数据服务',
|
|
|
- analysisService: '网络分析服务'
|
|
|
- }
|
|
|
- // 需要替换的服务
|
|
|
- const repItems = [
|
|
|
- MAP_CONFIG.mapService,
|
|
|
- MAP_CONFIG.layerService,
|
|
|
- MAP_CONFIG.dataService,
|
|
|
- MAP_CONFIG.analysisService
|
|
|
- ]
|
|
|
- res.forEach((service) => {
|
|
|
- let resData = service.child,
|
|
|
- source = null
|
|
|
- if (repItems.includes(service.name) && resData && resData.length !== 0) {
|
|
|
- if (service.name === MAP_CONFIG.layerService) {
|
|
|
- source = resource.layerService.layers
|
|
|
- console.log('图层服务配置')
|
|
|
- resData.forEach((data) => {
|
|
|
- let findItem = source.find((sourceItem) => {
|
|
|
- if (sourceItem.name.includes('底图')) {
|
|
|
- return data.name === (isOnline ? sourceItem.name : '离线' + sourceItem.name)
|
|
|
- } else {
|
|
|
- return data.name === sourceItem.name
|
|
|
- }
|
|
|
- })
|
|
|
- if (findItem) {
|
|
|
- findItem.url = data.cval
|
|
|
- }
|
|
|
- })
|
|
|
- } else if (service.name === MAP_CONFIG.mapService) {
|
|
|
- source = appconfig
|
|
|
- resData.forEach((item) => {
|
|
|
- if (item.ckey === 'center') {
|
|
|
- source.initCenter = item.cval.split(',')
|
|
|
- } else if (item.ckey === 'zoom') {
|
|
|
- source.initZoom = item.cval
|
|
|
- }
|
|
|
- })
|
|
|
- } else if (service.name === MAP_CONFIG.analysisService) {
|
|
|
- source = resource.netAnalysisService
|
|
|
- source.url = resData[0].cval
|
|
|
- } else if (service.name === MAP_CONFIG.dataService) {
|
|
|
- source = resource.dataService
|
|
|
- source.url = resData[0].cval
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- nextDo()
|
|
|
- })
|
|
|
- }
|
|
|
- } else this.$message('服务加载失败 启用默认服务配置')
|
|
|
- })
|
|
|
- } else nextDo()
|
|
|
- }
|
|
|
+ // if (appconfig.isloadServer) {
|
|
|
+ // this.loadText = '服务加载中'
|
|
|
+ // request({ url: '/base/sourcedic/getTreeService', method: 'get' }).then((res1) => {
|
|
|
+ // if (res1.code == 1) {
|
|
|
+ // const res = res1.result
|
|
|
+ // //通过访问天地图地址判断是否可以连接外网,先获取编码isOnlineAddress下的外网地址
|
|
|
+ // let onlineIndex = res.findIndex((item) => item.code == 'isOnlineAddress')
|
|
|
+ // if (onlineIndex !== -1) {
|
|
|
+ // let isOnline = true
|
|
|
+ // let onLineAddress = res[onlineIndex].child[0].cval
|
|
|
+ // axios
|
|
|
+ // .get(onLineAddress)
|
|
|
+ // .then(
|
|
|
+ // (res) => {
|
|
|
+ // isOnline = res.status === 200
|
|
|
+ // },
|
|
|
+ // (error) => {
|
|
|
+ // isOnline = false // 异常返回
|
|
|
+ // }
|
|
|
+ // )
|
|
|
+ // .catch((e) => {
|
|
|
+ // isOnline = false //异常返回
|
|
|
+ // })
|
|
|
+ // .finally(() => {
|
|
|
+ // // 服务配置名称
|
|
|
+ // const MAP_CONFIG = {
|
|
|
+ // mapService: '地图配置服务',
|
|
|
+ // layerService: '图层服务',
|
|
|
+ // dataService: '数据服务',
|
|
|
+ // analysisService: '网络分析服务'
|
|
|
+ // }
|
|
|
+ // // 需要替换的服务
|
|
|
+ // const repItems = [
|
|
|
+ // MAP_CONFIG.mapService,
|
|
|
+ // MAP_CONFIG.layerService,
|
|
|
+ // MAP_CONFIG.dataService,
|
|
|
+ // MAP_CONFIG.analysisService
|
|
|
+ // ]
|
|
|
+ // res.forEach((service) => {
|
|
|
+ // let resData = service.child,
|
|
|
+ // source = null
|
|
|
+ // if (repItems.includes(service.name) && resData && resData.length !== 0) {
|
|
|
+ // if (service.name === MAP_CONFIG.layerService) {
|
|
|
+ // source = resource.layerService.layers
|
|
|
+ // console.log('图层服务配置')
|
|
|
+ // resData.forEach((data) => {
|
|
|
+ // let findItem = source.find((sourceItem) => {
|
|
|
+ // if (sourceItem.name.includes('底图')) {
|
|
|
+ // return data.name === (isOnline ? sourceItem.name : '离线' + sourceItem.name)
|
|
|
+ // } else {
|
|
|
+ // return data.name === sourceItem.name
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // if (findItem) {
|
|
|
+ // findItem.url = data.cval
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // } else if (service.name === MAP_CONFIG.mapService) {
|
|
|
+ // source = appconfig
|
|
|
+ // resData.forEach((item) => {
|
|
|
+ // if (item.ckey === 'center') {
|
|
|
+ // source.initCenter = item.cval.split(',')
|
|
|
+ // } else if (item.ckey === 'zoom') {
|
|
|
+ // source.initZoom = item.cval
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // } else if (service.name === MAP_CONFIG.analysisService) {
|
|
|
+ // source = resource.netAnalysisService
|
|
|
+ // source.url = resData[0].cval
|
|
|
+ // } else if (service.name === MAP_CONFIG.dataService) {
|
|
|
+ // source = resource.dataService
|
|
|
+ // source.url = resData[0].cval
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // nextDo()
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // } else this.$message('服务加载失败 启用默认服务配置')
|
|
|
+ // })
|
|
|
+ // } else nextDo()
|
|
|
+ // }
|
|
|
|
|
|
/**
|
|
|
* 根据权限控制地图四个角的工具栏的展示
|
|
|
*/
|
|
|
- controlToolDisplay() {
|
|
|
- //本功能必须在权限管理-系统管理-模块管理的系统新增中分配leftTopTool,leftBottomTool,rightTopTool,rightBottomTool四个类型
|
|
|
- //这四个类型分别对应地图工具栏的左上角,左下角,右上角,右下角
|
|
|
- //这四个工具栏不在左边的功能列表中展示(改设置在src\layout\components\Sidebar\index.vue中)
|
|
|
- if (this.$store.state && this.$store.state.routeSetting && this.$store.state.routeSetting.routes) {
|
|
|
- const allModel = this.$store.state.routeSetting.dynamicRoutes['map'] //获取所有功能
|
|
|
- if (!allModel) return
|
|
|
- /**工具栏识别的字符集合*/
|
|
|
- const toolBoxList = ['leftTopTool', 'leftBottomTool', 'rightBottomTool', 'rightTopTool']
|
|
|
- const toolcomponentList = {
|
|
|
- leftTopTool,
|
|
|
- leftBottomTool,
|
|
|
- rightTopTool,
|
|
|
- rightBottomTool
|
|
|
- }
|
|
|
- //根据模块管理将组件注入
|
|
|
- allModel.forEach((item) => {
|
|
|
- let index = toolBoxList.findIndex((val) => {
|
|
|
- return val == item.type
|
|
|
- })
|
|
|
- if (index != -1) {
|
|
|
- this[item.type] = item || []
|
|
|
- let temp = this.getComponents(item.type)
|
|
|
- temp.forEach((item2) => {
|
|
|
- toolcomponentList[item.type]['components'][item2.name] = item2.component
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
+ // controlToolDisplay() {
|
|
|
+ // //本功能必须在权限管理-系统管理-模块管理的系统新增中分配leftTopTool,leftBottomTool,rightTopTool,rightBottomTool四个类型
|
|
|
+ // //这四个类型分别对应地图工具栏的左上角,左下角,右上角,右下角
|
|
|
+ // //这四个工具栏不在左边的功能列表中展示(改设置在src\layout\components\Sidebar\index.vue中)
|
|
|
+ // if (this.$store.state && this.$store.state.routeSetting && this.$store.state.routeSetting.routes) {
|
|
|
+ // const allModel = this.$store.state.routeSetting.dynamicRoutes['map'] //获取所有功能
|
|
|
+ // if (!allModel) return
|
|
|
+ // /**工具栏识别的字符集合*/
|
|
|
+ // const toolBoxList = ['leftTopTool', 'leftBottomTool', 'rightBottomTool', 'rightTopTool']
|
|
|
+ // const toolcomponentList = {
|
|
|
+ // leftTopTool,
|
|
|
+ // leftBottomTool,
|
|
|
+ // rightTopTool,
|
|
|
+ // rightBottomTool
|
|
|
+ // }
|
|
|
+ // //根据模块管理将组件注入
|
|
|
+ // allModel.forEach((item) => {
|
|
|
+ // let index = toolBoxList.findIndex((val) => {
|
|
|
+ // return val == item.type
|
|
|
+ // })
|
|
|
+ // if (index != -1) {
|
|
|
+ // this[item.type] = item || []
|
|
|
+ // let temp = this.getComponents(item.type)
|
|
|
+ // temp.forEach((item2) => {
|
|
|
+ // toolcomponentList[item.type]['components'][item2.name] = item2.component
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
- /**
|
|
|
- * 获取指定层级下面的组件
|
|
|
- * @param typeString 指定层级的名称
|
|
|
- * */
|
|
|
- getComponents(typeString) {
|
|
|
- let temp = this.$store.state.routeSetting.addRoutes.find((val) => {
|
|
|
- return val.name && val.name == typeString
|
|
|
- })
|
|
|
- return temp.children || []
|
|
|
- }
|
|
|
+ // /**
|
|
|
+ // * 获取指定层级下面的组件
|
|
|
+ // * @param typeString 指定层级的名称
|
|
|
+ // * */
|
|
|
+ // getComponents(typeString) {
|
|
|
+ // let temp = this.$store.state.routeSetting.addRoutes.find((val) => {
|
|
|
+ // return val.name && val.name == typeString
|
|
|
+ // })
|
|
|
+ // return temp.children || []
|
|
|
+ // }
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|