无人机管理后台前端(已迁走)
shuishen
2025-06-27 3d4e600f140bfcebba615bea9cf1ec7530e3b1c7
feat:部分页面样式调整
4 files modified
926 ■■■■ changed files
src/components/basic-container/main.vue 18 ●●●●● patch | view | raw | blame | history
src/components/basic-main-content/main.vue 2 ●●● patch | view | raw | blame | history
src/styles/base.scss 4 ●●●● patch | view | raw | blame | history
src/views/dataCenter/dataCenter.vue 902 ●●●● patch | view | raw | blame | history
src/components/basic-container/main.vue
@@ -2,7 +2,7 @@
 * @Author       : yuan
 * @Date         : 2025-06-14 15:19:16
 * @LastEditors  : yuan
 * @LastEditTime : 2025-06-27 14:19:22
 * @LastEditTime : 2025-06-27 14:34:02
 * @FilePath     : \src\components\basic-container\main.vue
 * @Description  : 
 * Copyright 2025 OBKoro1, All Rights Reserved. 
@@ -45,27 +45,21 @@
<style lang="scss" scoped>
.basic-container {
  padding: 10px;
  height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 10px;
  // box-sizing: border-box;
  // height: 100%;
  .basic-container__card {
    height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100% !important;
    overflow: hidden;
    ::v-deep(.el-card__body) {
      height: 0 !important;
      flex: 1 !important;
    .el-card__body {
      display: flex;
      flex-direction: column;
      height: 100% !important;
      overflow: hidden;
      box-sizing: border-box;
src/components/basic-main-content/main.vue
@@ -2,7 +2,7 @@
 * @Author       : yuan
 * @Date         : 2025-06-14 15:19:16
 * @LastEditors  : yuan
 * @LastEditTime : 2025-06-25 16:37:40
 * @LastEditTime : 2025-06-27 14:33:15
 * @FilePath     : \src\components\basic-main-content\main.vue
 * @Description  : 
 * Copyright 2025 OBKoro1, All Rights Reserved. 
src/styles/base.scss
@@ -62,6 +62,10 @@
    margin: 10px;
}
.manage-m-t-0 {
    margin-top: 0px;
}
.manage-m-t-10 {
    margin-top: 10px;
}
src/views/dataCenter/dataCenter.vue
@@ -1,288 +1,203 @@
<template>
<basic-container>
  <div class="dataCenter-table">
    <searchData
      @search="searchClick"
      @downFun="downloadFile"
      @allDownFun="aLLDownloadFile"
    ></searchData>
    <!-- 表格部分 -->
    <div class="dataTable">
      <el-table
        v-loading="loadings"
        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">
          <template #default="{ $index }">
            {{
              ($index + 1 + (jobListParams.current - 1) * jobListParams.size)
                .toString()
                .padStart(2, '0')
            }}
          </template>
        </el-table-column>
        <el-table-column prop="regionName" label="所属区域" v-if="!isDistrictLevel">
          <template #default="scope">
            <span>{{ processAddress(scope.row.regionName) }}</span>
          </template>
        </el-table-column>
        <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?.resultType === 5"
              :src="scope.row?.smallUrl"
              alt=""
            />
            <img
              v-else-if="scope.row?.resultType === 1"
              :src="convertVideoUrlToThumbnail(scope.row?.link)"
              alt=""
              class="imageBox"
              @click="enterFullScreen(scope.row)"
            />
            <!-- 正射 -->
            <img
              v-else-if="scope.row?.resultType === 4"
              :src="getzsSmallImg(scope.row?.link)"
              alt=""
              class="imageBox"
            />
            <el-image
              v-else
              :src="scope.row?.smallUrl"
              :preview-src-list="[scope.row?.showUrl]"
              fit="cover"
              preview-teleported
            />
          </template>
        </el-table-column>
        <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(scope.row)" v-if="scope.row.resultType !== 2"
            >删除</span
            >
  <div
    class="manage-m-all-10 manage-m-t-0 manage-p-all-20 manage-h-0 manage-flex-1 manage-flex manage-f-d-c manage-b-r-5 manage-b-c-w">
    <div class="dataCenter-table">
      <searchData @search="searchClick" @downFun="downloadFile" @allDownFun="aLLDownloadFile"></searchData>
      <!-- 表格部分 -->
      <div class="dataTable">
        <el-table v-loading="loadings" 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">
            <template #default="{ $index }">
              {{
                ($index + 1 + (jobListParams.current - 1) * jobListParams.size)
                  .toString()
                  .padStart(2, '0')
              }}
            </template>
          </el-table-column>
          <el-table-column prop="regionName" label="所属区域" v-if="!isDistrictLevel">
            <template #default="scope">
              <span>{{ processAddress(scope.row.regionName) }}</span>
            </template>
          </el-table-column>
          <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?.resultType === 5"
                :src="scope.row?.smallUrl" alt="" />
              <img v-else-if="scope.row?.resultType === 1" :src="convertVideoUrlToThumbnail(scope.row?.link)" alt=""
                class="imageBox" @click="enterFullScreen(scope.row)" />
              <!-- 正射 -->
              <img v-else-if="scope.row?.resultType === 4" :src="getzsSmallImg(scope.row?.link)" alt=""
                class="imageBox" />
              <el-image v-else :src="scope.row?.smallUrl" :preview-src-list="[scope.row?.showUrl]" fit="cover"
                preview-teleported />
            </template>
          </el-table-column>
          <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(scope.row)" v-if="scope.row.resultType !== 2">删除</span>
            <span
              class="location"
              @click="positionDetail(scope.row)"
              v-if="shouldShowLocation(scope.row)"
            >定位</span
            >
          </template>
        </el-table-column>
      </el-table>
    </div>
    <!-- 分页 -->
    <div class="pagination">
      <el-pagination
        v-model:current-page="jobListParams.current"
        v-model:page-size="jobListParams.size"
        :page-sizes="[10, 20, 30, 40]"
        background
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      />
    </div>
    <!-- 查看弹框 -->
    <el-dialog v-model="dialogVisible" width="60%" append-to-body @close="dialogClose">
      <template #header="{ titleId, titleClass }">
        <div class="my-header">
          <h4 :id="titleId" :class="titleClass">{{ detailTitle }}</h4>
        </div>
      </template>
      <div class="detailContainer">
        <div class="leftImg">
          <!-- <img
              <span class="location" @click="positionDetail(scope.row)" v-if="shouldShowLocation(scope.row)">定位</span>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <!-- 分页 -->
      <div class="pagination">
        <el-pagination v-model:current-page="jobListParams.current" v-model:page-size="jobListParams.size"
          :page-sizes="[10, 20, 30, 40]" background layout="total, sizes, prev, pager, next, jumper" :total="total"
          @size-change="handleSizeChange" @current-change="handleCurrentChange" />
      </div>
      <!-- 查看弹框 -->
      <el-dialog v-model="dialogVisible" width="60%" append-to-body @close="dialogClose">
        <template #header="{ titleId, titleClass }">
          <div class="my-header">
            <h4 :id="titleId" :class="titleClass">{{ detailTitle }}</h4>
          </div>
        </template>
        <div class="detailContainer">
          <div class="leftImg">
            <!-- <img
            v-if="dialogDetailList?.resultType === 1"
            :src="convertVideoUrlToThumbnail(dialogDetailList?.link)"
            alt=""
            class="imageBox"
          /> -->
          <!-- 视频 -->
          <video
            v-if="dialogDetailList?.resultType === 1"
            style="width: 100%"
            class="imageBox"
            ref="videoRefs"
            controls
            autoplay
            :src="dialogDetailList.link"
          ></video>
          <!-- 全景 -->
          <!-- <img
            <!-- 视频 -->
            <video v-if="dialogDetailList?.resultType === 1" style="width: 100%" class="imageBox" ref="videoRefs"
              controls autoplay :src="dialogDetailList.link"></video>
            <!-- 全景 -->
            <!-- <img
             class="quanjing"
             @click="clickpanorama(dialogDetailList)"
             v-else-if="dialogDetailList?.resultType === 5"
             :src="dialogDetailList?.resultType?.smallUrl"
             alt=""
           /> -->
          <!-- 地图 -->
          <div
            v-else-if="dialogDetailList?.resultType === 4"
            id="detaildataCenterMap"
            class="ztzf-cesium"
          ></div>
          <img v-else :src="getSmallImg(dialogDetailList?.link)" alt="" />
        </div>
        <div class="rightDetail">
          <div class="title">
            <div class="inputEdit">
              文件名称:<span class="fileTitle" v-if="!dialogDetailList?.checkedinput">{{
                dialogDetailList?.nickName ? dialogDetailList?.nickName : '--'
              }}</span>
              <el-input
                v-else
                v-model="dialogDetailList.nickName"
                @keyup.enter="saveTitle()"
                class="title-input"
                clearable
              />
            </div>
            <div class="editname">
              <span v-if="!dialogDetailList?.checkedinput" @click="editTitle(dialogDetailList)"
              ><el-icon><Edit /></el-icon
              ></span>
              <div v-else class="suffixBoxEdit">
                <div class="editText" @click="submitEditSuffix(dialogDetailList)">✔</div>
                <div class="editText" @click="cancelEditSuffix(dialogDetailList)">✖</div>
            <!-- 地图 -->
            <div v-else-if="dialogDetailList?.resultType === 4" id="detaildataCenterMap" class="ztzf-cesium"></div>
            <img v-else :src="getSmallImg(dialogDetailList?.link)" alt="" />
          </div>
          <div class="rightDetail">
            <div class="title">
              <div class="inputEdit">
                文件名称:<span class="fileTitle" v-if="!dialogDetailList?.checkedinput">{{
                  dialogDetailList?.nickName ? dialogDetailList?.nickName : '--'
                }}</span>
                <el-input v-else v-model="dialogDetailList.nickName" @keyup.enter="saveTitle()" class="title-input"
                  clearable />
              </div>
              <div class="editname">
                <span v-if="!dialogDetailList?.checkedinput" @click="editTitle(dialogDetailList)"><el-icon>
                    <Edit />
                  </el-icon></span>
                <div v-else class="suffixBoxEdit">
                  <div class="editText" @click="submitEditSuffix(dialogDetailList)">✔</div>
                  <div class="editText" @click="cancelEditSuffix(dialogDetailList)">✖</div>
                </div>
              </div>
            </div>
          </div>
          <div>任务名称:{{ dialogDetailList?.jobName ? dialogDetailList?.jobName : '--' }}</div>
          <div>
            所属区域:{{ dialogDetailList?.regionName ? dialogDetailList?.regionName : '--' }}
          </div>
          <div>拍摄机巢:{{ dialogDetailList?.nestName ? dialogDetailList?.nestName : '--' }}</div>
          <div>
            照片位置:{{ _.round(dialogDetailList?.longitude, 3) }},{{
              _.round(dialogDetailList?.latitude, 3)
            }}
          </div>
          <div>任务时间:{{ dialogDetailList?.jobTime ? dialogDetailList?.jobTime : '--' }}</div>
          <div>
            拍摄时间:{{ dialogDetailList?.createTime ? dialogDetailList?.createTime : '--' }}
          </div>
          <div>
            文件类型:{{
              photoTypeMap[dialogDetailList?.photoType]
                ? photoTypeMap[dialogDetailList?.photoType]
                : '--'
            }}
          </div>
          <div>
            文件格式:{{
              resultTypeMap[dialogDetailList?.resultType]
                ? resultTypeMap[dialogDetailList?.resultType]
                : '--'
            }}
          </div>
          <div>
            照片文件大小:{{
              bytesToMB(dialogDetailList?.attachSize)
                ? bytesToMB(dialogDetailList?.attachSize)
                : '--'
            }}
          </div>
          <div>
            <el-button
              type="success"
              plain
              icon="el-icon-download"
              @click="detailDownLoad(dialogDetailList)"
            >下载</el-button
            >
            <div>任务名称:{{ dialogDetailList?.jobName ? dialogDetailList?.jobName : '--' }}</div>
            <div>
              所属区域:{{ dialogDetailList?.regionName ? dialogDetailList?.regionName : '--' }}
            </div>
            <div>拍摄机巢:{{ dialogDetailList?.nestName ? dialogDetailList?.nestName : '--' }}</div>
            <div>
              照片位置:{{ _.round(dialogDetailList?.longitude, 3) }},{{
                _.round(dialogDetailList?.latitude, 3)
              }}
            </div>
            <div>任务时间:{{ dialogDetailList?.jobTime ? dialogDetailList?.jobTime : '--' }}</div>
            <div>
              拍摄时间:{{ dialogDetailList?.createTime ? dialogDetailList?.createTime : '--' }}
            </div>
            <div>
              文件类型:{{
                photoTypeMap[dialogDetailList?.photoType]
                  ? photoTypeMap[dialogDetailList?.photoType]
                  : '--'
              }}
            </div>
            <div>
              文件格式:{{
                resultTypeMap[dialogDetailList?.resultType]
                  ? resultTypeMap[dialogDetailList?.resultType]
                  : '--'
              }}
            </div>
            <div>
              照片文件大小:{{
                bytesToMB(dialogDetailList?.attachSize)
                  ? bytesToMB(dialogDetailList?.attachSize)
                  : '--'
              }}
            </div>
            <div>
              <el-button type="success" plain icon="el-icon-download"
                @click="detailDownLoad(dialogDetailList)">下载</el-button>
            </div>
          </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
      ref="mapComponent"
      v-model:show="dataCenterMapVisible"
      :jobId="jobId"
      @lookDetail="lookDetail"
      :dotData="mapList"
    ></dataCenterMap>
      </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 ref="mapComponent" v-model:show="dataCenterMapVisible" :jobId="jobId" @lookDetail="lookDetail"
        :dotData="mapList"></dataCenterMap>
    </div>
  </div>
    </basic-container>
</template>
<script setup>
import { useStore } from 'vuex';
import { PublicCesium } from '@/utils/cesium/publicCesium';
import { Cartesian3 } from 'cesium';
import * as Cesium from 'cesium';
import EventPopUpBox from '@/hooks/components/EventPopUpBox.vue';
import { nextTick, render } from 'vue';
import defaultIcon from '@/assets/images/dataCenter/datamap/eventCompleted.png';
const userInfo = computed(() => store.getters.userInfo);
const isShow = defineModel('show');
const viewerRef = shallowRef(null);
let viewer = null;
import { useStore } from 'vuex'
import { PublicCesium } from '@/utils/cesium/publicCesium'
import { Cartesian3 } from 'cesium'
import * as Cesium from 'cesium'
import EventPopUpBox from '@/hooks/components/EventPopUpBox.vue'
import { nextTick, render } from 'vue'
import defaultIcon from '@/assets/images/dataCenter/datamap/eventCompleted.png'
const userInfo = computed(() => store.getters.userInfo)
const isShow = defineModel('show')
const viewerRef = shallowRef(null)
let viewer = null
const viewInstance = shallowRef(null);
const store = useStore();
const currentAreaPosition = ref({ height: 1987280, latitude: 27.636112, longitude: 115.732975 });
let handler = null;
const viewInstance = shallowRef(null)
const store = useStore()
const currentAreaPosition = ref({ height: 1987280, latitude: 27.636112, longitude: 115.732975 })
let handler = null
import EventBus from '@/utils/eventBus';
import dataCenterMap from '@/views/dataCenter/components/dataCenterMap.vue';
import PanoramaPopup from '@/components/PanoramaPopup/PanoramaPopup.vue'; //全景
import { ElMessage, ElMessageBox, ElLoading } from 'element-plus';
import searchData from '@/views/dataCenter/components/searchData.vue';
import fy1 from '@/assets/images/dataCenter/1.jpeg';
import _ from 'lodash';
import EventBus from '@/utils/eventBus'
import dataCenterMap from '@/views/dataCenter/components/dataCenterMap.vue'
import PanoramaPopup from '@/components/PanoramaPopup/PanoramaPopup.vue' //全景
import { ElMessage, ElMessageBox, ElLoading } from 'element-plus'
import searchData from '@/views/dataCenter/components/searchData.vue'
import fy1 from '@/assets/images/dataCenter/1.jpeg'
import _ from 'lodash'
import {
  getaiImagesPageAPI,
  getAttachInfoAPI,
@@ -290,24 +205,24 @@
  downloadApi,
  updataTitleApi,
  getOrthoimageInfo,
} from '@/api/dataCenter/dataCenter';
import { getShowImg, getSmallImg, getzsSmallImg } from '@/utils/util';
import { onMounted, watch } from 'vue';
import dayjs from 'dayjs';
} from '@/api/dataCenter/dataCenter'
import { getShowImg, getSmallImg, getzsSmallImg } from '@/utils/util'
import { onMounted, watch } from 'vue'
import dayjs from 'dayjs'
function bytesToMB(bytes, decimalPlaces = 2) {
  if (typeof bytes !== 'number' || bytes < 0) return '无效输入';
  return (bytes / 1048576).toFixed(decimalPlaces) + ' MB';
function bytesToMB (bytes, decimalPlaces = 2) {
  if (typeof bytes !== 'number' || bytes < 0) return '无效输入'
  return (bytes / 1048576).toFixed(decimalPlaces) + ' MB'
}
// 视频一帧
function convertVideoUrlToThumbnail(videoUrl) {
function convertVideoUrlToThumbnail (videoUrl) {
  // 检查是否是有效的视频URL
  if (!videoUrl || typeof videoUrl !== 'string') {
    return videoUrl;
    return videoUrl
  }
  // 替换文件扩展名
  const thumbnailUrl = videoUrl.replace(/\.mp4$/, '_small.jpg');
  return thumbnailUrl;
  const thumbnailUrl = videoUrl.replace(/\.mp4$/, '_small.jpg')
  return thumbnailUrl
}
const resultTypeMap = {
  0: '照片',
@@ -315,84 +230,84 @@
  2: 'AI识别',
  5: '全景',
  4: '正射',
};
}
const photoTypeMap = {
  visible: '可见光',
  ir: '红外',
};
}
// 判断省市区
const areaCode = userInfo.value?.detail?.areaCode || '';
const areaCode = userInfo.value?.detail?.areaCode || ''
// 判断账号级别
const isProvinceLevel = computed(() => areaCode.endsWith('00000000')); // 省级:后8位为0
const isCityLevel = computed(() => !isProvinceLevel.value && areaCode.endsWith('000000')); // 市级:后6位为0
const isDistrictLevel = computed(() => !isProvinceLevel.value && !isCityLevel.value); // 区县级
const isProvinceLevel = computed(() => areaCode.endsWith('00000000')) // 省级:后8位为0
const isCityLevel = computed(() => !isProvinceLevel.value && areaCode.endsWith('000000')) // 市级:后6位为0
const isDistrictLevel = computed(() => !isProvinceLevel.value && !isCityLevel.value) // 区县级
// 处理区域名称的函数
function processAddress(str) {
  if (!str) return '';
  const parts = str.split(',');
function processAddress (str) {
  if (!str) return ''
  const parts = str.split(',')
  // 省级账号:显示市和区(去除省级)
  if (isProvinceLevel.value) {
    return parts.filter(part => !part.endsWith('省')).join(',');
    return parts.filter(part => !part.endsWith('省')).join(',')
  }
  // 市级账号:只显示区(去除省和市)
  if (isCityLevel.value) {
    return parts.filter(part => !part.endsWith('省') && !part.endsWith('市')).join(',');
    return parts.filter(part => !part.endsWith('省') && !part.endsWith('市')).join(',')
  }
  // 区县级账号:不显示区域信息(在模板中已隐藏该列)
  return '';
  return ''
}
const showRegionColumn = computed(() => {
  // 是否显示列
  return tableData.value.some(row => {
    const processed = processAddress(row.regionName || '');
    return processed !== '';
  });
});
const loadings = ref(true);
let loading;
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')];
    const processed = processAddress(row.regionName || '')
    return processed !== ''
  })
})
const loadings = ref(true)
let loading
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')]
// 全景预览
const panoramaParamsShow = ref(false);
const panoramaParamsUrl = ref(null);
const panoramaParamsShow = ref(false)
const panoramaParamsUrl = ref(null)
const clickpanorama = val => {
  panoramaParamsShow.value = true;
  panoramaParamsUrl.value = val.link;
};
  panoramaParamsShow.value = true
  panoramaParamsUrl.value = val.link
}
// 视频
const currentVideoTitle = ref('');
const VideoShow = ref(false);
const currentVideoUrl = ref(null);
const currentVideoTitle = ref('')
const VideoShow = ref(false)
const currentVideoUrl = ref(null)
const enterFullScreen = val => {
  currentVideoTitle.value = val?.nickName;
  currentVideoUrl.value = val?.link;
  VideoShow.value = true;
};
  currentVideoTitle.value = val?.nickName
  currentVideoUrl.value = val?.link
  VideoShow.value = true
}
const jobListParams = reactive({
  current: 1,
  size: 10,
  orderByCreateTime: true,
  searchParams: { startTime: timeRange[0], endTime: timeRange[1] },
});
const tableData = ref([]);
})
const tableData = ref([])
// 获取列表数据
const getaiImagesPage = () => {
  loadings.value = true;
  loadings.value = true
  const params = {
    orderByCreateTime: jobListParams.orderByCreateTime,
    ...jobListParams.searchParams,
  };
  getaiImagesPageAPI(params, {
    current: jobListParams.current,
    size: jobListParams.size
  }
  getaiImagesPageAPI(params, {
    current: jobListParams.current,
    size: jobListParams.size
  })
    .then(res => {
      total.value = res.data.data.total;
      total.value = res.data.data.total
      tableData.value = res.data.data.records.map(i => ({
        ...i,
        checked: false,
@@ -400,41 +315,41 @@
        smallUrl: getSmallImg(i?.link),
        showUrl: getShowImg(i?.link),
        file_name: i.name.split('/').pop(),
      }));
      }))
    })
    .catch(error => {
      // 可选:这里可以添加错误处理逻辑
      console.error("获取数据失败:", error);
      console.error("获取数据失败:", error)
    })
    .finally(() => {
      loadings.value = false; // 无论成功失败都会执行
    });
};
      loadings.value = false // 无论成功失败都会执行
    })
}
// 查询
const searchClick = params => {
  jobListParams.current = 1;
  jobListParams.size = 10;
  jobListParams.searchParams = params;
  getaiImagesPage();
};
  jobListParams.current = 1
  jobListParams.size = 10
  jobListParams.searchParams = params
  getaiImagesPage()
}
const handleSizeChange = val => {
  jobListParams.size = val;
  getaiImagesPage();
};
  jobListParams.size = val
  getaiImagesPage()
}
const handleCurrentChange = val => {
  jobListParams.current = val;
  getaiImagesPage();
};
  jobListParams.current = val
  getaiImagesPage()
}
// 多选
const selectedRows = ref([]);
const selectedRows = ref([])
const handleSelectionChange = val => {
  // 更新选中状态
  tableData.value.forEach(item => {
    item.checked = val.some(selected => selected.id === item.id);
  });
    item.checked = val.some(selected => selected.id === item.id)
  })
  selectedRows.value = val;
};
  selectedRows.value = val
}
// 删除
const deleteDetail = val => {
  ElMessageBox.confirm('您确定删除吗?', '提示', {
@@ -445,36 +360,36 @@
    .then(() => {
      deleteFileMultipleApi(val.id)
        .then(res => {
          ElMessage.success('删除成功');
          getaiImagesPage();
          ElMessage.success('删除成功')
          getaiImagesPage()
        })
        .catch(error => {
          ElMessage.error('删除失败');
        });
          ElMessage.error('删除失败')
        })
    })
    .catch(() => {});
};
    .catch(() => { })
}
// url下载
function aLinkDownload(url, name) {
  const a = document.createElement('a');
  a.style.display = 'none';
  a.href = url;
  a.download = name;
  document.body.appendChild(a);
  a.click();
  document.body.removeChild(a);
function aLinkDownload (url, name) {
  const a = document.createElement('a')
  a.style.display = 'none'
  a.href = url
  a.download = name
  document.body.appendChild(a)
  a.click()
  document.body.removeChild(a)
}
const fileDownload = () => {
  const list = selectedRows.value.filter(i => i.checked);
  if (!list?.length) return ElMessage.warning('请选择文件');
     if (list.length === 1) {
        list.forEach((item, index) => {
            const suffix = item.url.split('.').pop()
            aLinkDownload(item.url, item.nickName + '.' + suffix)
        })
    } else {
    loading = ElLoading.service({ background: 'rgba(0, 0, 0, 0.5)', text: '打包中,请稍等...' });
    const fileIds = list.map(i => i.id);
  const list = selectedRows.value.filter(i => i.checked)
  if (!list?.length) return ElMessage.warning('请选择文件')
  if (list.length === 1) {
    list.forEach((item, index) => {
      const suffix = item.url.split('.').pop()
      aLinkDownload(item.url, item.nickName + '.' + suffix)
    })
  } else {
    loading = ElLoading.service({ background: 'rgba(0, 0, 0, 0.5)', text: '打包中,请稍等...' })
    const fileIds = list.map(i => i.id)
    let aaa = {
      areaCode: '',
      attachIds: fileIds,
@@ -486,243 +401,242 @@
      resultType: '',
      startTime: '',
      wayLineJobIds: [],
    };
    }
    downloadApi(aaa).then(res => {
      aLinkDownload(res.data.data, `sjzx-file-pack-${dayjs().format('YYYYMMDDHHmmss')}.zip`);
      loading.close();
    });
      aLinkDownload(res.data.data, `sjzx-file-pack-${dayjs().format('YYYYMMDDHHmmss')}.zip`)
      loading.close()
    })
  }
};
}
// 下载
const downloadFile = () => {
  fileDownload();
};
  fileDownload()
}
const detailDownLoad = val => {
  aLinkDownload(val.link, val?.nickName);
};
  aLinkDownload(val.link, val?.nickName)
}
// 全部下载
const aLLDownloadFile = () => {
  loading = ElLoading.service({ background: 'rgba(0, 0, 0, 0.5)', text: '打包中,请稍等...' });
  loading = ElLoading.service({ background: 'rgba(0, 0, 0, 0.5)', text: '打包中,请稍等...' })
  const params = {
    ...jobListParams.searchParams,
  };
  params.areaCode = '';
  }
  params.areaCode = ''
  downloadApi(params).then(res => {
    aLinkDownload(res.data.data, `sjzx-file-pack-${dayjs().format('YYYYMMDDHHmmss')}.zip`);
    loading.close();
  });
};
    aLinkDownload(res.data.data, `sjzx-file-pack-${dayjs().format('YYYYMMDDHHmmss')}.zip`)
    loading.close()
  })
}
// 地图弹框
const mapComponent = ref(null); // 创建子组件引用
const mapList = ref(null);
const dataCenterMapVisible = ref(false);
const jobId = ref('');
const statusType = ref(null);
const mapComponent = ref(null) // 创建子组件引用
const mapList = ref(null)
const dataCenterMapVisible = ref(false)
const jobId = ref('')
const statusType = ref(null)
const positionDetail = val => {
  jobId.value = val.wayLineJobId;
  mapList.value = val;
  dataCenterMapVisible.value = true;
  jobId.value = val.wayLineJobId
  mapList.value = val
  dataCenterMapVisible.value = true
  // 确保地图组件加载完成
  nextTick(() => {
    if (mapComponent.value) {
      // 调用子组件方法并传递数据
      mapComponent.value.initEntityOrPopup(val);
      mapComponent.value.initEntityOrPopup(val)
    }
  });
};
  })
}
const fileNameedit = ref('');
const fileNameedit = ref('')
// 编辑文件名
const editTitle = val => {
  val.checkedinput = true;
  fileNameedit.value = val?.nickName;
};
  val.checkedinput = true
  fileNameedit.value = val?.nickName
}
// 取消
const cancelEditSuffix = item => {
  item.nickName = fileNameedit.value;
  item.checkedinput = false;
};
  item.nickName = fileNameedit.value
  item.checkedinput = false
}
const submitEditSuffix = item => {
  saveTitle(item);
};
  saveTitle(item)
}
// 通用空值检查函数
const validateNickname = (name, fieldName) => {
  if (!name || name.trim() === '') {
    ElMessage.warning(`${fieldName}不能为空`);
    return false;
    ElMessage.warning(`${fieldName}不能为空`)
    return false
  }
  if (name.length > 50) {
    ElMessage.warning(`${fieldName}不能超过50个字符`);
    return false;
    ElMessage.warning(`${fieldName}不能超过50个字符`)
    return false
  }
  return true;
};
  return true
}
// 保存文件名
const saveTitle = item => {
  const updateparams = {
    id: item.id,
    nickName: `${item.nickName.trim()}`,
  };
  }
  // 验证并提示
  if (!validateNickname(updateparams.nickName, '名称')) return;
  item.checkedinput = false;
  detailTitle.value = item.nickName;
  if (!validateNickname(updateparams.nickName, '名称')) return
  item.checkedinput = false
  detailTitle.value = item.nickName
  updataTitleApi(updateparams)
    .then(res => {
      if (res.status === 200) {
        ElMessage.success('修改成功');
        getaiImagesPage();
        ElMessage.success('修改成功')
        getaiImagesPage()
      } else {
        ElMessage.error(res.data.message || '修改失败');
        ElMessage.error(res.data.message || '修改失败')
      }
    })
    .catch(error => {
      ElMessage.error('请求失败,请稍后重试');
      console.error('API error:', error);
    });
};
      ElMessage.error('请求失败,请稍后重试')
      console.error('API error:', error)
    })
}
// 正射地图
const yxShowBox = ref(false);
const yxShowBox = ref(false)
const removeHandler = () => {
  handler?.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK);
  handler?.destroy();
  handler = null;
};
const isMapInitialized = ref(false); //地图加载
  handler?.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK)
  handler?.destroy()
  handler = null
}
const isMapInitialized = ref(false) //地图加载
const initMap = () => {
  if (viewer || isMapInitialized.value) return;
  if (viewer || isMapInitialized.value) return
  const container = document.getElementById('detaildataCenterMap');
  const container = document.getElementById('detaildataCenterMap')
  if (!container) {
    console.error('地图容器未找到');
    return;
    console.error('地图容器未找到')
    return
  }
  viewInstance.value = new PublicCesium({
    dom: 'detaildataCenterMap',
    flatMode: false,
    terrain: false,
    mapFilter: true,
  });
  viewer = viewInstance.value.getViewer();
  viewerRef.value = viewer;
  })
  viewer = viewInstance.value.getViewer()
  viewerRef.value = viewer
  isMapInitialized.value = true;
  isMapInitialized.value = true
  // console.log('地图初始化完成');
};
}
// 判断是否是正射
function isTifFile(filename) {
  const lastDot = filename.lastIndexOf('.');
  if (lastDot === -1) return false; // 无后缀
  return filename.slice(lastDot + 1).toLowerCase() === 'tif';
function isTifFile (filename) {
  const lastDot = filename.lastIndexOf('.')
  if (lastDot === -1) return false // 无后缀
  return filename.slice(lastDot + 1).toLowerCase() === 'tif'
}
const shouldShowLocation = row => {
  return row.resultType !== 1 && row.resultType !== 4;
};
  return row.resultType !== 1 && row.resultType !== 4
}
// 查看弹框
const dialogVisible = ref(false);
const dialogDetailList = ref(null);
const detailTitle = ref('');
let curCustomImageryProvider = null;
const orthoimageApi = ref('');
const positiongeom = ref('');
const odmToken = ref(null);
const dialogVisible = ref(false)
const dialogDetailList = ref(null)
const detailTitle = ref('')
let curCustomImageryProvider = null
const orthoimageApi = ref('')
const positiongeom = ref('')
const odmToken = ref(null)
const lookDetail = val => {
  if (val.resultType === 4) {
    // 正射
    getOrthoimageInfo(val.wayLineJobId).then(async res => {
      dialogVisible.value = true;
      detailTitle.value = val.nickName;
      dialogDetailList.value = val;
      console.log('3333', detailTitle.value, dialogDetailList.value);
      dialogVisible.value = true
      detailTitle.value = val.nickName
      dialogDetailList.value = val
      console.log('3333', detailTitle.value, dialogDetailList.value)
      await nextTick();
      initMap();
      positiongeom.value = res.data.data.geom;
      orthoimageApi.value = res.data.data.orthoimageApi;
      odmToken.value = res.data.data.odmToken;
      await nextTick()
      initMap()
      positiongeom.value = res.data.data.geom
      orthoimageApi.value = res.data.data.orthoimageApi
      odmToken.value = res.data.data.odmToken
      if (res.data.data != null && isMapInitialized.value === true) {
        curCustomImageryProvider = viewInstance.value.addCustomImageryProviderDataSource(
          new Cesium.UrlTemplateImageryProvider({
            url: `${import.meta.env.VITE_APP_AREA_NAME}/webodm${res.data.data.orthoimageApi}?jwt=${
              res.data.data.odmToken.split(' ')[1]
            }`,
            url: `${import.meta.env.VITE_APP_AREA_NAME}/webodm${res.data.data.orthoimageApi}?jwt=${res.data.data.odmToken.split(' ')[1]
              }`,
            // maximumLevel: 12,
          })
        );
        yxShowBox.value = true;
        )
        yxShowBox.value = true
        // 添加定位
        if (positiongeom.value) {
          // 解析WKT格式的多边形坐标
          const wktString = positiongeom.value;
          const coordinates = parseWKTCoordinates(wktString);
          const wktString = positiongeom.value
          const coordinates = parseWKTCoordinates(wktString)
          if (coordinates.length > 0) {
            // 创建多边形边界
            const positions = coordinates.map(coord =>
              Cesium.Cartesian3.fromDegrees(coord[0], coord[1])
            );
            )
            // 计算多边形的包围球
            const boundingSphere = Cesium.BoundingSphere.fromPoints(positions);
            const viewer = viewInstance.value.getViewer();
            const boundingSphere = Cesium.BoundingSphere.fromPoints(positions)
            const viewer = viewInstance.value.getViewer()
            if (viewer && viewer.camera) {
              viewer.camera.flyToBoundingSphere(boundingSphere, {
                duration: 0, // 飞行动画持续时间(秒)
                offset: new Cesium.HeadingPitchRange(0, -0.5, boundingSphere.radius * 1.5),
              });
              })
            } else {
              console.error('无法获取有效的 Viewer 或 camera 对象');
              console.error('无法获取有效的 Viewer 或 camera 对象')
            }
          }
        }
      }
    });
    })
  } else {
    getAttachInfoAPI(val.id).then(res => {
      detailTitle.value = res.data.data.nickName.split('.jpeg')[0];
      detailTitle.value = res.data.data.nickName.split('.jpeg')[0]
      dialogDetailList.value = {
        ...res.data.data,
        checkedinput: false,
        editName: res.data.data?.nickName?.split('.jpeg')[0],
      };
      dialogVisible.value = true;
    });
      }
      dialogVisible.value = true
    })
  }
};
// WKT坐标解析函数
function parseWKTCoordinates(wktString) {
  // 解析POLYGON格式的WKT字符串
  const regex = /POLYGON\s*\(\((.*?)\)\)/i;
  const match = wktString.match(regex);
  if (!match || !match[1]) return [];
  // 分割坐标对
  const coordinatePairs = match[1].split(/,\s*/);
  return coordinatePairs.map(pair => {
    const [lon, lat] = pair.trim().split(/\s+/).map(Number);
    return [lon, lat];
  });
}
function dialogClose() {
// WKT坐标解析函数
function parseWKTCoordinates (wktString) {
  // 解析POLYGON格式的WKT字符串
  const regex = /POLYGON\s*\(\((.*?)\)\)/i
  const match = wktString.match(regex)
  if (!match || !match[1]) return []
  // 分割坐标对
  const coordinatePairs = match[1].split(/,\s*/)
  return coordinatePairs.map(pair => {
    const [lon, lat] = pair.trim().split(/\s+/).map(Number)
    return [lon, lat]
  })
}
function dialogClose () {
  // 对话框关闭时清理资源
  viewInstance.value?.viewerDestroy();
  viewer = null;
  isMapInitialized.value = false;
  viewInstance.value?.viewerDestroy()
  viewer = null
  isMapInitialized.value = false
}
onMounted(() => {
  getaiImagesPage();
  getaiImagesPage()
  // 监听打开全景事件
  EventBus.on('open-panorama', params => {
    panoramaParamsShow.value = params.show;
    panoramaParamsUrl.value = params.url;
  });
});
    panoramaParamsShow.value = params.show
    panoramaParamsUrl.value = params.url
  })
})
onBeforeUnmount(() => {
  // 组件卸载时移除事件监听,防止内存泄漏
  EventBus.off('open-panorama');
  viewInstance.value?.removeAllCustomImageryProviderDataSource(curCustomImageryProvider);
  viewInstance.value?.viewerDestroy();
});
  EventBus.off('open-panorama')
  viewInstance.value?.removeAllCustomImageryProviderDataSource(curCustomImageryProvider)
  viewInstance.value?.viewerDestroy()
})
</script>
<style scoped lang="scss">