|
@@ -90,21 +90,7 @@ import ToolCom from './tools/tool.vue'
|
|
|
import PositionCom from './tools/position.vue'
|
|
|
import BaseCom from './tools/base.vue'
|
|
|
import ExampleCom from './tools/example.vue'
|
|
|
-import * as source from "ol/source";
|
|
|
-import * as layer from "ol/layer";
|
|
|
-import * as style from "ol/style";
|
|
|
-import * as format from "ol/format";
|
|
|
-import QyStyle from '../map-info/style/qy'
|
|
|
-import SbStyle from '../map-info/style/sb'
|
|
|
-import CommonStyle from '../map-info/style/common'
|
|
|
-import * as ol from "ol";
|
|
|
-import { v4 } from "uuid";
|
|
|
-import * as proj from "ol/proj";
|
|
|
-import * as turf from '@turf/turf'
|
|
|
-import * as geom from 'ol/geom';
|
|
|
import VideoPlayKedaCom from "@/views/gis/business/common/VideoPlayKeda.vue";
|
|
|
-import V2Table from "./v2-table.vue";
|
|
|
-import {deviceQuery, enterpriseQuery} from "@/api/modules/enterprise";
|
|
|
import {clearLocationDom} from '@/components/easyMap/func/location'
|
|
|
import {clearMeasureDom} from '@/components/easyMap/func/measure'
|
|
|
import GisDefaultDom from '../map-info/overlay/default/index.vue'
|
|
@@ -122,7 +108,6 @@ export default defineComponent({
|
|
|
BaseCom,
|
|
|
ExampleCom,
|
|
|
VideoPlayKedaCom,
|
|
|
- V2Table,
|
|
|
GisDefaultDom,
|
|
|
GisQyDom,
|
|
|
},
|
|
@@ -142,26 +127,12 @@ export default defineComponent({
|
|
|
element: null,
|
|
|
position: null
|
|
|
},
|
|
|
- qyParams: {
|
|
|
- layer: <any>null,
|
|
|
- source: <any>null,
|
|
|
- tempFeature: <any>null,
|
|
|
- overlay: <any>null,
|
|
|
- qyInfo: <any>{},
|
|
|
- analysisLayer: <any>null,
|
|
|
- analysisSource: <any>null,
|
|
|
- analysisCircle: <any>null,
|
|
|
- tempSbFeature: <any>null,
|
|
|
- sbOverlay: <any>null,
|
|
|
- sbInfo: <any>{},
|
|
|
- },
|
|
|
videoLayout: {
|
|
|
width: 640,
|
|
|
height: 366,
|
|
|
left: 1200,
|
|
|
top: 460
|
|
|
},
|
|
|
- showVideo: false
|
|
|
})
|
|
|
const ToolsMapper = [
|
|
|
{label: '图层', value: 'element', com: ElementCom, disabled: false},
|
|
@@ -185,55 +156,6 @@ export default defineComponent({
|
|
|
})
|
|
|
state.mapFunc = func
|
|
|
store.commit('gis/SET_GIS_ELEMENT')
|
|
|
- // state.map.on('singleclick', e => {
|
|
|
- // let flag = false
|
|
|
- // map.forEachFeatureAtPixel(e.pixel, (f) => {
|
|
|
- // if (!flag && f.get('featureType')) {
|
|
|
- // flag = true
|
|
|
- // if (f.get('featureType') === 'qy') { // 企业
|
|
|
- // // 恢复上一个要素的样式
|
|
|
- // if (f.getId() !== state.qyParams.tempFeature?.getId()) {
|
|
|
- // onCloseQy()
|
|
|
- // if (f.get('isAnalysis')) {
|
|
|
- // f.setStyle(f.get('analysisActiveStyle'))
|
|
|
- // } else {
|
|
|
- // f.setStyle(f.get('activeStyle'))
|
|
|
- // }
|
|
|
- // state.qyParams.qyInfo = JSON.parse(JSON.stringify(f.get('info')))
|
|
|
- // store.dispatch('gis/LOAD_ACTIVE_QY_ID', f.getId())
|
|
|
- // // 备份新的要素
|
|
|
- // state.qyParams.tempFeature = f
|
|
|
- // state.qyParams.overlay.setPosition(f.getGeometry().getCoordinates())
|
|
|
- // } else {
|
|
|
- // if (state.qyParams.overlay.getPosition() === undefined) {
|
|
|
- // state.qyParams.overlay.setPosition(f.getGeometry().getCoordinates())
|
|
|
- // } else {
|
|
|
- // state.qyParams.overlay.setPosition(undefined)
|
|
|
- // }
|
|
|
- // }
|
|
|
- // } else if (f.get('featureType') === 'sb') { // 设备
|
|
|
- // // 恢复上一个要素的样式
|
|
|
- // if (f.getId() !== state.qyParams.tempSbFeature?.getId()) {
|
|
|
- // state.qyParams.tempSbFeature?.get('resetStyle')?.()
|
|
|
- // // 新的要素
|
|
|
- // if (f.get('isAnalysis')) {
|
|
|
- // f.setStyle(f.get('analysisActiveStyle'))
|
|
|
- // } else {
|
|
|
- // f.setStyle(f.get('activeStyle'))
|
|
|
- // }
|
|
|
- // state.qyParams.sbInfo = JSON.parse(JSON.stringify(f.get('info')))
|
|
|
- // state.qyParams.sbOverlay.setPosition(f.getGeometry().getCoordinates())
|
|
|
- // // 备份新的要素
|
|
|
- // state.qyParams.tempSbFeature = f
|
|
|
- // }
|
|
|
- // state.qyParams.overlay.setPosition(undefined)
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }, {
|
|
|
- // hitTolerance: 0,
|
|
|
- // });
|
|
|
- // })
|
|
|
- // initQYLayer()
|
|
|
}
|
|
|
const menuCpt = computed(() => {
|
|
|
return router.options.routes.filter(v => v.name === store.state.gis.menuRootName)[0].children?.filter(v => !v.meta.noMenu)
|
|
@@ -282,260 +204,6 @@ export default defineComponent({
|
|
|
state.toolsType = (state.toolsType === item.value ? '' : item.value)
|
|
|
}
|
|
|
}
|
|
|
- const ref_qyDom = ref()
|
|
|
- const ref_sbDom = ref()
|
|
|
- const initQYLayer = () => {
|
|
|
- enterpriseQuery({
|
|
|
- "pageNumber":1,
|
|
|
- "pageSize":200,
|
|
|
- // "entName":null,
|
|
|
- // "entType":"加工增值"
|
|
|
- }).then((res: any) => {
|
|
|
- if (res.resp_code === 0 && res.datas?.length > 0) {
|
|
|
- const features: any = []
|
|
|
- res.datas.forEach(v => {
|
|
|
- try {
|
|
|
- const feat: any = new format.WKT().readFeature(`POINT(${v.longitude} ${v.latitude})`)
|
|
|
- let type = ''
|
|
|
- if (v.qykx === '零关税自用进口生产设备') {
|
|
|
- type = 'lgszyjkscsb'
|
|
|
- } else if (v.qykx === '加工增值免关税') {
|
|
|
- type = 'jgzzmgs'
|
|
|
- } else if (v.qykx === '零关税进口原辅料') {
|
|
|
- type = 'lgsjkyfl'
|
|
|
- }
|
|
|
- feat.set('defaultStyle', QyStyle.qyStyle(type))
|
|
|
- feat.set('activeStyle', [...CommonStyle.activeStyle(), ...QyStyle.qyStyle(type)])
|
|
|
- feat.set('analysisStyle', [...CommonStyle.analysisStyle(), ...QyStyle.qyStyle(type)])
|
|
|
- feat.set('analysisActiveStyle', [...CommonStyle.activeStyle(), ...CommonStyle.analysisStyle(), ...QyStyle.qyStyle(type)])
|
|
|
- feat.set('isAnalysis', false)
|
|
|
- feat.set('resetStyle', () => {
|
|
|
- if (feat.get('isAnalysis')) {
|
|
|
- feat.setStyle(feat.get('analysisStyle'))
|
|
|
- } else {
|
|
|
- feat.setStyle(feat.get('defaultStyle'))
|
|
|
- }
|
|
|
- })
|
|
|
- const obj = {
|
|
|
- coordinates: feat.getGeometry().getCoordinates(),
|
|
|
- tab: '1',
|
|
|
- name: v.qymc,
|
|
|
- 1: {
|
|
|
- name: v.qymc,
|
|
|
- people: v.lerep,
|
|
|
- number: v.uniscid,
|
|
|
- address: v.dom
|
|
|
- },
|
|
|
- 2: {},
|
|
|
- 3: {},
|
|
|
- 4: {},
|
|
|
- 5: {
|
|
|
- radius: 10,
|
|
|
- center: feat.getGeometry().getCoordinates(),
|
|
|
- tableData: [],
|
|
|
- loading: false,
|
|
|
- radiusTips: false
|
|
|
- },
|
|
|
- }
|
|
|
- feat.set('info', obj)
|
|
|
- feat.set('featureType', 'qy')
|
|
|
- feat.setStyle(feat.get('defaultStyle'))
|
|
|
- feat.setId(v.id)
|
|
|
- feat.set('mockClick', () => {
|
|
|
- state.qyParams.tempFeature?.get('resetStyle')?.()
|
|
|
- state.qyParams.analysisSource?.clear()
|
|
|
- // 新的要素
|
|
|
- if (feat.get('isAnalysis')) {
|
|
|
- feat.setStyle(feat.get('analysisActiveStyle'))
|
|
|
- } else {
|
|
|
- feat.setStyle(feat.get('activeStyle'))
|
|
|
- }
|
|
|
- state.qyParams.qyInfo = JSON.parse(JSON.stringify(feat.get('info')))
|
|
|
- // 备份新的要素
|
|
|
- state.qyParams.tempFeature = feat
|
|
|
- state.qyParams.overlay.setPosition(feat.getGeometry().getCoordinates())
|
|
|
- store.dispatch('gis/LOAD_ACTIVE_QY_ID', v.id)
|
|
|
- })
|
|
|
- feat.set('reset', () => {
|
|
|
- onCloseQy()
|
|
|
- onCloseSb()
|
|
|
- })
|
|
|
- features.push(feat)
|
|
|
- } catch (e) {
|
|
|
- console.error('异常企业:', v)
|
|
|
- }
|
|
|
- })
|
|
|
- state.qyParams.source = new source.Vector({
|
|
|
- features: features,
|
|
|
- wrapX: false
|
|
|
- })
|
|
|
- state.qyParams.layer = new layer.VectorImage({
|
|
|
- source: state.qyParams.source,
|
|
|
- zIndex: 10,
|
|
|
- layerName: 'qy'
|
|
|
- })
|
|
|
- state.map.addLayer(state.qyParams.layer)
|
|
|
- // 详情
|
|
|
- state.qyParams.overlay = new ol.Overlay({
|
|
|
- id: v4(),
|
|
|
- element: ref_qyDom.value,
|
|
|
- autoPan: false,
|
|
|
- offset: [0, -60],
|
|
|
- positioning: 'bottom-center',
|
|
|
- stopEvent: true,
|
|
|
- autoPanAnimation: {
|
|
|
- duration: 250
|
|
|
- }
|
|
|
- })
|
|
|
- state.map.addOverlay(state.qyParams.overlay)
|
|
|
- // 详情
|
|
|
- state.qyParams.sbOverlay = new ol.Overlay({
|
|
|
- id: v4(),
|
|
|
- element: ref_sbDom.value,
|
|
|
- autoPan: false,
|
|
|
- offset: [0, -60],
|
|
|
- positioning: 'bottom-center',
|
|
|
- stopEvent: true,
|
|
|
- autoPanAnimation: {
|
|
|
- duration: 250
|
|
|
- }
|
|
|
- })
|
|
|
- state.map.addOverlay(state.qyParams.sbOverlay)
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- const onCloseQy = () => {
|
|
|
- state.qyParams.overlay?.setPosition(undefined)
|
|
|
- state.qyParams.tempFeature?.get('resetStyle')()
|
|
|
- state.qyParams.tempFeature = null
|
|
|
- state.qyParams.qyInfo = {}
|
|
|
- state.qyParams.analysisSource?.clear()
|
|
|
- store.dispatch('gis/LOAD_ACTIVE_QY_ID', null)
|
|
|
- state.qyParams.sbOverlay?.setPosition(undefined)
|
|
|
- state.qyParams.tempSbFeature?.get('resetStyle')()
|
|
|
- state.qyParams.tempSbFeature = null
|
|
|
- state.qyParams.sbInfo = {}
|
|
|
- }
|
|
|
- const onCloseSb = () => {
|
|
|
- state.qyParams.sbOverlay?.setPosition(undefined)
|
|
|
- state.qyParams.tempSbFeature?.get('resetStyle')()
|
|
|
- state.qyParams.tempSbFeature = null
|
|
|
- }
|
|
|
- const handleRangeBlur = () => {
|
|
|
- // if (!state.qyParams.qyInfo['5'].radius) {
|
|
|
- // state.qyParams.qyInfo['5'].radius = 10
|
|
|
- // }
|
|
|
- // setCircle()
|
|
|
- }
|
|
|
- const handleRangeInput = (v) => {
|
|
|
- const nV = Number(v)
|
|
|
- if (!isNaN(Number(nV))) {
|
|
|
- if (nV < 1 || nV > 60) {
|
|
|
- state.qyParams.qyInfo['5'].radiusTips = true
|
|
|
- } else {
|
|
|
- state.qyParams.qyInfo['5'].radiusTips = false
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- const setCircle = () => {
|
|
|
- const circle = turf.circle(state.qyParams.qyInfo.coordinates, state.qyParams.qyInfo['5'].radius, {steps: 1024, units: 'kilometers'})
|
|
|
- state.qyParams.analysisCircle.setGeometry(new geom.Polygon(circle.geometry.coordinates))
|
|
|
- }
|
|
|
- const onRadiusSubmit = () => {
|
|
|
- if (!state.qyParams.analysisLayer) {
|
|
|
- state.qyParams.analysisSource = new source.Vector()
|
|
|
- state.qyParams.analysisLayer = new layer.Vector({
|
|
|
- zIndex: 9,
|
|
|
- source: state.qyParams.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.qyParams.analysisCircle = new ol.Feature()
|
|
|
- state.qyParams.analysisSource.addFeature(state.qyParams.analysisCircle)
|
|
|
- setCircle()
|
|
|
- state.map.addLayer(state.qyParams.analysisLayer)
|
|
|
- }
|
|
|
- if (!state.qyParams.qyInfo['5'].radiusTips) {
|
|
|
- state.qyParams.analysisSource.clear()
|
|
|
- state.qyParams.analysisSource.addFeature(state.qyParams.analysisCircle)
|
|
|
- setCircle()
|
|
|
- state.qyParams.qyInfo['5'].tableData = []
|
|
|
- state.qyParams.qyInfo['5'].loading = true
|
|
|
- that.$api.deviceQuery({
|
|
|
- lon: state.qyParams.qyInfo.coordinates[0],
|
|
|
- lat: state.qyParams.qyInfo.coordinates[1],
|
|
|
- radius: state.qyParams.qyInfo['5'].radius
|
|
|
- }).then((res: any) => {
|
|
|
- // console.log(res)
|
|
|
- // for (let i = 0; i < 500; i++) {
|
|
|
- // state.qyParams.qyInfo['5'].tableData.push({
|
|
|
- // name: '505县道新安村路口1-枪机-0110580_' + i,
|
|
|
- // code: '46044123124125125',
|
|
|
- // status: i % 3 === 0 ? '1' : '0',
|
|
|
- // typeName: '公安类',
|
|
|
- // type: i % 3 === 0 ? 'galsb' : (i % 3 === 1 ? 'shlsb' : 'mylsb'),
|
|
|
- // wkt: `POINT(${that.$util.randomNum(108.738329, 110.912130, 6)} ${that.$util.randomNum(18.154784, 20, 6)})`
|
|
|
- // })
|
|
|
- // }
|
|
|
- if (res.resp_code === 0 && res.datas?.length > 0) {
|
|
|
- console.log(res.datas?.length)
|
|
|
- const features: any = []
|
|
|
- res.datas?.forEach(v => {
|
|
|
- try {
|
|
|
- const feat: any = new format.WKT().readFeature(`POINT(${v.longitude} ${v.latitude})`)
|
|
|
- let type = ''
|
|
|
- if (v.type === '公安类') {
|
|
|
- type = 'galsb'
|
|
|
- } else if (v.type === '社会类') {
|
|
|
- type = 'shlsb'
|
|
|
- } else if (v.type === '民用类') {
|
|
|
- type = 'mylsb'
|
|
|
- }
|
|
|
- feat.set('defaultStyle', SbStyle.sbStyle(type))
|
|
|
- feat.set('activeStyle', [...CommonStyle.activeStyle(), ...SbStyle.sbStyle(type)])
|
|
|
- feat.set('analysisStyle', [...CommonStyle.analysisStyle(), ...SbStyle.sbStyle(type)])
|
|
|
- feat.set('analysisActiveStyle', [...CommonStyle.activeStyle(), ...CommonStyle.analysisStyle(), ...SbStyle.sbStyle(type)])
|
|
|
- feat.set('isAnalysis', true)
|
|
|
- feat.set('resetStyle', () => {
|
|
|
- if (feat.get('isAnalysis')) {
|
|
|
- feat.setStyle(feat.get('analysisStyle'))
|
|
|
- } else {
|
|
|
- feat.setStyle(feat.get('defaultStyle'))
|
|
|
- }
|
|
|
- })
|
|
|
- feat.setStyle(feat.get('analysisStyle'))
|
|
|
- feat.set('featureType', 'sb')
|
|
|
- feat.set('info', v)
|
|
|
- feat.setId(v.deviceid)
|
|
|
- features.push(feat)
|
|
|
- state.qyParams.qyInfo['5'].tableData.push(v)
|
|
|
- } catch (e) {
|
|
|
- console.error('异常设备', v)
|
|
|
- }
|
|
|
- })
|
|
|
- state.qyParams.analysisSource.addFeatures(features)
|
|
|
- }
|
|
|
- state.qyParams.qyInfo['5'].loading = false
|
|
|
- }).catch(() => {
|
|
|
- state.qyParams.qyInfo['5'].loading = true
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- const onRadiusReset = () => {
|
|
|
- state.qyParams.qyInfo['5'].radius = 10
|
|
|
- state.qyParams.qyInfo['5'].radiusTips = false
|
|
|
- onRadiusSubmit()
|
|
|
- }
|
|
|
const mockSB1 = () => {
|
|
|
store.dispatch('gis/LOAD_GIS_PARAMS_DEFAULT', {
|
|
|
type: 'sb',
|
|
@@ -654,15 +322,6 @@ export default defineComponent({
|
|
|
searchHandleMapSearch,
|
|
|
searchToMapLocation,
|
|
|
toolsHandleClick,
|
|
|
- ref_qyDom,
|
|
|
- onCloseQy,
|
|
|
- onCloseSb,
|
|
|
- handleRangeBlur,
|
|
|
- handleRangeInput,
|
|
|
- setCircle,
|
|
|
- onRadiusSubmit,
|
|
|
- onRadiusReset,
|
|
|
- ref_sbDom,
|
|
|
ref_gisDefault,
|
|
|
ref_gisQy,
|
|
|
mockSB1,
|