无人机管理后台前端(已迁走)
张含笑
2025-06-26 6204aa2d96a5e6ae7dc67fa6f605f3fd412f0457
Merge branch 'refs/heads/feature/v2.0.0/后台管理数据中心'

# Conflicts:
# src/views/dataCenter/dataCenter.vue
1 files modified
136 ■■■■ changed files
src/views/dataCenter/dataCenter.vue 136 ●●●● patch | view | raw | blame | history
src/views/dataCenter/dataCenter.vue
@@ -27,7 +27,7 @@
        </el-table-column>
        <el-table-column prop="regionName" label="所属区域" v-if="!isDistrictLevel">
          <template #default="scope">
            <span>{{processAddress(scope.row.regionName)}}</span>
            <span>{{ processAddress(scope.row.regionName) }}</span>
          </template>
        </el-table-column>
        <el-table-column property="nestName" label="所属机巢" />
@@ -82,8 +82,7 @@
            <span class="delete" @click="deleteDetail(scope.row)" v-if="scope.row.resultType !== 2"
              >删除</span
            >
            <!-- && !isTifFile(scope.row.nickName)
            scope.row.resultType !== 1-->
            <span
              class="location"
              @click="positionDetail(scope.row)"
@@ -116,12 +115,30 @@
      </template>
      <div class="detailContainer">
        <div class="leftImg">
          <img
          <!-- <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
              class="quanjing"
              @click="clickpanorama(dialogDetailList)"
              v-else-if="dialogDetailList?.resultType === 5"
              :src="dialogDetailList?.resultType?.smallUrl"
              alt=""
            /> -->
          <!-- 地图 -->
          <div
            v-else-if="dialogDetailList?.resultType === 4"
@@ -134,11 +151,11 @@
          <div class="title">
            <div class="inputEdit">
              文件名称:<span class="fileTitle" v-if="!dialogDetailList?.checkedinput">{{
                dialogDetailList?.editName
                dialogDetailList?.nickName ? dialogDetailList?.nickName : '--'
              }}</span>
              <el-input
                v-else
                v-model="dialogDetailList.editName"
                v-model="dialogDetailList.nickName"
                @keyup.enter="saveTitle()"
                class="title-input"
                clearable
@@ -154,19 +171,41 @@
              </div>
            </div>
          </div>
          <div>任务名称:{{ dialogDetailList?.jobName }}</div>
          <div>所属区域:{{ dialogDetailList?.regionName }}</div>
          <div>拍摄机巢:{{ dialogDetailList?.nestName }}</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 }}</div>
          <div>拍摄时间:{{ dialogDetailList?.createTime }}</div>
          <div>文件类型:{{ photoTypeMap[dialogDetailList?.photoType] }}</div>
          <div>文件格式:{{ resultTypeMap[dialogDetailList?.resultType] }}</div>
          <div>照片文件大小:{{ bytesToMB(dialogDetailList?.attachSize) }}</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"
@@ -254,8 +293,6 @@
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';
@@ -283,7 +320,6 @@
};
// 判断省市区
const areaCode = userInfo.value?.detail?.areaCode || '';
// 判断账号级别
const isProvinceLevel = computed(() => areaCode.endsWith('00000000')); // 省级:后8位为0
const isCityLevel = computed(() => !isProvinceLevel.value && areaCode.endsWith('000000')); // 市级:后6位为0
@@ -363,7 +399,7 @@
        showUrl: getShowImg(i?.link),
        file_name: i.name.split('/').pop(),
      }));
      // console.log('res', tableData.value);
      loadings.value = false;
    }
  );
@@ -435,8 +471,18 @@
    loading = ElLoading.service({ background: 'rgba(0, 0, 0, 0.5)', text: '打包中,请稍等...' });
    const fileIds = list.map(i => i.id);
    let aaa = {
      areaCode: '',
      attachIds: fileIds,
      dockSn: '',
      endTime: '',
      fileName: '',
      fileType: '',
      jobName: '',
      resultType: '',
      startTime: '',
      wayLineJobIds: [],
    };
    downloadApi(aaa).then(res => {
      aLinkDownload(res.data.data, `sjzx-file-pack-${dayjs().format('YYYYMMDDHHmmss')}.zip`);
      loading.close();
@@ -512,17 +558,17 @@
const saveTitle = item => {
  const updateparams = {
    id: item.id,
    nickName: `${item.editName.trim()}`,
    nickName: `${item.nickName.trim()}`,
  };
  // 验证并提示
  if (!validateNickname(updateparams.nickName, '名称')) return;
  item.checkedinput = false;
  detailTitle.value = item.editName;
  detailTitle.value = item.nickName;
  updataTitleApi(updateparams)
    .then(res => {
      if (res.status === 200) {
        ElMessage.success('修改成功');
        getaiImagesPage()
        getaiImagesPage();
      } else {
        ElMessage.error(res.data.message || '修改失败');
      }
@@ -534,7 +580,6 @@
};
// 正射地图
const yxShowBox = ref(false);
const removeHandler = () => {
  handler?.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK);
  handler?.destroy();
@@ -562,7 +607,7 @@
  // console.log('地图初始化完成');
};
// 查看弹框
// 判断是否是正射
function isTifFile(filename) {
  const lastDot = filename.lastIndexOf('.');
  if (lastDot === -1) return false; // 无后缀
@@ -571,11 +616,13 @@
const shouldShowLocation = row => {
  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 lookDetail = val => {
  if (val.resultType === 4) {
@@ -584,8 +631,11 @@
      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;
      if (res.data.data != null && isMapInitialized.value === true) {
@@ -598,12 +648,34 @@
          })
        );
        yxShowBox.value = true;
        // 添加定位
        if (positiongeom.value) {
          // 解析WKT格式的多边形坐标
          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();
            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 对象');
            }
          }
        }
      }
    });
  } else {
    getAttachInfoAPI(val.id).then(res => {
      detailTitle.value = res.data.data.nickName.split('.jpeg')[0];
      // dialogDetailList.value = res.data.data;
      dialogDetailList.value = {
        ...res.data.data,
        checkedinput: false,
@@ -613,7 +685,19 @@
    });
  }
};
// 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();