吉安感知网项目-前端
shuishen
2026-02-03 89380e6260a75d1d3b94de687ebcc2f50d50659d
applications/drone-command/src/views/recordManage/historyTracks/index.vue
@@ -39,12 +39,22 @@
      </el-form>
      <div class="command-table-toolbar">
         <el-button :icon="Download" color="#1A2652" type="primary" @click="exportFile" :loading="exportLoading">导出</el-button>
         <el-button
            :icon="Download"
            color="#1A2652"
            type="primary"
            @click="exportFile"
            :loading="exportLoading"
            :disabled="!selectionList.length"
         >
            导出
         </el-button>
      </div>
      <div class="command-table-container" v-loading="loading" element-loading-background="rgba(5, 5, 15, 0.6)">
         <div class="command-table-content command-table-content-bg">
            <el-table class="command-table" :data="list">
            <el-table class="command-table" :data="list" ref="tableRef" @selection-change="handleSelectionChange">
               <el-table-column type="selection" width="48" />
               <el-table-column type="index" show-overflow-tooltip width="64" label="序号" />
               <el-table-column prop="droneName" show-overflow-tooltip width="140" label="无人机名称" />
               <el-table-column prop="serialNo" show-overflow-tooltip label="无人机序列号" />
@@ -82,9 +92,11 @@
<script setup>
import { Search, RefreshRight, Download } from '@element-plus/icons-vue'
import { onMounted, ref } from 'vue'
import { onMounted, ref, nextTick } from 'vue'
import { exportFwDroneFlightRecordApi, fwDroneFlightRecordPageApi } from './fwDroneFlightRecord'
import { blobDownload, dateRangeFormat } from '@ztzf/utils'
import { saveOperationLog } from '@ztzf/apis'
import { useRoute } from 'vue-router'
import TrajectoryDiaLog from '@/views/recordManage/historyTracks/TrajectoryDiaLog.vue'
const initSearchParams = () => ({
@@ -97,10 +109,13 @@
const total = ref(0) // 总条数
const loading = ref(true) // 列表加载中
const list = ref([]) // 列表数据
const tableRef = ref(null)
const selectionList = ref([])
const queryParamsRef = ref(null) // 查询表单实例
const dateRange = ref([])
const exportLoading = ref(false)
const dialogRef = ref(null) // 弹框实例
const route = useRoute()
// 获取列表
async function getList() {
@@ -111,6 +126,9 @@
      const res = await fwDroneFlightRecordPageApi(params)
      list.value = res?.data?.data?.records ?? []
      total.value = res?.data?.data?.total ?? 0
      selectionList.value = []
      await nextTick()
      tableRef.value?.clearSelection()
   } finally {
      loading.value = false
   }
@@ -141,9 +159,20 @@
function exportFile() {
   const range = dateRangeFormat(dateRange.value)
   const ids = selectionList.value.map(item => item.id).filter(Boolean)
   exportLoading.value = true
   exportFwDroneFlightRecordApi({ ...searchParams.value, start_time: range[0], end_time: range[1] })
   exportFwDroneFlightRecordApi({
      ...searchParams.value,
      start_time: range?.[0],
      end_time: range?.[1],
      ids: ids.join(','),
   })
      .then(res => {
         saveOperationLog({
            requestUri: route.path,
            title: `${route.name || '历史轨迹'}-导出`,
            type: 1,
         })
         blobDownload(res)
      })
      .finally(() => {
@@ -151,6 +180,10 @@
      })
}
function handleSelectionChange(selection) {
   selectionList.value = selection || []
}
function handleView(row) {
   dialogRef.value?.open({ mode: 'view', row: { ...row } })
}