|
@@ -12,7 +12,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</div>
|
|
|
- <div class="gis-tools">
|
|
|
+ <div class="gis-tools" v-if="map">
|
|
|
<div class="gt-search __box-shadow">
|
|
|
<el-autocomplete
|
|
|
ref="ref_search"
|
|
@@ -253,9 +253,9 @@ export default defineComponent({
|
|
|
showVideo: false
|
|
|
})
|
|
|
const ToolsMapper = [
|
|
|
- {label: '图层', value: 'element', com: ElementCom, disabled: true},
|
|
|
- {label: '框选', value: 'select', com: SelectCom, disabled: true},
|
|
|
- {label: '周边分析', value: 'analysis', com: AnalysisCom, disabled: true},
|
|
|
+ {label: '图层', value: 'element', com: ElementCom, disabled: false},
|
|
|
+ {label: '框选', value: 'select', com: SelectCom, disabled: false},
|
|
|
+ {label: '周边分析', value: 'analysis', com: AnalysisCom, disabled: false},
|
|
|
{label: '工具', value: 'tool', com: ToolCom},
|
|
|
{label: '定位', value: 'position', com: PositionCom},
|
|
|
{label: '清空标绘', value: 'clear', com: undefined},
|
|
@@ -271,55 +271,56 @@ export default defineComponent({
|
|
|
defaultDom: ref_gisDefault.value
|
|
|
})
|
|
|
state.mapFunc = func
|
|
|
- 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()
|
|
|
+ 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)
|