From 3f6ed98bbb81cec78228ebf69a2c61f3ffc4261d Mon Sep 17 00:00:00 2001 From: wangxk Date: Tue, 29 Jul 2025 15:21:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E7=89=87=E4=B8=8A=E5=8F=A0=E5=8A=A0?= =?UTF-8?q?=E8=BD=A8=E8=BF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/api/datamanagement/index.ts | 8 + web/src/components/trajectory/imggui.vue | 233 ++++++++++++++++++ .../views/testdata/datamanagement/index.vue | 148 +++++++++-- 3 files changed, 373 insertions(+), 16 deletions(-) create mode 100644 web/src/components/trajectory/imggui.vue diff --git a/web/src/api/datamanagement/index.ts b/web/src/api/datamanagement/index.ts index 3c8bebf..9ab3a9f 100644 --- a/web/src/api/datamanagement/index.ts +++ b/web/src/api/datamanagement/index.ts @@ -245,4 +245,12 @@ export function confirmDeleteNodes(params:any){ method:'post', params:params, }) +} +//获取文件相关的属性 +export function listTsFilesById(params:any){ + return request ({ + url:'/experimentalData/ts-files/listTsFilesById', + method:'post', + params:params, + }) } \ No newline at end of file diff --git a/web/src/components/trajectory/imggui.vue b/web/src/components/trajectory/imggui.vue new file mode 100644 index 0000000..aee901e --- /dev/null +++ b/web/src/components/trajectory/imggui.vue @@ -0,0 +1,233 @@ + + + + + \ No newline at end of file diff --git a/web/src/views/testdata/datamanagement/index.vue b/web/src/views/testdata/datamanagement/index.vue index 416a060..32e34bf 100644 --- a/web/src/views/testdata/datamanagement/index.vue +++ b/web/src/views/testdata/datamanagement/index.vue @@ -13,7 +13,7 @@ import { ElMessageBox, ElMessage, ElMain } from "element-plus"; import Page from '@/components/Pagination/page.vue'; import AudioPlayer from '@/components/file/preview/AudioPlayer.vue'; import { batchDeleteReq } from "@/api/file-operator"; -import { tstaskList, obtaintestData, decompressionFolderData, getTsNodesTree, confirmDeleteNodes, addTsNodes, selectTsNodesByTskeId, updateTsNodes, deleteTsNodesById, tsFilesPage, addTsFiles, testDataScanById, updateTsFiles, deleteTsFilesById, listTsFiles, deleteTsFilesByIds, compress, Decompression, compare, downloadToLocal, uploadToBackup, addTsFile, list, moveFileFolder, copyFileFolder, startSimpleNavi, stopSimpleNavi } from "@/api/datamanagement"; +import { tstaskList, obtaintestData, decompressionFolderData, getTsNodesTree, confirmDeleteNodes, addTsNodes, selectTsNodesByTskeId, updateTsNodes, deleteTsNodesById, tsFilesPage, addTsFiles, testDataScanById, updateTsFiles, deleteTsFilesById, listTsFiles, deleteTsFilesByIds, compress, Decompression, compare, downloadToLocal, uploadToBackup, addTsFile, list, moveFileFolder, copyFileFolder, startSimpleNavi, stopSimpleNavi, listTsFilesById } from "@/api/datamanagement"; import ZUpload from '@/components/file/ZUpload.vue' import useFileUpload from "@/components/file/file/useFileUpload"; import useHeaderStorageList from "@/components/header/useHeaderStorageList"; @@ -24,6 +24,7 @@ import txtexl from '@/components/textEditing/txtexl.vue' //轨迹图 import MapChart from '@/components/trajectory/index.vue'; import Echart from '@/components/trajectory/echarts.vue'; +import Imggui from '@/components/trajectory/imggui.vue'; // 在顶部添加导入 import PDFImg from '@/assets/fileimg/PDF.png' import WordImg from '@/assets/fileimg/word.png' @@ -203,16 +204,16 @@ function readyto2(msg: any) { cancelButtonText: '取消', type: 'warning', } - ).then(() => { + ).then(() => { gai.value = true getdata() }) setTimeout(() => { ElMessageBox.close() - if(!gai.value){ + if (!gai.value) { getdata() } - + }, 5000) } @@ -1401,7 +1402,7 @@ async function submitzip(formEl: any) { Decompression({ id: jiezip.value.id, parentId: zipParentid.value, decompressionPath: zipObj.value.compressedPath, path: filepath.value, taskId: projectId.value }).then((res: any) => { if (res.code == 0) { // ElMessage.success('解压成功') - + zipfiles.value = false tableIdarr.value.length = 0 filetableRef.value!.clearSelection() @@ -1587,24 +1588,100 @@ const fileIcon = (row: any) => { return FILE_ICONS[ext as keyof typeof FILE_ICONS] || (row.type == 'ZIP' ? ZipImg : TextImg); }; const mapTrajectory = ref(false) - const fredid = ref('') +const pngform: any = ref({}) +const imgor = ref(true) function openMap(row: any) { + pngobj.vlaue = { + pngurl: '', + textcontent: [] + } + pngform.value = JSON.parse(JSON.stringify(row)) fredid.value = row.id getSSELink() - // setInterval(() => { - // lineData.value = lineData.value.map(d => ({ - // x: d.x, - // y: Math.random() * 10 - // })); - // }, 2000); + getpngdata() + tabbas.value = '1' mapTrajectory.value = true maptime.value = 300 + if (row.custom1) { + ElMessageBox.confirm( + '当前轨迹文件已有关联图片,是否直接加载轨迹?', + '提示', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + } + ) + .then(() => { + pngobj.value = JSON.parse(row.custom1) + imgor.value = false + }) + } + +} +const pngArr = ref([]) +const txtArr = ref([]) +const pngloading = ref(false) +function getpngdata() { + pngloading.value = true + listTsFilesById({ id: fredid.value, taskId: projectId.value, nodeId: pathid.value }).then((res: any) => { + pngloading.value = false + pngArr.value = res.data.tsFilesListPng + txtArr.value = res.data.tsFilesListTxt + }) +} +const pngobj: any = ref({ + pngurl: '', + textcontent: [] +}) +function pngsure() { + if (!(pngradio.value && txtradio.value)) { + ElMessage.warning('请选择底图或地理信息文件') + return + } + + // 创建新的响应式对象 + const newPngobj = { + pngurl: '', + textcontent: [] + } + + // 更新图片URL + pngArr.value.forEach((item: any) => { + if (pngradio.value == item.id) { + newPngobj.pngurl = item.url + } + }) + + // 更新文本内容 + txtArr.value.forEach((item: any) => { + if (txtradio.value == item.id) { + newPngobj.textcontent = JSON.parse(JSON.stringify(item.fileContent)).split(",") + } + }) + + // 使用解构创建新对象保证响应式特性 + pngobj.value = { + ...pngobj.value, + ...newPngobj + } + + // 修正拼写错误 + pngform.value.custom1 = JSON.stringify(pngobj.value) + + // 发起更新请求 + updateTsFiles(pngform.value).then((res: any) => { }) + imgor.value = false } function mapClose() { + txtradio.value = null + pngradio.value = null + imgor.value = true mapTrajectory.value = false lineData.value.length = 0 dynamicCoordinates.value.length = 0 + imgarrdata.value.length = 0 closeSSE() // index = 0 } @@ -1634,6 +1711,7 @@ function frequency(row: any) { qvehuan1.value = true lineData.value.length = 0 dynamicCoordinates.value.length = 0 + imgarrdata.value.length = 0 } }) } @@ -1641,9 +1719,11 @@ function frequency(row: any) { const eventSource = ref(null) let index = 0 const dynamicCoordinates = ref([]) +const imgarrdata = ref([]) // let SSEclose function closeSSE() { dynamicCoordinates.value.length = 0 + imgarrdata.value.length = 0 stopSimpleNavi({ token: userStore.userId }).then((res: any) => { }) eventSource.value?.close() @@ -1667,6 +1747,7 @@ function getSSELink() { dynamicCoordinates.value.shift() } lineData.value.push({ x: data.UtcTime, y: data.alt }) + imgarrdata.value.push([data.lon, data.lat]) } } catch (err) { console.error('消息解析失败:', err) @@ -1720,7 +1801,7 @@ function repstring(row: any) { * @returns 格式化后的文件大小字符串 */ const formatFileSize = (size: number): string => { - if(!size) return '--' + if (!size) return '--' if (size < 1024) return `${size.toFixed(1)} KB`; const mb = size / 1024; @@ -1729,6 +1810,9 @@ const formatFileSize = (size: number): string => { const gb = mb / 1024; return `${gb.toFixed(1)} GB`; }; + +const txtradio: any = ref(null) +const pngradio: any = ref(null)