|
@@ -15,6 +15,8 @@ import store from "@/store";
|
|
import axios from "axios";
|
|
import axios from "axios";
|
|
import {formatPosition} from "@/utils/easyMap";
|
|
import {formatPosition} from "@/utils/easyMap";
|
|
import * as turf from "@turf/turf";
|
|
import * as turf from "@turf/turf";
|
|
|
|
+
|
|
|
|
+import PointIcon from "@/assets/images/gis-layout/gis-layout-tools_tool-bz_icon.png";
|
|
|
|
|
|
const formatWkt = (wkt) => {
|
|
const formatWkt = (wkt) => {
|
|
return wkt.split(',').join('\\\,')
|
|
return wkt.split(',').join('\\\,')
|
|
@@ -32,6 +34,7 @@ const state = {
|
|
map: null,
|
|
map: null,
|
|
activeQyId: null,
|
|
activeQyId: null,
|
|
gisParams: {
|
|
gisParams: {
|
|
|
|
+ autoZoom: 12,
|
|
default: {
|
|
default: {
|
|
layer: null,
|
|
layer: null,
|
|
source: null,
|
|
source: null,
|
|
@@ -72,18 +75,18 @@ const state = {
|
|
label: '设备资源',
|
|
label: '设备资源',
|
|
active: true,
|
|
active: true,
|
|
children: [
|
|
children: [
|
|
- {label: '公安类设备', value: 'galsb', geoValue: 'gal', active: true},
|
|
+ {label: '公安类设备', value: 'galsb', geoValue: 'gal', active: true, typeName: 'mysqlGeo:stg_view_deviceinfo_df_value1'},
|
|
- {label: '社会类设备', value: 'shlsb', geoValue: 'shl', active: true},
|
|
+ {label: '社会类设备', value: 'shlsb', geoValue: 'shl', active: true, typeName: 'mysqlGeo:stg_view_deviceinfo_df_value2'},
|
|
- {label: '民用类设备', value: 'mylsb', geoValue: 'myl', active: true},
|
|
+ {label: '民用类设备', value: 'mylsb', geoValue: 'myl', active: true, typeName: 'mysqlGeo:stg_view_deviceinfo_df_value3'},
|
|
]
|
|
]
|
|
},
|
|
},
|
|
{
|
|
{
|
|
label: '企业',
|
|
label: '企业',
|
|
active: true,
|
|
active: true,
|
|
children: [
|
|
children: [
|
|
- {label: '零关税自用进口生产设备', value: 'lgszyjkscsb', geoValue: 'lgszyjkscsb', active: true},
|
|
+ {label: '零关税自用进口生产设备', value: 'lgszyjkscsb', geoValue: 'lgszyjkscsb', active: true, typeName: 'mysqlGeo:lgsqy_typeValue1'},
|
|
- {label: '加工增值免关税', value: 'jgzzmgs', geoValue: 'jgzzmgs', active: true},
|
|
+ {label: '加工增值免关税', value: 'jgzzmgs', geoValue: 'jgzzmgs', active: true, typeName: 'mysqlGeo:lgsqy_typeValue2'},
|
|
- {label: '零关税进口原辅料', value: 'lgsjkyfl', geoValue: 'lgsjkfzl', active: true},
|
|
+ {label: '零关税进口原辅料', value: 'lgsjkyfl', geoValue: 'lgsjkfzl', active: true, typeName: 'mysqlGeo:lgsqy_typeValue3'},
|
|
]
|
|
]
|
|
},
|
|
},
|
|
|
|
|
|
@@ -101,11 +104,37 @@ const state = {
|
|
],
|
|
],
|
|
layer: null,
|
|
layer: null,
|
|
},
|
|
},
|
|
|
|
+ analysis: {
|
|
|
|
+ source: null,
|
|
|
|
+ layer: null,
|
|
|
|
+ wkt: '',
|
|
|
|
+ deviceLayer: null,
|
|
|
|
+ power: [],
|
|
|
|
+ device: [],
|
|
|
|
+ loading: false
|
|
|
|
+ },
|
|
l: null,
|
|
l: null,
|
|
s: null
|
|
s: null
|
|
}
|
|
}
|
|
|
|
|
|
const getters = {
|
|
const getters = {
|
|
|
|
+ elementActiveArr: (state) => {
|
|
|
|
+ const arr: any = []
|
|
|
|
+ state.element.list.forEach(p => {
|
|
|
|
+ if (p.children?.length > 0) {
|
|
|
|
+ p.children.forEach(s => {
|
|
|
|
+ if (s.active) {
|
|
|
|
+ arr.push(s)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ if (p.active) {
|
|
|
|
+ arr.push(p)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ return arr
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
const mutations = {
|
|
const mutations = {
|
|
@@ -214,6 +243,34 @@ const mutations = {
|
|
zIndex: 30
|
|
zIndex: 30
|
|
})
|
|
})
|
|
state.map.addLayer(state.gisParams.qy.analysisDeviceLayer)
|
|
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.map.addLayer(state.analysis.layer)
|
|
|
|
+ state.analysis.deviceLayer = new layer.Tile({
|
|
|
|
+ zIndex: 30
|
|
|
|
+ })
|
|
|
|
+ state.map.addLayer(state.analysis.deviceLayer)
|
|
const clickQy = (e, feat) => {
|
|
const clickQy = (e, feat) => {
|
|
if (state.gisParams.qy.overlay.getPosition() === undefined) {
|
|
if (state.gisParams.qy.overlay.getPosition() === undefined) {
|
|
state.gisParams.qy.overlay.setPosition(state.gisParams.qy.feature.getGeometry().getCoordinates())
|
|
state.gisParams.qy.overlay.setPosition(state.gisParams.qy.feature.getGeometry().getCoordinates())
|
|
@@ -364,6 +421,10 @@ const mutations = {
|
|
state.gisParams.qy.source.addFeature(newFeat)
|
|
state.gisParams.qy.source.addFeature(newFeat)
|
|
state.gisParams.qy.overlay.setPosition(newFeat.getGeometry().getCoordinates())
|
|
state.gisParams.qy.overlay.setPosition(newFeat.getGeometry().getCoordinates())
|
|
state.gisParams.qy.feature = newFeat
|
|
state.gisParams.qy.feature = newFeat
|
|
|
|
+ state.map.getView().animate({
|
|
|
|
+ center: newFeat.getGeometry().getCoordinates(),
|
|
|
|
+ zoom: state.gisParams.autoZoom,
|
|
|
|
+ });
|
|
store.commit('gis/SET_GIS_ELEMENT')
|
|
store.commit('gis/SET_GIS_ELEMENT')
|
|
} catch (e) {
|
|
} catch (e) {
|
|
console.log('异常数据:', wkt, info, e)
|
|
console.log('异常数据:', wkt, info, e)
|
|
@@ -466,6 +527,10 @@ const mutations = {
|
|
state.gisParams.default.source.addFeature(newFeat)
|
|
state.gisParams.default.source.addFeature(newFeat)
|
|
state.gisParams.default.overlay.setPosition(newFeat.getGeometry().getCoordinates())
|
|
state.gisParams.default.overlay.setPosition(newFeat.getGeometry().getCoordinates())
|
|
state.gisParams.default.feature = newFeat
|
|
state.gisParams.default.feature = newFeat
|
|
|
|
+ state.map.getView().animate({
|
|
|
|
+ center: newFeat.getGeometry().getCoordinates(),
|
|
|
|
+ zoom: state.gisParams.autoZoom,
|
|
|
|
+ });
|
|
store.commit('gis/SET_GIS_ELEMENT')
|
|
store.commit('gis/SET_GIS_ELEMENT')
|
|
} catch (e) {
|
|
} catch (e) {
|
|
console.log('异常数据:', wkt, info, e)
|
|
console.log('异常数据:', wkt, info, e)
|
|
@@ -502,6 +567,10 @@ const mutations = {
|
|
state.gisParams.default.source.addFeature(newFeat)
|
|
state.gisParams.default.source.addFeature(newFeat)
|
|
state.gisParams.default.overlay.setPosition(newFeat.getGeometry().getCoordinates())
|
|
state.gisParams.default.overlay.setPosition(newFeat.getGeometry().getCoordinates())
|
|
state.gisParams.default.feature = newFeat
|
|
state.gisParams.default.feature = newFeat
|
|
|
|
+ state.map.getView().animate({
|
|
|
|
+ center: newFeat.getGeometry().getCoordinates(),
|
|
|
|
+ zoom: state.gisParams.autoZoom,
|
|
|
|
+ });
|
|
store.commit('gis/SET_GIS_ELEMENT')
|
|
store.commit('gis/SET_GIS_ELEMENT')
|
|
} catch (e) {
|
|
} catch (e) {
|
|
console.log('异常数据:', wkt, info, e)
|
|
console.log('异常数据:', wkt, info, e)
|
|
@@ -538,6 +607,10 @@ const mutations = {
|
|
state.gisParams.default.source.addFeature(newFeat)
|
|
state.gisParams.default.source.addFeature(newFeat)
|
|
state.gisParams.default.overlay.setPosition(newFeat.getGeometry().getCoordinates())
|
|
state.gisParams.default.overlay.setPosition(newFeat.getGeometry().getCoordinates())
|
|
state.gisParams.default.feature = newFeat
|
|
state.gisParams.default.feature = newFeat
|
|
|
|
+ state.map.getView().animate({
|
|
|
|
+ center: newFeat.getGeometry().getCoordinates(),
|
|
|
|
+ zoom: state.gisParams.autoZoom,
|
|
|
|
+ });
|
|
store.commit('gis/SET_GIS_ELEMENT')
|
|
store.commit('gis/SET_GIS_ELEMENT')
|
|
} catch (e) {
|
|
} catch (e) {
|
|
console.log('异常数据:', wkt, info, e)
|
|
console.log('异常数据:', wkt, info, e)
|
|
@@ -574,6 +647,10 @@ const mutations = {
|
|
state.gisParams.default.source.addFeature(newFeat)
|
|
state.gisParams.default.source.addFeature(newFeat)
|
|
state.gisParams.default.overlay.setPosition(newFeat.getGeometry().getCoordinates())
|
|
state.gisParams.default.overlay.setPosition(newFeat.getGeometry().getCoordinates())
|
|
state.gisParams.default.feature = newFeat
|
|
state.gisParams.default.feature = newFeat
|
|
|
|
+ state.map.getView().animate({
|
|
|
|
+ center: newFeat.getGeometry().getCoordinates(),
|
|
|
|
+ zoom: state.gisParams.autoZoom,
|
|
|
|
+ });
|
|
store.commit('gis/SET_GIS_ELEMENT')
|
|
store.commit('gis/SET_GIS_ELEMENT')
|
|
} catch (e) {
|
|
} catch (e) {
|
|
console.log('异常数据:', wkt, info, e)
|
|
console.log('异常数据:', wkt, info, e)
|
|
@@ -610,6 +687,10 @@ const mutations = {
|
|
state.gisParams.default.source.addFeature(newFeat)
|
|
state.gisParams.default.source.addFeature(newFeat)
|
|
state.gisParams.default.overlay.setPosition(newFeat.getGeometry().getCoordinates())
|
|
state.gisParams.default.overlay.setPosition(newFeat.getGeometry().getCoordinates())
|
|
state.gisParams.default.feature = newFeat
|
|
state.gisParams.default.feature = newFeat
|
|
|
|
+ state.map.getView().animate({
|
|
|
|
+ center: newFeat.getGeometry().getCoordinates(),
|
|
|
|
+ zoom: state.gisParams.autoZoom,
|
|
|
|
+ });
|
|
store.commit('gis/SET_GIS_ELEMENT')
|
|
store.commit('gis/SET_GIS_ELEMENT')
|
|
} catch (e) {
|
|
} catch (e) {
|
|
console.log('异常数据:', wkt, info, e)
|
|
console.log('异常数据:', wkt, info, e)
|
|
@@ -626,23 +707,9 @@ const mutations = {
|
|
store.commit('gis/SET_GIS_ELEMENT')
|
|
store.commit('gis/SET_GIS_ELEMENT')
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- SET_GIS_ELEMENT(state) {
|
|
+ SET_GIS_ELEMENT(state, activeArr: any = []) {
|
|
- const arr: any = []
|
|
|
|
- state.element.list.forEach(p => {
|
|
|
|
- if (p.children?.length > 0) {
|
|
|
|
- p.children.forEach(s => {
|
|
|
|
- if (s.active) {
|
|
|
|
- arr.push(`'${s.geoValue}'`)
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- } else {
|
|
|
|
- if (p.active) {
|
|
|
|
- arr.push(`'${p.geoValue}'`)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
const cql: any = ["(geoType = 2)"]
|
|
const cql: any = ["(geoType = 2)"]
|
|
- cql.push(`(typeValue in (${arr.length > 0 ? arr.join(',') : -1}))`)
|
|
+ cql.push(`(typeValue in (${store.getters['gis/elementActiveArr'].length > 0 ? store.getters['gis/elementActiveArr'].map(v => `'${v.geoValue}'`).join(',') : -1}))`)
|
|
const notIds: Array<string> = []
|
|
const notIds: Array<string> = []
|
|
if (state.gisParams.default.feature) {
|
|
if (state.gisParams.default.feature) {
|
|
notIds.push(`'${state.gisParams.default.feature.getId()}'`)
|
|
notIds.push(`'${state.gisParams.default.feature.getId()}'`)
|
|
@@ -700,6 +767,43 @@ const mutations = {
|
|
})
|
|
})
|
|
state.gisParams.qy.analysisDeviceLayer.setSource(tileWMS)
|
|
state.gisParams.qy.analysisDeviceLayer.setSource(tileWMS)
|
|
}
|
|
}
|
|
|
|
+ },
|
|
|
|
+ SET_GIS_ANALYSIS(state, {wkt, center}) {
|
|
|
|
+ state.analysis.wkt = wkt
|
|
|
|
+ state.analysis.power = []
|
|
|
|
+ state.analysis.device = []
|
|
|
|
+ state.analysis.loading = true
|
|
|
|
+ axios({
|
|
|
|
+ url: state.element.layer.getSource().getUrls()[0],
|
|
|
|
+ method: 'get',
|
|
|
|
+ params: {
|
|
|
|
+ service: 'WFS',
|
|
|
|
+ version: '1.0.0',
|
|
|
|
+ request: 'GetFeature',
|
|
|
|
+ typename: 'mysqlGeo:stg_view_deviceinfo_df_value1,mysqlGeo:stg_view_deviceinfo_df_value2,mysqlGeo:stg_view_deviceinfo_df_value3',
|
|
|
|
+ srsName: 'EPSG:4326',
|
|
|
|
+ outputFormat: 'application/json',
|
|
|
|
+ CQL_FILTER: `INTERSECTS(location, ${wkt})`
|
|
|
|
+ }
|
|
|
|
+ }).then(res => {
|
|
|
|
+ const powerArr: any = []
|
|
|
|
+ const deviceArr: any = []
|
|
|
|
+ res.data.features.forEach(v => {
|
|
|
|
+ if (['gal', 'shl', 'myl'].includes(v.properties.typeValue)) {
|
|
|
|
+ deviceArr.push({
|
|
|
|
+ name: v.properties.name,
|
|
|
|
+ status: v.properties.online === '1' ? '在线' : '离线',
|
|
|
|
+ type: store.getters['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'
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ state.analysis.device = deviceArr.sort((a, b) => a.distanceValue - b.distanceValue)
|
|
|
|
+ state.analysis.loading = false
|
|
|
|
+ }).catch(() => {
|
|
|
|
+ state.analysis.loading = false
|
|
|
|
+ })
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|