无人机管理后台前端(已迁走)
张含笑
2025-06-16 a2f1ea1771cffe31b720dbb2161186f28b7cb977
feat:正射
6 files modified
247 ■■■■ changed files
.env.development 2 ●●● patch | view | raw | blame | history
.env.production 2 ●●● patch | view | raw | blame | history
src/utils/cesium/publicCesium.js 22 ●●●●● patch | view | raw | blame | history
src/utils/util.js 10 ●●●●● patch | view | raw | blame | history
src/views/dataCenter/components/dataCenterMap.vue 12 ●●●● patch | view | raw | blame | history
src/views/dataCenter/dataCenter.vue 199 ●●●● patch | view | raw | blame | history
.env.development
@@ -26,7 +26,7 @@
VITE_APP_AIRLINE_URL = https://wrj.shuixiongit.com/minio/cloud-bucket
# 图片存放地址
VITE_APP_TERRAIN_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket
VITE_APP_TERRAIN_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket/all_terrain
# 是否在打包时开启压缩,支持 gzip 和 brotli
VITE_BUILD_COMPRESS = gzip
.env.production
@@ -27,7 +27,7 @@
VITE_APP_AIRLINE_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket
# 图片存放地址
VITE_APP_TERRAIN_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket
VITE_APP_TERRAIN_URL = https://wrj.shuixiongit.com/aiskyminio/cloud-bucket/all_terrain
# 是否在打包时开启压缩,支持 gzip 和 brotli
VITE_BUILD_COMPRESS = gzip
src/utils/cesium/publicCesium.js
@@ -84,7 +84,7 @@
        if (terrain) {
            try {
                Cesium.CesiumTerrainProvider.fromUrl(`${import.meta.env.VITE_APP_TERRAIN_URL}/ztzf_terrain/all_terrain`, {
                Cesium.CesiumTerrainProvider.fromUrl(`${import.meta.env.VITE_APP_TERRAIN_URL}/all_terrain`, {
                    requestVertexNormals: true, // 启用地形法线增强立体感
                    requestWaterMask: true, // 启用水体遮罩效果
                }).then(terrainProvider => {
@@ -471,4 +471,24 @@
        }
        return a
    }
    // 添加entity
    addCustomImageryProviderDataSource (imageryLayers) {
        console.log(imageryLayers, this.viewer, '---1-')
        return this.viewer?.imageryLayers.addImageryProvider(imageryLayers)
    }
    showCustomImageryProviderDataSource (imageryLayers, show) {
        if (imageryLayers) {
            imageryLayers.show = show
        }
    }
    removeAllCustomImageryProviderDataSource (imageryLayers) {
        if (imageryLayers) {
            this.viewer?.imageryLayers.remove(imageryLayers)
        }
    }
}
src/utils/util.js
@@ -130,6 +130,16 @@
    return `${url.substring(0, lastDotIndex)}_small${url.substring(lastDotIndex)}`
}
/**
 * 获取正射路径
 * @param url
 * @returns {string}
 */
export const getzsSmallImg = url => {
    if (!url) return ''
    const lastDotIndex = url.lastIndexOf('.')
    return `${url.substring(0, lastDotIndex)}_small.jpeg`
}
/**
 * 浏览器判断是否全屏
 */
export const fullscreenEnable = () => {
src/views/dataCenter/components/dataCenterMap.vue
@@ -89,9 +89,8 @@
const restoreAllIcons = () => {
  dataPointEntities.value.forEach(entity => {
    if (entity.billboard) {
    const status = entity?.properties?._customData?._value?.data.status
      entity.billboard.image =
        status === 1 ? defaultIcon  : getEventImage(item.status);
        props.dotData.resultType === 2 ? getEventImage(entity.status) : defaultIcon;
    }
  });
  activeEntity.value = null;
@@ -111,10 +110,8 @@
  // 恢复所有点的默认图标
  restoreAllIcons();
  if (currentClickEntity.billboard) {
    const status = currentClickEntity?.properties?._customData?._value?.data.status
    console.log('stayus',status);
    currentClickEntity.billboard.image =
      status === 1 ?activeIcon  : getEventActiveImage(status);
      props.dotData.resultType === 2 ? getEventImage(currentClickEntity.status) : activeIcon;
    currentClickEntity.billboard.scale = 1; // 可选缩放效果
    activeEntity.value = currentClickEntity;
  }
@@ -171,7 +168,7 @@
        pixelOffset: new Cesium.Cartesian2(0, 55),
      },
      billboard: {
        image: item.status === 1 ?defaultIcon  : getEventImage(item.status), // 初始为默认图标
        image: props.dotData.resultType === 2 ? getEventImage(item.status) : defaultIcon, // 初始为默认图标
        width: 40,
        height: 40,
        pixelOffset: new Cesium.Cartesian2(0, -15),
@@ -255,14 +252,11 @@
  }
};
const isViewerReady = ref(false);
/**
 * 初始化标注添加
 * @param data 数据
 */
const initEntityOrPopup = data => {
console.log('data',data);
  //地图点在范围内
  watch(
    () => isMapInitialized.value,
src/views/dataCenter/dataCenter.vue
@@ -45,6 +45,13 @@
              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"
@@ -71,10 +78,11 @@
            <span class="delete" @click="deleteDetail(scope.row)" v-if="scope.row.resultType !== 2"
              >删除</span
            >
            <!-- && !isTifFile(scope.row.nickName) -->
            <span
              class="location"
              @click="positionDetail(scope.row)"
              v-if="scope.row.resultType !== 1 && !isTifFile(scope.row.nickName)"
              v-if="scope.row.resultType !== 1"
              >定位</span
            >
          </template>
@@ -109,6 +117,12 @@
            alt=""
            class="imageBox"
          />
          <!-- 地图 -->
          <div
            v-if="dialogDetailList?.resultType === 4"
            id="detaildataCenterMap"
            class="ztzf-cesium"
          ></div>
          <img v-else :src="getSmallImg(dialogDetailList?.link)" alt="" />
        </div>
        <div class="rightDetail">
@@ -147,7 +161,7 @@
          <div>拍摄时间:{{ dialogDetailList?.createTime }}</div>
          <div>文件类型:{{ photoTypeMap[dialogDetailList?.photoType] }}</div>
          <div>文件格式:{{ resultTypeMap[dialogDetailList?.resultType] }}</div>
          <div>照片文件大小:{{bytesToMB(dialogDetailList?.attachSize)  }}</div>
          <div>照片文件大小:{{ bytesToMB(dialogDetailList?.attachSize) }}</div>
          <div>
            <el-button
              type="success"
@@ -199,6 +213,22 @@
</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 { render } from 'vue';
import defaultIcon from '@/assets/images/dataCenter/datamap/eventCompleted.png';
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;
import EventBus from '@/utils/eventBus';
import dataCenterMap from '@/views/dataCenter/components/dataCenterMap.vue';
import PanoramaPopup from '@/components/PanoramaPopup/PanoramaPopup.vue'; //全景
@@ -212,9 +242,9 @@
  deleteFileMultipleApi,
  downloadApi,
  updataTitleApi,
  getOrthoimageInfo
  getOrthoimageInfo,
} from '@/api/dataCenter/dataCenter';
import { getShowImg, getSmallImg } from '@/utils/util';
import { getShowImg, getSmallImg, getzsSmallImg } from '@/utils/util';
import { onMounted, watch } from 'vue';
import dayjs from 'dayjs';
function bytesToMB(bytes, decimalPlaces = 2) {
@@ -389,49 +419,33 @@
};
// 全部下载
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,
  };
  downloadApi(params).then(res => {
    aLinkDownload(res.data.data, `sjzx-file-pack-${dayjs().format('YYYYMMDDHHmmss')}.zip`);
     loading.close();
    loading.close();
  });
};
// 查看弹框
function isTifFile(filename) {
  const lastDot = filename.lastIndexOf('.');
  if (lastDot === -1) return false; // 无后缀
  return filename.slice(lastDot + 1).toLowerCase() === 'tif';
}
// 接口
const getOrthoimageInfoFUN =()=>{
}
const dialogVisible = ref(false);
const dialogDetailList = ref(null);
const detailTitle = ref('');
const lookDetail = val => {
console.log('查看',val.resultType);
// if(val.resultType === 4){ // 正射
//   getOrthoimageInfo(val.id).then(res=>{
//     console.log('正射',res.data.data);
//      dialogDetailList.value = res.data.data;
//   })
// }else{
 getAttachInfoAPI(val.id).then(res => {
    detailTitle.value = res.data.data.nickName;
    dialogDetailList.value = res.data.data;
    dialogDetailList.value = { ...res.data.data, checkedinput: false };
      // console.log('detailTitle.value',dialogDetailList.value);
// 地图弹框
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;
  // 确保地图组件加载完成
  nextTick(() => {
    if (mapComponent.value) {
      // 调用子组件方法并传递数据
      mapComponent.value.initEntityOrPopup(val);
    }
  });
// }
  dialogVisible.value = true;
};
const fileNameedit = ref('');
@@ -484,24 +498,93 @@
    });
};
// 地图弹框
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;
  // 确保地图组件加载完成
  nextTick(() => {
    if (mapComponent.value) {
      // 调用子组件方法并传递数据
      mapComponent.value.initEntityOrPopup(val);
    }
  });
// 查看弹框
function isTifFile(filename) {
  const lastDot = filename.lastIndexOf('.');
  if (lastDot === -1) return false; // 无后缀
  return filename.slice(lastDot + 1).toLowerCase() === 'tif';
}
const dialogVisible = ref(false);
const dialogDetailList = ref(null);
const detailTitle = ref('');
let curCustomImageryProvider = null;
const lookDetail = val => {
  console.log('查看', val);
  if (val.resultType === 4) {
    // 正射
    getOrthoimageInfo(val.wayLineJobId).then(res => {
      console.log('正射', res.data.data);
      detailTitle.value = val.nickName;
      dialogDetailList.value = val;
      if (res.data.data != null && isMapInitialized.value === true) {
        console.log('viewer', viewer);
        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]
            }`,
          })
        );
        yxShowBox.value = true;
      }
      dialogVisible.value = true;
    });
  } else {
    getAttachInfoAPI(val.id).then(res => {
      detailTitle.value = res.data.data.nickName;
      dialogDetailList.value = res.data.data;
      dialogDetailList.value = { ...res.data.data, checkedinput: false };
      // console.log('detailTitle.value',dialogDetailList.value);
      dialogVisible.value = true;
    });
  }
};
// 正射地图
const yxShowBox = ref(false);
const removeHandler = () => {
  handler?.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK);
  handler?.destroy();
  handler = null;
};
const isMapInitialized = ref(false); //地图加载
const initMap = () => {
  if (viewer || isMapInitialized.value) return;
  const container = document.getElementById('detaildataCenterMap');
  if (!container) {
    console.error('地图容器未找到');
    return;
  }
  viewInstance.value = new PublicCesium({
    dom: 'detaildataCenterMap',
    flatMode: false,
    terrain: false,
    mapFilter: true,
  });
  viewer = viewInstance.value.getViewer();
  viewerRef.value = viewer;
  isMapInitialized.value = true;
  console.log('地图初始化完成');
};
// 监听对话框状态
watch(dialogVisible, newVal => {
  if (newVal) {
    nextTick(() => {
      initMap();
    });
  } else {
    // 对话框关闭时清理资源
    viewInstance.value?.viewerDestroy();
    viewer = null;
    isMapInitialized.value = false;
    // removeHandler();
  }
});
onMounted(() => {
  getaiImagesPage();
@@ -514,6 +597,8 @@
onBeforeUnmount(() => {
  // 组件卸载时移除事件监听,防止内存泄漏
  EventBus.off('open-panorama');
  viewInstance.value.removeAllCustomImageryProviderDataSource(curCustomImageryProvider);
  viewInstance.value?.viewerDestroy();
});
</script>
@@ -582,6 +667,10 @@
      width: 100%;
      height: 100%;
    }
    #detaildataCenterMap {
      width: 100%;
      height: 100%;
    }
  }
  .rightDetail {
    width: 30%;