| | |
| | | import * as Cesium from 'cesium' |
| | | import { saveOperationLog } from '@ztzf/apis' |
| | | import { useRoute } from 'vue-router' |
| | | import { MapTooltip } from '@/utils/cesium/shapeTools/Tooltip' |
| | | |
| | | import equipment from '@/assets/images/dataCockpit/legend/equipment.png' |
| | | |
| | |
| | | let viewer |
| | | let redPointEntity |
| | | let rangeCircleEntity |
| | | let mouseMoveBound = false |
| | | let mapTooltip |
| | | let publicCesium |
| | | const tooltipEventKey = 'detection-range-point-tip' |
| | | const formTitle = computed(() => { |
| | | if (dialogMode.value === 'edit') { |
| | | return '编辑侦测范围' |
| | |
| | | viewer = null |
| | | redPointEntity = null |
| | | rangeCircleEntity = null |
| | | clearPointTooltip() |
| | | } |
| | | |
| | | function setMapPoint(longitude, latitude) { |
| | |
| | | const map = mapRef.value?.getMap() |
| | | if (!map?.viewer) return |
| | | viewer = map.viewer |
| | | publicCesium = map.publicCesium |
| | | if (!dialogReadonly.value) { |
| | | map.publicCesium?.addLeftClickEvent?.(null, handleMapClick) |
| | | ensurePointTooltip() |
| | | } |
| | | } |
| | | |
| | | function ensurePointTooltip() { |
| | | if (!viewer || !publicCesium || mouseMoveBound) return |
| | | mapTooltip ||= new MapTooltip(viewer, { offset: { x: 28, y: 24 } }) |
| | | publicCesium.addMouseHandler?.( |
| | | null, |
| | | movement => { |
| | | if (!visible.value || dialogReadonly.value) return |
| | | mapTooltip?.show('点击地图选择设备位置', movement.endPosition) |
| | | }, |
| | | tooltipEventKey |
| | | ) |
| | | mouseMoveBound = true |
| | | } |
| | | |
| | | function clearPointTooltip() { |
| | | mapTooltip?.hide() |
| | | if (publicCesium && mouseMoveBound) { |
| | | publicCesium.removeMouseHandler?.(tooltipEventKey) |
| | | mouseMoveBound = false |
| | | } |
| | | } |
| | | |
| | |
| | | // 打开弹框 |
| | | async function open({ mode, row } = {}) { |
| | | dialogMode.value = mode || 'add' |
| | | clearPointTooltip() |
| | | await nextTick() |
| | | initMap() |
| | | if (dialogMode.value === 'add') { |