吉安感知网项目-前端
罗广辉
2026-01-15 04a859aa95b231c032c71d06518497a973c2f4e8
applications/drone-command/src/views/recordManage/historyTracks/TrajectoryDiaLog.vue
@@ -1,32 +1,59 @@
<template>
   <el-dialog v-model="visible" :title="dialogTitle" @closed="handleClosed" destroy-on-close>
      <div class="bodyBox">
         <div class="leftMap ztzf-cesium" id="leftMapContainer"></div>
         <div class="rightInfo">
            <div>
               <div>无人机名称:{{ formData.droneName }}</div>
               <div>序列号: {{ formData.serialNo }}</div>
               <div>告警时间: {{ formData.alarmTime }}</div>
               <div>触发原因: {{ formData.triggerType }}</div>
               <div>停留时长: {{ formData.stayDuration }}</div>
<template>
   <el-dialog class="ztzf-page-map-view-dialog" v-model="visible" :show-close="false"
      :close-on-click-modal="false" @closed="handleClosed" destroy-on-close>
      <div class="dialog-container">
         <div class="left-container">
            <div class="leftMap ztzf-cesium" id="leftMapContainer"></div>
         </div>
         <div class="right-container">
            <div class="header">{{ dialogTitle }}</div>
            <div class="dialog-container">
               <div class="detail-title">轨迹信息</div>
               <el-row>
                  <el-col :span="24">
                     <div class="label">无人机名称</div>
                     <div class="val">{{ formData.droneName }}</div>
                  </el-col>
                  <el-col :span="24">
                     <div class="label">序列号</div>
                     <div class="val">{{ formData.serialNo }}</div>
                  </el-col>
                  <el-col :span="24">
                     <div class="label">告警时间</div>
                     <div class="val">{{ formData.alarmTime }}</div>
                  </el-col>
                  <el-col :span="24">
                     <div class="label">触发原因</div>
                     <div class="val">{{ formData.triggerType }}</div>
                  </el-col>
                  <el-col :span="24">
                     <div class="label">停留时长</div>
                     <div class="val">{{ formData.stayDuration }}</div>
                  </el-col>
               </el-row>
               <div class="detail-title">轨迹点</div>
               <div class="ztzf-table-container">
                  <div class="ztzf-table-content">
                     <el-table class="ztzf-data-cockpit-table" :data="list">
                        <el-table-column type="index" width="60" label="序号" />
                        <el-table-column label="经纬度">
                           <template #default="{ row }">{{ row.longitude }},{{ row.latitude }}</template>
                        </el-table-column>
                        <el-table-column prop="createTime" label="时间" />
                     </el-table>
                  </div>
               </div>
            </div>
            <el-table :data="list">
               <el-table-column type="index" width="60" label="序号" />
               <el-table-column label="经纬度">
                  <template #default="{ row }">{{ row.longitude }},{{ row.latitude }}</template>
               </el-table-column>
               <el-table-column prop="createTime" label="时间" />
            </el-table>
            <div class="footer">
               <el-button color="#2B2B4C" @click="handleCancel">{{ dialogReadonly ? '关闭' : '取消' }}</el-button>
            </div>
         </div>
      </div>
      <template #footer>
         <el-button @click="handleCancel">{{ dialogReadonly ? '关闭' : '取消' }}</el-button>
      </template>
   </el-dialog>
</template>
<script setup>
import { computed, ref } from 'vue'
import { computed, nextTick, ref } from 'vue'
import { fwDroneFlightRecordDetailApi } from '@/views/recordManage/historyTracks/fwDroneFlightRecord'
import { fwDroneFlightRecordDetailPageApi } from '@/views/recordManage/historyTracks/flyTrajectory'
import { PublicCesium } from '@/utils/cesium/publicCesium'
@@ -57,12 +84,12 @@
})
// 关闭弹框
function handleCancel() {
function handleCancel () {
   visible.value = false
}
// 加载详情
async function loadDetail() {
async function loadDetail () {
   if (!formData.value.id) return
   const res = await fwDroneFlightRecordDetailApi({ id: formData.value.id })
   const res1 = await fwDroneFlightRecordDetailPageApi({ flightRecordId: formData.value.id })
@@ -72,11 +99,11 @@
}
// 角度转c3
function degreesToC3({ longitude, latitude, height = 0 }) {
function degreesToC3 ({ longitude, latitude, height = 0 }) {
   return Cesium.Cartesian3.fromDegrees(longitude, latitude, height)
}
// 渲染航线
function drawFlightPath() {
function drawFlightPath () {
   const positions = list.value.map(p => degreesToC3(p))
   droneLineEntity && geometricSource.entities.remove(droneLineEntity)
   const color = Cesium.Color.fromCssColorString('#00D690')
@@ -92,12 +119,17 @@
}
// 关闭后重置
function handleClosed() {
function handleClosed () {
   formData.value = initForm()
   list.value = []
   viewer = null
   geometricSource = null
   droneLineEntity = null
}
let viewer, geometricSource, droneLineEntity
function initMap() {
function initMap () {
   if (viewer) return
   const publicCesiumInstance = new PublicCesium({
      dom: 'leftMapContainer',
      flatMode: false,
@@ -111,12 +143,11 @@
}
// 打开弹框
async function open({ mode, row } = {}) {
async function open ({ mode, row } = {}) {
   dialogMode.value = mode || 'add'
   visible.value = true
   await nextTick(() => {
      initMap()
   })
   await nextTick()
   initMap()
   if (dialogMode.value === 'add') {
      formData.value = initForm()
   } else {
@@ -127,16 +158,5 @@
defineExpose({ open })
</script>
<style scoped lang="scss">
.bodyBox {
   display: flex;
   .rightInfo {
      width: 50%;
      height: 500px;
   }
   .leftMap {
      width: 50%;
      height: 500px;
   }
}
</style>
<style scoped lang="scss"></style>