|
@@ -11,7 +11,6 @@ import JqStyle from "@/views/gis/map-info/style/jq";
|
|
|
import LgStyle from "@/views/gis/map-info/style/lg";
|
|
|
import CzwStyle from "@/views/gis/map-info/style/czw";
|
|
|
import HczStyle from "@/views/gis/map-info/style/hcz";
|
|
|
-import store from "@/store";
|
|
|
import axios from "axios";
|
|
|
import {formatPosition} from "@/utils/easyMap";
|
|
|
import * as turf from "@turf/turf";
|
|
@@ -139,289 +138,300 @@ const getters = {
|
|
|
}
|
|
|
|
|
|
const mutations = {
|
|
|
- SET_IS_TOOLING(state, flag) {
|
|
|
- state.isTooling = flag
|
|
|
- },
|
|
|
- SET_VIDEO_PARAMS(state, data) {
|
|
|
- const { show, name = null, code = null } = data
|
|
|
- state.videoParams = { show, name, code }
|
|
|
- },
|
|
|
- SET_GIS_MAP(state, {map, defaultDom, qyDom}) {
|
|
|
- state.map = map
|
|
|
- state.s = new source.Vector()
|
|
|
- state.l = new layer.Vector({
|
|
|
- source: state.s,
|
|
|
- zIndex: 99999,
|
|
|
- style: new style.Style({ //图层样式
|
|
|
- fill: new style.Fill({
|
|
|
- color: 'rgba(46,129,255,0.15)' //填充颜色
|
|
|
- }),
|
|
|
- stroke: new style.Stroke({
|
|
|
- color: '#2E81FF', //边框颜色
|
|
|
- width: 2, // 边框宽度
|
|
|
- lineDash: [10, 10]
|
|
|
- }),
|
|
|
- image: new style.Circle({
|
|
|
- radius: 5,
|
|
|
- fill: new style.Fill({
|
|
|
- color: '#ffcc33'
|
|
|
- })
|
|
|
- })
|
|
|
- })
|
|
|
- })
|
|
|
- state.map.addLayer(state.l)
|
|
|
-
|
|
|
+}
|
|
|
|
|
|
- state.element.layer = new layer.Tile({
|
|
|
- zIndex: 10,
|
|
|
- })
|
|
|
- state.map.addLayer(state.element.layer)
|
|
|
- // 基本要素
|
|
|
- state.gisParams.default.source = new source.Vector()
|
|
|
- state.gisParams.default.layer = new layer.Vector({
|
|
|
- zIndex: 40,
|
|
|
- source: state.gisParams.default.source,
|
|
|
- })
|
|
|
- state.gisParams.default.layer.set('layerName', 'gisDefault')
|
|
|
- state.map.addLayer(state.gisParams.default.layer)
|
|
|
- state.gisParams.default.overlay = new ol.Overlay({
|
|
|
- id: 'gisDefaultDom',
|
|
|
- element: defaultDom.ref_dom,
|
|
|
- autoPan: false,
|
|
|
- offset: [0, -60],
|
|
|
- positioning: 'bottom-center',
|
|
|
- stopEvent: true,
|
|
|
- autoPanAnimation: {
|
|
|
- duration: 250
|
|
|
- }
|
|
|
- })
|
|
|
- state.map.addOverlay(state.gisParams.default.overlay)
|
|
|
- // 企业要素
|
|
|
- state.gisParams.qy.source = new source.Vector()
|
|
|
- state.gisParams.qy.layer = new layer.Vector({
|
|
|
- zIndex: 50,
|
|
|
- source: state.gisParams.qy.source,
|
|
|
- })
|
|
|
- state.gisParams.qy.layer.set('layerName', 'gisQy')
|
|
|
- state.map.addLayer(state.gisParams.qy.layer)
|
|
|
- state.gisParams.qy.overlay = new ol.Overlay({
|
|
|
- id: 'gisQyDom',
|
|
|
- element: qyDom.ref_dom,
|
|
|
- autoPan: false,
|
|
|
- offset: [0, -60],
|
|
|
- positioning: 'bottom-center',
|
|
|
- stopEvent: true,
|
|
|
- autoPanAnimation: {
|
|
|
- duration: 250
|
|
|
- }
|
|
|
- })
|
|
|
- state.map.addOverlay(state.gisParams.qy.overlay)
|
|
|
- // 企业-周边设备
|
|
|
- state.gisParams.qy.analysisSource = new source.Vector()
|
|
|
- state.gisParams.qy.analysisLayer = new layer.Vector({
|
|
|
- zIndex: 20,
|
|
|
- source: state.gisParams.qy.analysisSource,
|
|
|
- style: [
|
|
|
- new style.Style({
|
|
|
- stroke: new style.Stroke({
|
|
|
- color: '#2860F1',
|
|
|
- width: 2,
|
|
|
- lineDash: [10, 10]
|
|
|
- }),
|
|
|
+const actions = {
|
|
|
+ // commit
|
|
|
+ // dispatch
|
|
|
+ // getters
|
|
|
+ // rootGetters
|
|
|
+ // rootState
|
|
|
+ // state
|
|
|
+ LOAD_GIS_MAP({state, dispatch, getters}: any, {map, defaultDom, qyDom}: any) {
|
|
|
+ if (!state.map) {
|
|
|
+ state.map = map
|
|
|
+ state.s = new source.Vector()
|
|
|
+ state.l = new layer.Vector({
|
|
|
+ source: state.s,
|
|
|
+ zIndex: 99999,
|
|
|
+ style: new style.Style({ //图层样式
|
|
|
fill: new style.Fill({
|
|
|
- color: 'rgba(20, 129, 241, 0.1)',
|
|
|
- }),
|
|
|
- })
|
|
|
- ]
|
|
|
- });
|
|
|
- state.gisParams.qy.analysisCircle = new ol.Feature()
|
|
|
- state.gisParams.qy.analysisCircle.set(featureTypeKey, 'qyAnalysisCircle')
|
|
|
- state.map.addLayer(state.gisParams.qy.analysisLayer)
|
|
|
- state.gisParams.qy.analysisDeviceLayer = new layer.Tile({
|
|
|
- zIndex: 30
|
|
|
- })
|
|
|
- state.map.addLayer(state.gisParams.qy.analysisDeviceLayer)
|
|
|
- // 周边分析
|
|
|
- state.analysis.source = new source.Vector()
|
|
|
- state.analysis.layer = new layer.Vector({
|
|
|
- zIndex: 20,
|
|
|
- source: state.analysis.source,
|
|
|
- style: [
|
|
|
- new style.Style({
|
|
|
- image: new style.Icon({
|
|
|
- src: PointIcon,
|
|
|
- displacement: [0, 24]
|
|
|
+ color: 'rgba(46,129,255,0.15)' //填充颜色
|
|
|
}),
|
|
|
stroke: new style.Stroke({
|
|
|
- color: '#2860F1',
|
|
|
- width: 2,
|
|
|
+ color: '#2E81FF', //边框颜色
|
|
|
+ width: 2, // 边框宽度
|
|
|
lineDash: [10, 10]
|
|
|
}),
|
|
|
- fill: new style.Fill({
|
|
|
- color: 'rgba(20, 129, 241, 0.1)',
|
|
|
- }),
|
|
|
+ image: new style.Circle({
|
|
|
+ radius: 5,
|
|
|
+ fill: new style.Fill({
|
|
|
+ color: '#ffcc33'
|
|
|
+ })
|
|
|
+ })
|
|
|
})
|
|
|
- ]
|
|
|
- });
|
|
|
- state.analysis.layer.set('layerName', 'analysisDrawViewsLayer')
|
|
|
- state.analysis.feature = new ol.Feature()
|
|
|
- state.analysis.feature.set(featureTypeKey, 'analysisCircle')
|
|
|
- state.map.addLayer(state.analysis.layer)
|
|
|
- state.analysis.deviceLayer = new layer.Tile({
|
|
|
- zIndex: 30
|
|
|
- })
|
|
|
- state.map.addLayer(state.analysis.deviceLayer)
|
|
|
- const clickQy = (e, feat) => {
|
|
|
- if (state.gisParams.qy.overlay.getPosition() === undefined) {
|
|
|
- state.gisParams.qy.overlay.setPosition(state.gisParams.qy.feature.getGeometry().getCoordinates())
|
|
|
- } else {
|
|
|
- state.gisParams.qy.overlay.setPosition(undefined)
|
|
|
- }
|
|
|
- }
|
|
|
- const clickDefault = (e, feat) => {
|
|
|
- if (state.gisParams.default.overlay.getPosition() === undefined) {
|
|
|
- state.gisParams.default.overlay.setPosition(state.gisParams.default.feature.getGeometry().getCoordinates())
|
|
|
- } else {
|
|
|
- state.gisParams.default.overlay.setPosition(undefined)
|
|
|
- }
|
|
|
- }
|
|
|
- const clickQyAnalysisCircle = (e, feat) => {
|
|
|
- const viewResolution = e.map.getView().getResolution()
|
|
|
- const url = state.gisParams.qy.analysisDeviceLayer.getSource().getFeatureInfoUrl(e.coordinate, viewResolution, 'EPSG:4326', {
|
|
|
- 'INFO_FORMAT': 'application/json',
|
|
|
- 'FEATURE_COUNT': 10000
|
|
|
})
|
|
|
- if (url) {
|
|
|
- axios.get(url).then(res => {
|
|
|
- if (res.status === 200) {
|
|
|
- const item = res.data?.features?.[res.data?.features?.length - 1]
|
|
|
- if (item) {
|
|
|
- store.commit('gis/SET_GIS_PARAMS_DEFAULT_SB', {
|
|
|
- wkt: `POINT(${item.geometry.coordinates.join(' ')})`,
|
|
|
- id: item.properties.dataId,
|
|
|
- info: item.properties,
|
|
|
- config: {
|
|
|
- isAnalysis: true
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
+ state.map.addLayer(state.l)
|
|
|
+
|
|
|
+
|
|
|
+ state.element.layer = new layer.Tile({
|
|
|
+ zIndex: 10,
|
|
|
+ })
|
|
|
+ state.map.addLayer(state.element.layer)
|
|
|
+ // 基本要素
|
|
|
+ state.gisParams.default.source = new source.Vector()
|
|
|
+ state.gisParams.default.layer = new layer.Vector({
|
|
|
+ zIndex: 40,
|
|
|
+ source: state.gisParams.default.source,
|
|
|
+ })
|
|
|
+ state.gisParams.default.layer.set('layerName', 'gisDefault')
|
|
|
+ state.map.addLayer(state.gisParams.default.layer)
|
|
|
+ state.gisParams.default.overlay = new ol.Overlay({
|
|
|
+ id: 'gisDefaultDom',
|
|
|
+ element: defaultDom.ref_dom,
|
|
|
+ autoPan: false,
|
|
|
+ offset: [0, -60],
|
|
|
+ positioning: 'bottom-center',
|
|
|
+ stopEvent: true,
|
|
|
+ autoPanAnimation: {
|
|
|
+ duration: 250
|
|
|
+ }
|
|
|
+ })
|
|
|
+ state.map.addOverlay(state.gisParams.default.overlay)
|
|
|
+ // 企业要素
|
|
|
+ state.gisParams.qy.source = new source.Vector()
|
|
|
+ state.gisParams.qy.layer = new layer.Vector({
|
|
|
+ zIndex: 50,
|
|
|
+ source: state.gisParams.qy.source,
|
|
|
+ })
|
|
|
+ state.gisParams.qy.layer.set('layerName', 'gisQy')
|
|
|
+ state.map.addLayer(state.gisParams.qy.layer)
|
|
|
+ state.gisParams.qy.overlay = new ol.Overlay({
|
|
|
+ id: 'gisQyDom',
|
|
|
+ element: qyDom.ref_dom,
|
|
|
+ autoPan: false,
|
|
|
+ offset: [0, -60],
|
|
|
+ positioning: 'bottom-center',
|
|
|
+ stopEvent: true,
|
|
|
+ autoPanAnimation: {
|
|
|
+ duration: 250
|
|
|
+ }
|
|
|
+ })
|
|
|
+ state.map.addOverlay(state.gisParams.qy.overlay)
|
|
|
+ // 企业-周边设备
|
|
|
+ state.gisParams.qy.analysisSource = new source.Vector()
|
|
|
+ state.gisParams.qy.analysisLayer = new layer.Vector({
|
|
|
+ zIndex: 20,
|
|
|
+ source: state.gisParams.qy.analysisSource,
|
|
|
+ style: [
|
|
|
+ new style.Style({
|
|
|
+ stroke: new style.Stroke({
|
|
|
+ color: '#2860F1',
|
|
|
+ width: 2,
|
|
|
+ lineDash: [10, 10]
|
|
|
+ }),
|
|
|
+ fill: new style.Fill({
|
|
|
+ color: 'rgba(20, 129, 241, 0.1)',
|
|
|
+ }),
|
|
|
+ })
|
|
|
+ ]
|
|
|
+ });
|
|
|
+ state.gisParams.qy.analysisCircle = new ol.Feature()
|
|
|
+ state.gisParams.qy.analysisCircle.set(featureTypeKey, 'qyAnalysisCircle')
|
|
|
+ state.map.addLayer(state.gisParams.qy.analysisLayer)
|
|
|
+ state.gisParams.qy.analysisDeviceLayer = new layer.Tile({
|
|
|
+ zIndex: 30
|
|
|
+ })
|
|
|
+ state.map.addLayer(state.gisParams.qy.analysisDeviceLayer)
|
|
|
+ // 周边分析
|
|
|
+ state.analysis.source = new source.Vector()
|
|
|
+ state.analysis.layer = new layer.Vector({
|
|
|
+ zIndex: 20,
|
|
|
+ source: state.analysis.source,
|
|
|
+ style: [
|
|
|
+ new style.Style({
|
|
|
+ image: new style.Icon({
|
|
|
+ src: PointIcon,
|
|
|
+ displacement: [0, 24]
|
|
|
+ }),
|
|
|
+ stroke: new style.Stroke({
|
|
|
+ color: '#2860F1',
|
|
|
+ width: 2,
|
|
|
+ lineDash: [10, 10]
|
|
|
+ }),
|
|
|
+ fill: new style.Fill({
|
|
|
+ color: 'rgba(20, 129, 241, 0.1)',
|
|
|
+ }),
|
|
|
+ })
|
|
|
+ ]
|
|
|
+ });
|
|
|
+ state.analysis.layer.set('layerName', 'analysisDrawViewsLayer')
|
|
|
+ state.analysis.feature = new ol.Feature()
|
|
|
+ state.analysis.feature.set(featureTypeKey, 'analysisCircle')
|
|
|
+ state.map.addLayer(state.analysis.layer)
|
|
|
+ state.analysis.deviceLayer = new layer.Tile({
|
|
|
+ zIndex: 30
|
|
|
+ })
|
|
|
+ state.map.addLayer(state.analysis.deviceLayer)
|
|
|
+ const clickQy = (e, feat) => {
|
|
|
+ if (state.gisParams.qy.overlay.getPosition() === undefined) {
|
|
|
+ state.gisParams.qy.overlay.setPosition(state.gisParams.qy.feature.getGeometry().getCoordinates())
|
|
|
+ } else {
|
|
|
+ state.gisParams.qy.overlay.setPosition(undefined)
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- const handleTileClick = async (e) => {
|
|
|
- let continueFlag = true
|
|
|
- if (state.gisParams.qy.analysisWKT && continueFlag) {
|
|
|
+ const clickDefault = (e, feat) => {
|
|
|
+ if (state.gisParams.default.overlay.getPosition() === undefined) {
|
|
|
+ state.gisParams.default.overlay.setPosition(state.gisParams.default.feature.getGeometry().getCoordinates())
|
|
|
+ } else {
|
|
|
+ state.gisParams.default.overlay.setPosition(undefined)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const clickQyAnalysisCircle = (e, feat) => {
|
|
|
const viewResolution = e.map.getView().getResolution()
|
|
|
const url = state.gisParams.qy.analysisDeviceLayer.getSource().getFeatureInfoUrl(e.coordinate, viewResolution, 'EPSG:4326', {
|
|
|
'INFO_FORMAT': 'application/json',
|
|
|
'FEATURE_COUNT': 10000
|
|
|
})
|
|
|
if (url) {
|
|
|
- await axios.get(url).then(res => {
|
|
|
+ axios.get(url).then(res => {
|
|
|
if (res.status === 200) {
|
|
|
const item = res.data?.features?.[res.data?.features?.length - 1]
|
|
|
if (item) {
|
|
|
- continueFlag = false
|
|
|
- console.log(item)
|
|
|
- if (['gal', 'shl', 'myl'].includes(item.properties.typeValue)) {
|
|
|
- store.commit('gis/SET_GIS_PARAMS_DEFAULT_RESET')
|
|
|
- store.commit('gis/SET_GIS_PARAMS_DEFAULT_SB', {
|
|
|
- wkt: `POINT(${item.geometry.coordinates.join(' ')})`,
|
|
|
- id: item.properties.dataId,
|
|
|
- info: item.properties
|
|
|
- })
|
|
|
- }
|
|
|
+ dispatch('LOAD_GIS_PARAMS_DEFAULT_SB', {
|
|
|
+ wkt: `POINT(${item.geometry.coordinates.join(' ')})`,
|
|
|
+ id: item.properties.dataId,
|
|
|
+ info: item.properties,
|
|
|
+ config: {
|
|
|
+ isAnalysis: true
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
- if (state.analysis.wkt && continueFlag) {
|
|
|
- const viewResolution = e.map.getView().getResolution()
|
|
|
- const url = state.analysis.deviceLayer.getSource().getFeatureInfoUrl(e.coordinate, viewResolution, 'EPSG:4326', {
|
|
|
- 'INFO_FORMAT': 'application/json',
|
|
|
- 'FEATURE_COUNT': 10000
|
|
|
- })
|
|
|
- if (url) {
|
|
|
- await axios.get(url).then(res => {
|
|
|
- if (res.status === 200) {
|
|
|
- const item = res.data?.features?.[res.data?.features?.length - 1]
|
|
|
- if (item) {
|
|
|
- console.log(item)
|
|
|
- continueFlag = true
|
|
|
- if (['gal', 'shl', 'myl'].includes(item.properties.typeValue)) {
|
|
|
- store.commit('gis/SET_GIS_PARAMS_DEFAULT_RESET')
|
|
|
- store.commit('gis/SET_GIS_PARAMS_DEFAULT_SB', {
|
|
|
- wkt: `POINT(${item.geometry.coordinates.join(' ')})`,
|
|
|
- id: item.properties.dataId,
|
|
|
- info: item.properties
|
|
|
- })
|
|
|
+ const handleTileClick = async (e) => {
|
|
|
+ let continueFlag = true
|
|
|
+ if (state.gisParams.qy.analysisWKT && continueFlag) {
|
|
|
+ const viewResolution = e.map.getView().getResolution()
|
|
|
+ const url = state.gisParams.qy.analysisDeviceLayer.getSource().getFeatureInfoUrl(e.coordinate, viewResolution, 'EPSG:4326', {
|
|
|
+ 'INFO_FORMAT': 'application/json',
|
|
|
+ 'FEATURE_COUNT': 10000
|
|
|
+ })
|
|
|
+ if (url) {
|
|
|
+ await axios.get(url).then(res => {
|
|
|
+ if (res.status === 200) {
|
|
|
+ const item = res.data?.features?.[res.data?.features?.length - 1]
|
|
|
+ if (item) {
|
|
|
+ continueFlag = false
|
|
|
+ console.log(item)
|
|
|
+ if (['gal', 'shl', 'myl'].includes(item.properties.typeValue)) {
|
|
|
+ dispatch('LOAD_GIS_PARAMS_DEFAULT_RESET')
|
|
|
+ dispatch('LOAD_GIS_PARAMS_DEFAULT_SB', {
|
|
|
+ wkt: `POINT(${item.geometry.coordinates.join(' ')})`,
|
|
|
+ id: item.properties.dataId,
|
|
|
+ info: item.properties
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- })
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- if (store.getters['gis/elementActiveArr'].length > 0 && continueFlag) {
|
|
|
- const viewResolution = e.map.getView().getResolution()
|
|
|
- const url = state.element.layer.getSource().getFeatureInfoUrl(e.coordinate, viewResolution, 'EPSG:4326', {
|
|
|
- 'INFO_FORMAT': 'application/json',
|
|
|
- 'FEATURE_COUNT': 10000
|
|
|
- })
|
|
|
- if (url) {
|
|
|
- await axios.get(url).then(res => {
|
|
|
- if (res.status === 200) {
|
|
|
- const item = res.data?.features?.[res.data?.features?.length - 1]
|
|
|
- if (item) {
|
|
|
- console.log(item)
|
|
|
- continueFlag = true
|
|
|
- if (['lgszyjkscsb', 'jgzzmgs', 'lgsjkyfl'].includes(item.properties.typeValue)) {
|
|
|
- store.commit('gis/SET_GIS_PARAMS_QY_RESET')
|
|
|
- store.commit('gis/SET_GIS_PARAMS_QY', {
|
|
|
- wkt: `POINT(${item.geometry.coordinates.join(' ')})`,
|
|
|
- id: item.properties.dataId,
|
|
|
- info: item.properties
|
|
|
- })
|
|
|
- } else if (['gal', 'shl', 'myl'].includes(item.properties.typeValue)) {
|
|
|
- store.commit('gis/SET_GIS_PARAMS_DEFAULT_RESET')
|
|
|
- store.commit('gis/SET_GIS_PARAMS_DEFAULT_SB', {
|
|
|
- wkt: `POINT(${item.geometry.coordinates.join(' ')})`,
|
|
|
- id: item.properties.dataId,
|
|
|
- info: item.properties
|
|
|
- })
|
|
|
+ if (state.analysis.wkt && continueFlag) {
|
|
|
+ const viewResolution = e.map.getView().getResolution()
|
|
|
+ const url = state.analysis.deviceLayer.getSource().getFeatureInfoUrl(e.coordinate, viewResolution, 'EPSG:4326', {
|
|
|
+ 'INFO_FORMAT': 'application/json',
|
|
|
+ 'FEATURE_COUNT': 10000
|
|
|
+ })
|
|
|
+ if (url) {
|
|
|
+ await axios.get(url).then(res => {
|
|
|
+ if (res.status === 200) {
|
|
|
+ const item = res.data?.features?.[res.data?.features?.length - 1]
|
|
|
+ if (item) {
|
|
|
+ console.log(item)
|
|
|
+ continueFlag = true
|
|
|
+ if (['gal', 'shl', 'myl'].includes(item.properties.typeValue)) {
|
|
|
+ dispatch('LOAD_GIS_PARAMS_DEFAULT_RESET')
|
|
|
+ dispatch('LOAD_GIS_PARAMS_DEFAULT_SB', {
|
|
|
+ wkt: `POINT(${item.geometry.coordinates.join(' ')})`,
|
|
|
+ id: item.properties.dataId,
|
|
|
+ info: item.properties
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (getters['elementActiveArr'].length > 0 && continueFlag) {
|
|
|
+ const viewResolution = e.map.getView().getResolution()
|
|
|
+ const url = state.element.layer.getSource().getFeatureInfoUrl(e.coordinate, viewResolution, 'EPSG:4326', {
|
|
|
+ 'INFO_FORMAT': 'application/json',
|
|
|
+ 'FEATURE_COUNT': 10000
|
|
|
})
|
|
|
+ if (url) {
|
|
|
+ await axios.get(url).then(res => {
|
|
|
+ if (res.status === 200) {
|
|
|
+ const item = res.data?.features?.[res.data?.features?.length - 1]
|
|
|
+ if (item) {
|
|
|
+ console.log(item)
|
|
|
+ continueFlag = true
|
|
|
+ if (['lgszyjkscsb', 'jgzzmgs', 'lgsjkyfl'].includes(item.properties.typeValue)) {
|
|
|
+ dispatch('LOAD_GIS_PARAMS_QY_RESET')
|
|
|
+ dispatch('LOAD_GIS_PARAMS_QY', {
|
|
|
+ wkt: `POINT(${item.geometry.coordinates.join(' ')})`,
|
|
|
+ id: item.properties.dataId,
|
|
|
+ info: item.properties
|
|
|
+ })
|
|
|
+ } else if (['gal', 'shl', 'myl'].includes(item.properties.typeValue)) {
|
|
|
+ dispatch('LOAD_GIS_PARAMS_DEFAULT_RESET')
|
|
|
+ dispatch('LOAD_GIS_PARAMS_DEFAULT_SB', {
|
|
|
+ wkt: `POINT(${item.geometry.coordinates.join(' ')})`,
|
|
|
+ id: item.properties.dataId,
|
|
|
+ info: item.properties
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- state.map.on('singleclick', e => {
|
|
|
- let isFeature = false
|
|
|
- e.map.forEachFeatureAtPixel(e.pixel, (feature) => {
|
|
|
- if (!isFeature) {
|
|
|
- isFeature = true
|
|
|
- switch (feature.get(featureTypeKey)) {
|
|
|
- case 'qy': clickQy(e, feature)
|
|
|
- break
|
|
|
- case 'sb': clickDefault(e, feature)
|
|
|
- break
|
|
|
- case 'qyAnalysisCircle': isFeature = false
|
|
|
- break
|
|
|
- case 'analysisCircle': isFeature = false
|
|
|
- break
|
|
|
+ state.map.on('singleclick', e => {
|
|
|
+ let isFeature = false
|
|
|
+ e.map.forEachFeatureAtPixel(e.pixel, (feature) => {
|
|
|
+ if (!isFeature) {
|
|
|
+ isFeature = true
|
|
|
+ switch (feature.get(featureTypeKey)) {
|
|
|
+ case 'qy': clickQy(e, feature)
|
|
|
+ break
|
|
|
+ case 'sb': clickDefault(e, feature)
|
|
|
+ break
|
|
|
+ case 'qyAnalysisCircle': isFeature = false
|
|
|
+ break
|
|
|
+ case 'analysisCircle': isFeature = false
|
|
|
+ break
|
|
|
+ }
|
|
|
}
|
|
|
+ }, {
|
|
|
+ hitTolerance: 0,
|
|
|
+ });
|
|
|
+ if (!isFeature) {
|
|
|
+ handleTileClick(e)
|
|
|
}
|
|
|
- }, {
|
|
|
- hitTolerance: 0,
|
|
|
- });
|
|
|
- if (!isFeature) {
|
|
|
- handleTileClick(e)
|
|
|
- }
|
|
|
- })
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
- SET_GIS_PARAMS_QY(state, {wkt, id, info, config = {}}: any) {
|
|
|
+ LOAD_IS_TOOLING({state}: any, flag) {
|
|
|
+ state.isTooling = flag
|
|
|
+ },
|
|
|
+ LOAD_VIDEO_PARAMS({state}: any, data) {
|
|
|
+ const { show, name = null, code = null } = data
|
|
|
+ state.videoParams = { show, name, code }
|
|
|
+ },
|
|
|
+ LOAD_GIS_PARAMS_QY({state, dispatch}: any, {wkt, id, info, config = {}}: any) {
|
|
|
const {
|
|
|
isAnalysis = false
|
|
|
} = config
|
|
@@ -484,13 +494,13 @@ const mutations = {
|
|
|
center: newFeat.getGeometry().getCoordinates(),
|
|
|
zoom: state.gisParams.autoZoom,
|
|
|
});
|
|
|
- store.commit('gis/SET_GIS_ELEMENT')
|
|
|
+ dispatch('LOAD_GIS_ELEMENT')
|
|
|
} catch (e) {
|
|
|
console.log('异常数据:', wkt, info, e)
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- SET_GIS_PARAMS_QY_RESET(state) {
|
|
|
+ LOAD_GIS_PARAMS_QY_RESET({state, dispatch}: any) {
|
|
|
if (state.gisParams.qy.layer) {
|
|
|
state.gisParams.qy.source.clear()
|
|
|
state.gisParams.qy.type = ''
|
|
@@ -503,14 +513,14 @@ const mutations = {
|
|
|
state.gisParams.qy.analysisWKT = ''
|
|
|
state.gisParams.default.feature?.set('isAnalysis', false)
|
|
|
state.gisParams.default.feature?.get('resetStyle')()
|
|
|
- store.commit('gis/SET_GIS_ELEMENT')
|
|
|
+ dispatch('LOAD_GIS_ELEMENT')
|
|
|
}
|
|
|
},
|
|
|
- SET_GIS_PARAMS_QY_ANALYSIS(state) {
|
|
|
+ LOAD_GIS_PARAMS_QY_ANALYSIS({state, rootState, dispatch}: any) {
|
|
|
if (state.gisParams.qy.analysisDeviceLayer) {
|
|
|
state.gisParams.qy.analysisWKT = formatPosition.cpnTwpn(state.gisParams.qy.analysisCircle.getGeometry().getCoordinates())
|
|
|
- store.commit('gis/SET_GIS_ELEMENT')
|
|
|
- store.commit('gis/SET_GIS_QY_ANALYSIS_ELEMENT')
|
|
|
+ dispatch('LOAD_GIS_ELEMENT')
|
|
|
+ dispatch('LOAD_GIS_QY_ANALYSIS_ELEMENT')
|
|
|
state.gisParams.qy.info['5'].tableData = []
|
|
|
state.gisParams.qy.info['5'].loading = true
|
|
|
axios({
|
|
@@ -520,7 +530,7 @@ const mutations = {
|
|
|
service: 'WFS',
|
|
|
version: '1.0.0',
|
|
|
request: 'GetFeature',
|
|
|
- typename: store.state.dictionary.elementTypeList.filter(v => v.dictType === 'sb').map(v => v.geoType).join(','),
|
|
|
+ typename: rootState.dictionary.elementTypeList.filter(v => v.dictType === 'sb').map(v => v.geoType).join(','),
|
|
|
srsName: 'EPSG:4326',
|
|
|
outputFormat: 'application/json',
|
|
|
CQL_FILTER: `INTERSECTS(location, ${state.gisParams.qy.analysisWKT})`
|
|
@@ -530,11 +540,11 @@ const mutations = {
|
|
|
let type = ''
|
|
|
switch (v.properties.typeValue) {
|
|
|
case 'gal': type = '公安类'
|
|
|
- break
|
|
|
+ break
|
|
|
case 'myl': type = '民用类'
|
|
|
- break
|
|
|
+ break
|
|
|
case 'shl': type = '社会类'
|
|
|
- break
|
|
|
+ break
|
|
|
}
|
|
|
return {
|
|
|
name: v.properties.name,
|
|
@@ -548,7 +558,7 @@ const mutations = {
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- SET_GIS_PARAMS_DEFAULT_SB(state, {wkt, id, info, config = {}}: any) {
|
|
|
+ LOAD_GIS_PARAMS_DEFAULT_SB({state, dispatch}: any, {wkt, id, info, config = {}}: any) {
|
|
|
let {
|
|
|
isAnalysis = null
|
|
|
} = config
|
|
@@ -603,18 +613,18 @@ const mutations = {
|
|
|
center: newFeat.getGeometry().getCoordinates(),
|
|
|
zoom: state.gisParams.autoZoom,
|
|
|
});
|
|
|
- store.commit('gis/SET_GIS_ELEMENT')
|
|
|
+ dispatch('LOAD_GIS_ELEMENT')
|
|
|
if (state.gisParams.qy.analysisWKT) {
|
|
|
- store.commit('gis/SET_GIS_QY_ANALYSIS_ELEMENT')
|
|
|
+ dispatch('LOAD_GIS_QY_ANALYSIS_ELEMENT')
|
|
|
} else if (state.analysis.wkt) {
|
|
|
- store.commit('gis/SET_GIS_ANALYSIS_ELEMENT')
|
|
|
+ dispatch('LOAD_GIS_ANALYSIS_ELEMENT')
|
|
|
}
|
|
|
} catch (e) {
|
|
|
console.log('异常数据:', wkt, info, e)
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- SET_GIS_PARAMS_DEFAULT_JQ(state, {wkt, id, info, config = {}}: any) {
|
|
|
+ LOAD_GIS_PARAMS_DEFAULT_JQ({state, dispatch}: any, {wkt, id, info, config = {}}: any) {
|
|
|
const {
|
|
|
isAnalysis = false
|
|
|
} = config
|
|
@@ -648,13 +658,13 @@ const mutations = {
|
|
|
center: newFeat.getGeometry().getCoordinates(),
|
|
|
zoom: state.gisParams.autoZoom,
|
|
|
});
|
|
|
- store.commit('gis/SET_GIS_ELEMENT')
|
|
|
+ dispatch('LOAD_GIS_ELEMENT')
|
|
|
} catch (e) {
|
|
|
console.log('异常数据:', wkt, info, e)
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- SET_GIS_PARAMS_DEFAULT_LG(state, {wkt, id, info, config = {}}: any) {
|
|
|
+ LOAD_GIS_PARAMS_DEFAULT_LG({state, dispatch}: any, {wkt, id, info, config = {}}: any) {
|
|
|
const {
|
|
|
isAnalysis = false
|
|
|
} = config
|
|
@@ -688,13 +698,13 @@ const mutations = {
|
|
|
center: newFeat.getGeometry().getCoordinates(),
|
|
|
zoom: state.gisParams.autoZoom,
|
|
|
});
|
|
|
- store.commit('gis/SET_GIS_ELEMENT')
|
|
|
+ dispatch('LOAD_GIS_ELEMENT')
|
|
|
} catch (e) {
|
|
|
console.log('异常数据:', wkt, info, e)
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- SET_GIS_PARAMS_DEFAULT_CZW(state, {wkt, id, info, config = {}}: any) {
|
|
|
+ LOAD_GIS_PARAMS_DEFAULT_CZW({state, dispatch}: any, {wkt, id, info, config = {}}: any) {
|
|
|
const {
|
|
|
isAnalysis = false
|
|
|
} = config
|
|
@@ -728,13 +738,13 @@ const mutations = {
|
|
|
center: newFeat.getGeometry().getCoordinates(),
|
|
|
zoom: state.gisParams.autoZoom,
|
|
|
});
|
|
|
- store.commit('gis/SET_GIS_ELEMENT')
|
|
|
+ dispatch('LOAD_GIS_ELEMENT')
|
|
|
} catch (e) {
|
|
|
console.log('异常数据:', wkt, info, e)
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- SET_GIS_PARAMS_DEFAULT_HCZ(state, {wkt, id, info, config = {}}: any) {
|
|
|
+ LOAD_GIS_PARAMS_DEFAULT_HCZ({state, dispatch}: any, {wkt, id, info, config = {}}: any) {
|
|
|
const {
|
|
|
isAnalysis = false
|
|
|
} = config
|
|
@@ -768,25 +778,25 @@ const mutations = {
|
|
|
center: newFeat.getGeometry().getCoordinates(),
|
|
|
zoom: state.gisParams.autoZoom,
|
|
|
});
|
|
|
- store.commit('gis/SET_GIS_ELEMENT')
|
|
|
+ dispatch('LOAD_GIS_ELEMENT')
|
|
|
} catch (e) {
|
|
|
console.log('异常数据:', wkt, info, e)
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- SET_GIS_PARAMS_DEFAULT_RESET(state) {
|
|
|
+ LOAD_GIS_PARAMS_DEFAULT_RESET({state, dispatch}: any) {
|
|
|
if (state.gisParams.default.layer) {
|
|
|
state.gisParams.default.source.clear()
|
|
|
state.gisParams.default.type = ''
|
|
|
state.gisParams.default.info = {}
|
|
|
state.gisParams.default.overlay.setPosition(undefined)
|
|
|
state.gisParams.default.feature = null
|
|
|
- store.commit('gis/SET_GIS_ELEMENT')
|
|
|
+ dispatch('LOAD_GIS_ELEMENT')
|
|
|
}
|
|
|
},
|
|
|
- SET_GIS_ELEMENT(state, activeArr: any = []) {
|
|
|
+ LOAD_GIS_ELEMENT({state, dispatch, getters, rootState}: any, activeArr: any = []) {
|
|
|
const cql: any = ["(geoType = 2)"]
|
|
|
- cql.push(`(typeValue in (${store.getters['gis/elementActiveArr'].length > 0 ? store.getters['gis/elementActiveArr'].map(v => `'${v.value}'`).join(',') : -1}))`)
|
|
|
+ cql.push(`(typeValue in (${getters['elementActiveArr'].length > 0 ? getters['elementActiveArr'].map(v => `'${v.value}'`).join(',') : -1}))`)
|
|
|
const notIds: Array<string> = []
|
|
|
if (state.gisParams.default.feature) {
|
|
|
notIds.push(`'${state.gisParams.default.feature.getId()}'`)
|
|
@@ -805,7 +815,7 @@ const mutations = {
|
|
|
vp = `locationValue:${formatWkt(state.analysis.wkt)}`
|
|
|
}
|
|
|
const tileWMS = new source.TileWMS({
|
|
|
- url: `/${store.state.app.apiProxy.geoserverApi}/geoserver/mysqlGeo/wms`,
|
|
|
+ url: `/${rootState.app.apiProxy.geoserverApi}/geoserver/mysqlGeo/wms`,
|
|
|
params: {
|
|
|
'FORMAT': 'image/png8',
|
|
|
'VERSION': '1.1.1',
|
|
@@ -818,7 +828,7 @@ const mutations = {
|
|
|
})
|
|
|
state.element.layer.setSource(tileWMS)
|
|
|
},
|
|
|
- SET_GIS_QY_ANALYSIS_ELEMENT(state) {
|
|
|
+ LOAD_GIS_QY_ANALYSIS_ELEMENT({state, dispatch, rootState}: any) {
|
|
|
if (state.gisParams.qy.analysisWKT) {
|
|
|
const cql: any = ["(geoType = 1)", "(typeValue in ('gal', 'shl', 'myl'))"]
|
|
|
const notIds: Array<string> = []
|
|
@@ -830,7 +840,7 @@ const mutations = {
|
|
|
}
|
|
|
|
|
|
const tileWMS = new source.TileWMS({
|
|
|
- url: `/${store.state.app.apiProxy.geoserverApi}/geoserver/mysqlGeo/wms`,
|
|
|
+ url: `/${rootState.app.apiProxy.geoserverApi}/geoserver/mysqlGeo/wms`,
|
|
|
params: {
|
|
|
'FORMAT': 'image/png8',
|
|
|
'VERSION': '1.1.1',
|
|
@@ -844,7 +854,7 @@ const mutations = {
|
|
|
state.gisParams.qy.analysisDeviceLayer.setSource(tileWMS)
|
|
|
}
|
|
|
},
|
|
|
- SET_GIS_ANALYSIS_ELEMENT(state) {
|
|
|
+ LOAD_GIS_ANALYSIS_ELEMENT({state, dispatch, rootState}: any) {
|
|
|
if (state.analysis.wkt) {
|
|
|
const cql: any = ["(geoType = 1)", "(typeValue in ('gal', 'shl', 'myl'))"]
|
|
|
const notIds: Array<string> = []
|
|
@@ -855,7 +865,7 @@ const mutations = {
|
|
|
cql.push(`(dataId not in (${notIds.join(',')}))`)
|
|
|
}
|
|
|
const tileWMS = new source.TileWMS({
|
|
|
- url: `/${store.state.app.apiProxy.geoserverApi}/geoserver/mysqlGeo/wms`,
|
|
|
+ url: `/${rootState.app.apiProxy.geoserverApi}/geoserver/mysqlGeo/wms`,
|
|
|
params: {
|
|
|
'FORMAT': 'image/png8',
|
|
|
'VERSION': '1.1.1',
|
|
@@ -869,10 +879,10 @@ const mutations = {
|
|
|
state.analysis.deviceLayer.setSource(tileWMS)
|
|
|
}
|
|
|
},
|
|
|
- SET_GIS_ANALYSIS(state, {wkt, center}) {
|
|
|
+ LOAD_GIS_ANALYSIS({state, dispatch, rootGetters, rootState}: any, {wkt, center}) {
|
|
|
state.analysis.wkt = wkt
|
|
|
- store.commit('gis/SET_GIS_ELEMENT')
|
|
|
- store.commit('gis/SET_GIS_ANALYSIS_ELEMENT')
|
|
|
+ dispatch('LOAD_GIS_ELEMENT')
|
|
|
+ dispatch('LOAD_GIS_ANALYSIS_ELEMENT')
|
|
|
state.analysis.power = []
|
|
|
state.analysis.device = []
|
|
|
state.analysis.loading = true
|
|
@@ -885,7 +895,7 @@ const mutations = {
|
|
|
service: 'WFS',
|
|
|
version: '1.0.0',
|
|
|
request: 'GetFeature',
|
|
|
- typename: store.state.dictionary.elementTypeList.filter(v => v.dictType === 'sb').map(v => v.geoType).join(','),
|
|
|
+ typename: rootState.dictionary.elementTypeList.filter(v => v.dictType === 'sb').map(v => v.geoType).join(','),
|
|
|
srsName: 'EPSG:4326',
|
|
|
outputFormat: 'application/json',
|
|
|
CQL_FILTER: `INTERSECTS(location, ${wkt})`
|
|
@@ -898,7 +908,7 @@ const mutations = {
|
|
|
deviceArr.push({
|
|
|
name: v.properties.name,
|
|
|
status: v.properties.online === '1' ? '在线' : '离线',
|
|
|
- type: store.getters['dictionary/elementTypeMap'].get(v.properties.typeValue),
|
|
|
+ type: rootGetters['dictionary/elementTypeMap'].get(v.properties.typeValue),
|
|
|
distanceValue: turf.distance(center, [Number(v.geometry.coordinates[0]), Number(v.geometry.coordinates[1])], {units: 'kilometers'}).toFixed(3),
|
|
|
distance: turf.distance(center, [Number(v.geometry.coordinates[0]), Number(v.geometry.coordinates[1])], {units: 'kilometers'}).toFixed(2) + 'km'
|
|
|
})
|
|
@@ -910,7 +920,7 @@ const mutations = {
|
|
|
state.analysis.loading = false
|
|
|
})
|
|
|
},
|
|
|
- SET_GIS_ANALYSIS_RESET(state) {
|
|
|
+ LOAD_GIS_ANALYSIS_RESET({state, dispatch}: any) {
|
|
|
state.analysis.wkt = ''
|
|
|
state.analysis.power = []
|
|
|
state.analysis.device = []
|
|
@@ -918,18 +928,10 @@ const mutations = {
|
|
|
state.analysis.deviceLayer.setSource(null)
|
|
|
state.gisParams.default.feature?.set('isAnalysis', false)
|
|
|
state.gisParams.default.feature?.get('resetStyle')()
|
|
|
- store.commit('gis/SET_GIS_ELEMENT')
|
|
|
+ dispatch('LOAD_GIS_ELEMENT')
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-const actions = {
|
|
|
- LOAD_GIS_MAP({ commit }: any, {map, defaultDom, qyDom}: any) {
|
|
|
- if (!state.map) {
|
|
|
- commit('SET_GIS_MAP', {map, defaultDom, qyDom})
|
|
|
- }
|
|
|
- },
|
|
|
-}
|
|
|
-
|
|
|
export default {
|
|
|
namespaced: true,
|
|
|
state,
|