吉安感知网项目-前端
shuishen
2026-02-03 89380e6260a75d1d3b94de687ebcc2f50d50659d
applications/drone-command/src/views/areaManage/sceneManage/FormDiaLog.vue
@@ -107,16 +107,12 @@
                     start-placeholder="开始时间"
                     end-placeholder="结束时间"
                     value-format="YYYY-MM-DD HH:mm:ss"
                     :disabled-date="disablePastDate"
                     clearable
                  />
               </el-form-item>
               <el-form-item label="指挥点位置" prop="longitude">
                  <el-input
                     class="command-input"
                     :model-value="commandPointText"
                     disabled
                     placeholder="请选择指挥点位置"
                  >
                  <el-input class="command-input" :model-value="commandPointText" disabled placeholder="请选择指挥点位置">
                     <template #suffix>
                        <span class="suffix-action">地图选点</span>
                     </template>
@@ -157,9 +153,13 @@
import { saveOperationLog } from '@ztzf/apis'
import { useRoute } from 'vue-router'
import { fwAreaDivideDetailApi, fwAreaDivideListApi } from '../partition/partitionApi'
import { buildEllipsePositions } from '@/utils/cesium/shapeTools'
import {
   addBufferRadiusLabelEntity,
   buildEllipsePositions,
} from '@/utils/cesium/shapeTools'
import { cartesian3Convert } from '@/utils/cesium/mapUtil'
import { AREA_TYPE_STYLE_MAP, BUFFER_LEVEL_STYLES, DEFAULT_AREA_STYLE } from '@ztzf/constants'
import { MapTooltip } from '@ztzf/utils'
// 初始化表单数据
const initForm = () => ({
@@ -174,12 +174,12 @@
})
const commandPointText = computed(() => {
  // 你也可以改成 `${lng}, ${lat}`
  if (!formData.value.longitude) {
   return ''
  }
  return `${formData.value.longitude}, ${formData.value.latitude}`;
});
   // 你也可以改成 `${lng}, ${lat}`
   if (!formData.value.longitude) {
      return ''
   }
   return `${formData.value.longitude}, ${formData.value.latitude}`
})
const emit = defineEmits(['success'])
const formRef = ref(null) // 表单实例
@@ -198,6 +198,16 @@
let redPointEntity
let areaDisplaySource
let leftClickBound = false
let mouseMoveBound = false
let mapTooltip
let publicCesium
const tooltipEventKey = 'scene-manage-point-tip'
const disablePastDate = date => {
   if (!date) return false
   const todayStart = new Date()
   todayStart.setHours(0, 0, 0, 0)
   return date.getTime() < todayStart.getTime()
}
// 表单验证规则
const rules = {
@@ -391,9 +401,7 @@
               const resolved = resolveLngLatPoint(point)
               const normalized = normalizeShapePoint(resolved)
               if (!normalized) return
               positions.push(
                  Cesium.Cartesian3.fromDegrees(normalized.lng, normalized.lat, normalized.height)
               )
               positions.push(Cesium.Cartesian3.fromDegrees(normalized.lng, normalized.lat, normalized.height))
            })
         }
         if (shape?.drawType === 'buffer' && shape?.meta?.center && Array.isArray(shape?.meta?.bufferRadii)) {
@@ -466,6 +474,10 @@
                     material: style.outline,
                  },
               })
               addBufferRadiusLabelEntity(dataSource, centerCartesian, radius, {
                  name: 'scene-manage-area-display',
                  customData: { drawType: 'buffer', label: 'radius' },
               })
            })
            return
         }
@@ -521,6 +533,8 @@
   const list = res?.data?.data ?? []
   areaList.value = await ensureAreaExtList(list)
   renderSceneAreas()
   await nextTick()
   fitViewToSceneAreas()
}
async function getSceneConfigList() {
@@ -532,7 +546,6 @@
   const res = await fwDefenseSceneListApi(params)
   sceneConfigList.value = res?.data?.data ?? []
}
// 获取场景配置名称
function getSceneConfigName(id) {
@@ -555,13 +568,36 @@
// 初始化地图实例
function initMap() {
   if (viewer) return
   const map = mapRef.value?.getMap()
   if (!map?.viewer) return
   viewer = map.viewer
   viewer ||= map.viewer
   publicCesium ||= map.publicCesium
   if (!readonly.value && !leftClickBound) {
      map.publicCesium?.addLeftClickEvent?.(null, LeftClickEvent)
      leftClickBound = true
   }
   if (!readonly.value) ensurePointTooltip()
}
function ensurePointTooltip() {
   if (!viewer || !publicCesium || mouseMoveBound) return
   mapTooltip ||= new MapTooltip(viewer, { offset: { x: 28, y: 24 } })
   publicCesium.addMouseHandler?.(
      null,
      movement => {
         if (!visible.value || readonly.value) return
         mapTooltip?.show('点击地图选择指挥点位置', movement.endPosition)
      },
      tooltipEventKey
   )
   mouseMoveBound = true
}
function clearPointTooltip() {
   mapTooltip?.hide()
   if (publicCesium && mouseMoveBound) {
      publicCesium.removeMouseHandler?.(tooltipEventKey)
      mouseMoveBound = false
   }
}
@@ -626,6 +662,9 @@
   redPointEntity = null
   await nextTick()
   initMap()
   if (dialogMode.value === 'view') {
      clearPointTooltip()
   }
   await getSceneConfigList()
   if (dialogMode.value === 'add') {
      mapRef.value?.zoomToAdminBoundary?.()
@@ -638,8 +677,7 @@
   fitViewToSceneAreas()
}
onMounted(() => {
})
onMounted(() => {})
watch(
   () => formData.value.defenseSceneId,
@@ -652,10 +690,12 @@
watch(
   () => visible.value,
   val => {
      if (!val) clearAreaDisplay()
      if (!val) {
         clearAreaDisplay()
         clearPointTooltip()
      }
   }
)
defineExpose({
   open,