无人机管理后台前端(已迁走)
张含笑
2025-06-11 876dabc17c09c7c03d05f1f749d5be0a4c6eab99
src/views/dataCenter/dataCenter.vue
@@ -1,40 +1,71 @@
<template>
  <div class="dataCenter-table">
    <searchData></searchData>
    <searchData @search="searchClick"></searchData>
    <!-- 表格部分 -->
    <div class="dataTable">
      <el-table
        v-loading="loading"
        element-loading-text="加载中"
        stripe
        :data="tableData"
        class="custom-header"
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55" />
        <el-table-column label="序号" type="index" width="60" />
        <el-table-column prop="address" label="所属区域" />
        <el-table-column property="nest" label="所属机巢" />
        <el-table-column property="taskname" label="任务名称" />
        <el-table-column prop="filename" label="文件名称" />
        <el-table-column property="img" label="缩图" width="120">
        <el-table-column label="序号" type="index" width="60">
               <template #default="{ $index }">
                  {{ ($index + 1 + (jobListParams.current - 1) * jobListParams.size).toString().padStart(2, '0') }}
               </template>
            </el-table-column>
        <el-table-column prop="regionName" label="所属区域" />
        <el-table-column property="nestName" label="所属机巢" />
        <el-table-column property="jobName" label="任务名称" show-overflow-tooltip />
        <el-table-column prop="nickName" label="文件名称" show-overflow-tooltip />
        <el-table-column property="link" label="缩图" width="120">
          <template #default="scope">
            <img
              class="quanjing"
              @click="clickpanorama(scope.row)"
              v-if="scope.row.fileformat === '全景'"
              :src="scope.row.link"
              alt=""
            />
            <img
              v-else-if="scope.row.fileformat === '视频'"
              :src="convertVideoUrlToThumbnail(scope.row.link)"
              alt=""
              class="imageBox"
              @click="enterFullScreen(scope.row)"
            />
            <el-image
              v-else
              :src="scope.row.img"
              :preview-src-list="[scope.row.img]"
              :preview-src-list="[scope.row.link]"
              fit="cover"
              preview-teleported
            />
          </template>
        </el-table-column>
        <el-table-column prop="timer" label="任务时间" />
        <el-table-column property="fileclass" label="文件类别" />
        <el-table-column property="fileformat" label="文件格式" />
        <el-table-column prop="jobTime" label="任务时间" />
        <el-table-column property="photoType" label="文件类别">
          <template #default="scope">
            <span>{{photoTypeMap[scope.row.photoType] }}</span>
          </template>
        </el-table-column>
        <el-table-column property="resultType" label="文件格式">
          <template #default="{ row }">
            <span>{{ resultTypeMap[row.resultType]  }}</span>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="150" align="center">
          <template #default="scope">
            <span class="look" @click="lookDetail(scope.row)">查看</span>
            <span class="delete" @click="deleteDetail()" v-if="scope.row.fileformat !== 'AI识别'"
              >删除</span
            >
            <span class="location" v-if="scope.row.fileformat !== '视频'">定位</span>
            <span class="location" @click="positionDetail()" v-if="scope.row.fileformat !== '视频'"
              >定位</span
            >
          </template>
        </el-table-column>
      </el-table>
@@ -47,7 +78,7 @@
        :page-sizes="[10, 20, 30, 40]"
        background
        layout="total, sizes, prev, pager, next, jumper"
        :total="400"
        :total="total"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      />
@@ -61,7 +92,7 @@
        </div>
      </template>
      <div class="detailContainer">
        <div class="leftImg"><img :src="dialogDetailList.img" alt="" /></div>
        <div class="leftImg"><img :src="dialogDetailList.link" alt="" /></div>
        <div class="rightDetail">
          <div class="title">
            <div class="inputEdit">
@@ -86,102 +117,150 @@
              </div>
            </div>
          </div>
          <div>任务名称:{{ dialogDetailList?.taskname }}</div>
          <div>所属区域:{{ dialogDetailList?.address }}</div>
          <div>拍摄机巢:{{ dialogDetailList?.nest }}</div>
          <div>照片位置:{{}}</div>
          <div>任务时间:{{ dialogDetailList?.date }}</div>
          <div>任务名称:{{ dialogDetailList?.jobName }}</div>
          <div>所属区域:{{ dialogDetailList?.regionName }}</div>
          <div>拍摄机巢:{{ dialogDetailList?.nickName }}</div>
          <div>照片位置:{{dialogDetailList?.longitude}},{{dialogDetailList?.latitude}}</div>
          <div>任务时间:{{ dialogDetailList?.executeTime }}</div>
          <div>拍摄时间:{{ dialogDetailList?.date }}</div>
          <div>文件类型:{{ dialogDetailList?.fileclass }}</div>
          <div>文件格式:{{ dialogDetailList?.fileformat }}</div>
          <div>照片文件大小:2M</div>
          <div>文件类型:{{photoTypeMap[dialogDetailList?.photoType]  }}</div>
          <div>文件格式:{{ resultTypeMap[dialogDetailList?.resultType] }}</div>
          <div>照片文件大小:{{dialogDetailList?.attachSize}}</div>
        </div>
      </div>
    </el-dialog>
    <!-- 全景预览 -->
    <PanoramaPopup
      v-model:panoramaParamsShow="panoramaParamsShow"
      v-model:panoramaParamsUrl="panoramaParamsUrl"
    ></PanoramaPopup>
    <!-- 视频预览 -->
    <el-dialog
      :title="currentVideoTitle"
      modal-class="videoDialog"
      append-to-body
      width="54%"
      v-model="VideoShow"
      :close-on-click-modal="false"
      :destroy-on-close="true"
      @close="currentVideoIndex = -1"
    >
      <div class="video-container">
        <video
          style="width: 100%"
          class="videoBox"
          ref="videoRefs"
          controls
          autoplay
          :src="currentVideoUrl"
        ></video>
      </div>
    </el-dialog>
    <!-- 地图弹框 -->
    <dataCenterMap v-model:show="dataCenterMapVisible"></dataCenterMap>
  </div>
</template>
<script setup>
import dataCenterMap from '@/views/dataCenter/components/dataCenterMap.vue';
import PanoramaPopup from '@/components/PanoramaPopup/PanoramaPopup.vue'; //全景
import { ElMessage, ElMessageBox } from 'element-plus';
import searchData from '@/views/dataCenter/components/searchData.vue';
import fy1 from '@/assets/images/workbench/fy1.png';
import fy1 from '@/assets/images/dataCenter/1.jpeg';
import { getaiImagesPageAPI, getAttachInfoAPI } from '@/api/dataCenter/dataCenter';
import { getShowImg, getSmallImg } from '@/utils/util';
import { onMounted } from 'vue';
import dayjs from 'dayjs';
function convertVideoUrlToThumbnail(videoUrl) {
  // 检查是否是有效的视频URL
  if (!videoUrl || typeof videoUrl !== 'string') {
    return videoUrl;
  }
  // 替换文件扩展名
  const thumbnailUrl = videoUrl.replace(/\.mp4$/, '_small.jpg');
  return thumbnailUrl;
}
const resultTypeMap = {
  0: '照片',
  1: '视频',
  2: 'AI识别',
  3: '全景',
  4:'正射'
};
const photoTypeMap ={
  visible:'可见光',
  ir:'红外'
}
const loading = ref(true);
const total = ref(0);
const startTime = dayjs().subtract(6, 'day').startOf('day')
const endTime = dayjs().endOf('day')
const timeRange = [startTime.format('YYYY-MM-DD HH:mm:ss'), endTime.format('YYYY-MM-DD HH:mm:ss')]
console.log('11',timeRange);
const jobListParams = reactive({
  current: 1,
  size: 10,
  searchParams: {},
  searchParams: {startTime:timeRange[0],endTime:timeRange[1]},
});
const tableData = [
  {
    address: '南昌市,西湖区',
    nest: '空间大厦',
    date: '2016-05-04',
    taskname: '测试任务',
    filename: 'ABD2025053054654',
    img: fy1,
    timer: '2025-05-26 10:25',
    fileclass: '可见光',
    fileformat: '照片',
  },
  {
    address: '南昌市,西湖区',
    nest: '空间大厦',
    date: '2016-05-04',
    taskname: '测试任务',
    filename: '1111',
    img: fy1,
    timer: '2025-05-26 10:25',
    fileclass: '可见光',
    fileformat: '视频',
  },
  {
    address: '南昌市,西湖区',
    nest: '空间大厦',
    date: '2016-05-04',
    taskname: '测试任务',
    filename: '2222',
    img: fy1,
    timer: '2025-05-26 10:25',
    fileclass: '可见光',
    fileformat: 'AI识别',
  },
  {
    address: '南昌市,西湖区',
    nest: '空间大厦',
    date: '2016-05-04',
    taskname: '测试任务',
    filename: '333',
    img: fy1,
    timer: '2025-05-26 10:25',
    fileclass: '可见光',
    fileformat: '全景',
  },
  {
    address: '南昌市,西湖区',
    nest: '空间大厦',
    date: '2016-05-04',
    taskname: '测试任务',
    filename: '44',
    img: fy1,
    timer: '2025-05-26 10:25',
    fileclass: '可见光',
    fileformat: '正射',
  },
];
const handleSizeChange = () => {};
const handleCurrentChange = () => {};
const tableData = ref([]);
// 获取列表数据
const getaiImagesPage = () => {
  getaiImagesPageAPI({
    current: jobListParams.current,
    size: jobListParams.size,
    ...jobListParams.searchParams,
  }).then(res => {
    loading.value = true;
    total.value = res.data.data.total;
    tableData.value = res.data.data.records.map(i => ({
      ...i,
      checked: false,
      url: i.domainUrl,
      smallUrl: getSmallImg(i.domainUrl),
      showUrl: getShowImg(i.domainUrl),
      file_name: i.name.split('/').pop(),
    }));
    console.log('res', tableData.value);
    loading.value = false;
  });
};
// 查询
const searchClick = params => {
  jobListParams.current = 1;
  jobListParams.size = 10;
  jobListParams.searchParams = params;
  console.log('jobListParams', jobListParams);
  getaiImagesPage();
};
const handleSizeChange = val => {
  jobListParams.size = val;
  getaiImagesPage();
};
const handleCurrentChange = val => {
  jobListParams.current = val;
  getaiImagesPage();
};
// 多选
const selectedRows = ref([]);
const handleSelectionChange = val => {
  // console.log('多选',val);
};
// 弹框
// 查看弹框
const dialogVisible = ref(false);
const dialogDetailList = ref(null);
const lookDetail = val => {
  dialogDetailList.value = val;
  // console.log('弹框', dialogDetailList.value);
  // dialogDetailList.value = val;
getAttachInfoAPI(val.id).then(res=>{
dialogDetailList.value = res.data.data
  console.log('red',res.data.data);
})
  dialogVisible.value = true;
    console.log('弹框', val.id);
};
// 删除
const deleteDetail = () => {
@@ -193,9 +272,36 @@
};
// 编辑文件名
const editTitle = val => {
  console.log('val', val);
  // console.log('val', val);
  val.checkedinput = !val.checkedinput;
};
// 全景预览
const panoramaParamsShow = ref(false);
const panoramaParamsUrl = ref(null);
const clickpanorama = val => {
  panoramaParamsShow.value = true;
  panoramaParamsUrl.value = val.img;
  // console.log('全景', val);
};
// 视频
const currentVideoTitle = ref('');
const VideoShow = ref(false);
const currentVideoUrl = ref(null);
const enterFullScreen = val => {
  currentVideoTitle.value = val.filename;
  VideoShow.value = true;
  currentVideoUrl.value = val.img;
  console.log('视频', val);
};
// 地图弹框
const dataCenterMapVisible = ref(false);
const positionDetail = () => {
  console.log('地图');
  dataCenterMapVisible.value = true;
};
onMounted(() => {
  getaiImagesPage();
});
</script>
<style scoped lang="scss">
@@ -226,6 +332,28 @@
    justify-content: end;
    margin-top: 20px;
  }
  .quanjing,
  .el-image,
  .imageBox {
    cursor: pointer;
    width: 76px;
    height: 72px;
  }
  .videoDialog :deep(.el-dialog) {
    height: 600px;
    width: 54%;
  }
  .video-container {
    width: 100%;
    aspect-ratio: 16/9; /* 按视频比例设置(如16:9) */
    overflow: hidden; /* 隐藏溢出部分 */
  }
  .videoBox {
    width: 100%;
    height: 100%;
    object-fit: contain; /* 保持比例完整显示 */
    display: block;
  }
}
:deep(.custom-header th.el-table__cell) {
  color: rgba(0, 0, 0, 0.85);