From a2f1ea1771cffe31b720dbb2161186f28b7cb977 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Mon, 16 Jun 2025 20:04:22 +0800
Subject: [PATCH] feat:正射
---
src/views/dataCenter/dataCenter.vue | 199 ++++++++++++++++++++++++++++++++++++-------------
1 files changed, 144 insertions(+), 55 deletions(-)
diff --git a/src/views/dataCenter/dataCenter.vue b/src/views/dataCenter/dataCenter.vue
index ece9562..50543cd 100644
--- a/src/views/dataCenter/dataCenter.vue
+++ b/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%;
--
Gitblit v1.9.3