|
@@ -49,13 +49,13 @@
|
|
|
width="400"
|
|
|
:before-close="handleClose"
|
|
|
>
|
|
|
- <el-steps style="max-width: 600px" :active="active" finish-status="success">
|
|
|
+ <el-steps style="max-width: 600px" :active="update_active" finish-status="success">
|
|
|
<el-step title="数据格式检查"/>
|
|
|
<el-step title="地图生成"/>
|
|
|
</el-steps>
|
|
|
|
|
|
<template #footer>
|
|
|
- <el-button @click="goToMapUpdate" :disabled="active !== 2">去部署</el-button>
|
|
|
+ <el-button @click="goToMapUpdate" :disabled="update_active !== 2">去部署</el-button>
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
|
|
@@ -143,6 +143,24 @@
|
|
|
<el-button style="margin-left: 10px;" type="primary" @click="goToTestRecord">仿真测试记录</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
+
|
|
|
+
|
|
|
+ <el-dialog
|
|
|
+ v-model="worldDialogVisible"
|
|
|
+ title="生成world"
|
|
|
+ width="400"
|
|
|
+ :before-close="handleClose"
|
|
|
+ >
|
|
|
+ <el-steps style="max-width: 600px" :active="world_active" finish-status="success">
|
|
|
+ <el-step title="数据准备"/>
|
|
|
+ <el-step title="world生成"/>
|
|
|
+ <el-step title="world上传"/>
|
|
|
+ </el-steps>
|
|
|
+
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="goToMapUpdate" :disabled="world_active !== 2">去部署</el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
<el-table stripe style="background-color: rgba(255,0,0,99%);width: 100%" border :data="tableData"
|
|
|
fixed ref="multipleTableRef" @selection-change="handleSelectionChange" :cell-style="{ textAlign: 'center'}" :header-cell-style="{ textAlign: 'center'}">
|
|
|
<el-table-column type="selection" width="55"/>
|
|
@@ -155,9 +173,12 @@
|
|
|
<el-table-column prop="callbackTime" label="上报时间"/>
|
|
|
<el-table-column prop="dataStateName" label="数据状态"/>
|
|
|
<el-table-column width="300" fixed="right" label="操作">
|
|
|
- <el-button size="small" type="danger" @click="generateWorld">生成world</el-button>
|
|
|
- <el-button size="small" type="danger" @click="goToDetail">仿真测试</el-button>
|
|
|
- <!-- <el-button size="small" type="danger" @click="goToDetail">算法评价</el-button>-->
|
|
|
+ <template v-slot="scope">
|
|
|
+ <el-button size="small" type="danger" @click="generateWorld(scope.row.id)">生成world</el-button>
|
|
|
+ <el-button size="small" type="danger" @click="goToDetail">仿真测试</el-button>
|
|
|
+ <!-- <el-button size="small" type="danger" @click="goToDetail">算法评价</el-button>-->
|
|
|
+ </template>
|
|
|
+
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
<p></p> <!--空行-->
|
|
@@ -187,11 +208,13 @@ import {reactive} from 'vue'
|
|
|
import {ElTable} from "element-plus";
|
|
|
import { ElMessage } from "element-plus";
|
|
|
import {useRouter} from 'vue-router'; // 导入 Vue Router 的 useRouter 钩子
|
|
|
+import * as fs from "fs";
|
|
|
|
|
|
|
|
|
const value
|
|
|
= ref(true)
|
|
|
-const active = ref(0)
|
|
|
+const update_active = ref(0)
|
|
|
+const world_active = ref(0)
|
|
|
const router = useRouter();
|
|
|
const algorithmContainerState = ref(false)
|
|
|
const gazeboState = ref(false)
|
|
@@ -201,6 +224,7 @@ const multipleTableRef = ref<InstanceType<typeof ElTable>>
|
|
|
const algorithmDialogVisible = ref(false)
|
|
|
const mapDialogVisible = ref(false)
|
|
|
const updateDialogVisible = ref(false)
|
|
|
+const worldDialogVisible = ref(false)
|
|
|
|
|
|
const handleClose = (done: () => void) => {
|
|
|
done()
|
|
@@ -342,25 +366,77 @@ const rviz = () => {
|
|
|
}
|
|
|
|
|
|
|
|
|
-const generateWorld = () => {
|
|
|
- // if (rvizState.value) {
|
|
|
- // if (window.electronAPI) {
|
|
|
- // window.electronAPI.generateWorld();
|
|
|
- // } else {
|
|
|
- // console.error('electronAPI is not defined');
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // if (window.electronAPI) {
|
|
|
- // window.electronAPI.closeRviz();
|
|
|
- // } else {
|
|
|
- // console.error('electronAPI is not defined');
|
|
|
- // }
|
|
|
- // }
|
|
|
- console.log("11111")
|
|
|
-
|
|
|
- window.electronAPI.generateWorld()
|
|
|
+const generateWorld = async (id) => {
|
|
|
+
|
|
|
+ console.log("id", id);
|
|
|
+ console.log("Starting generating world...")
|
|
|
+ worldDialogVisible.value = true
|
|
|
+
|
|
|
+ // axios.get('http://127.0.0.1:8888/map/downloadmapbagfile?id=1820978518251540482',
|
|
|
+ // {
|
|
|
+ // responseType: 'stream'
|
|
|
+ // }
|
|
|
+ // ).then(function (response) {
|
|
|
+ // console.log("response", response);
|
|
|
+ // console.log("response", response.data.message);
|
|
|
+ // // const url = window.URL.createObjectURL(new Blob([response.data]));
|
|
|
+ // // const link = document.createElement('a');
|
|
|
+ // // link.href = url;
|
|
|
+ // // link.setAttribute('download', "test.pdf"); // 设置下载的文件名
|
|
|
+ // // document.body.appendChild(link);
|
|
|
+ // // link.click();
|
|
|
+ //
|
|
|
+ // let filePath = "/home/cicv/work/pji_desktop"
|
|
|
+ //
|
|
|
+ // //从header中读取文件名称
|
|
|
+ // const headerFilename = response.headers['content-disposition']?.split(';')[1].split('=')[1];
|
|
|
+ // console.log("response.headers", response.headers)
|
|
|
+ // console.log("headerFilename", headerFilename);
|
|
|
+ // const fileName = decodeURIComponent(headerFilename);
|
|
|
+ //
|
|
|
+ // downloadByData(response.data, fileName, 'application/json');
|
|
|
+ //
|
|
|
+ //
|
|
|
+ //
|
|
|
+ // }).catch(function (error) {
|
|
|
+ // console.log(error);
|
|
|
+ // });
|
|
|
+
|
|
|
+ const url = "http://127.0.0.1:8888/map/downloadmapbagfile?id=" + id
|
|
|
+ const fileName = "map-" + id + ".bag"
|
|
|
+ const savePath = "/home/cicv/work"
|
|
|
+
|
|
|
+ const result = await window.electronAPI.downloadFile(url, fileName, savePath);
|
|
|
+ if (!result.success) {
|
|
|
+ console.error('File download failed:', result.error);
|
|
|
+ ElMessage.error("地图bag数据拉取失败!");
|
|
|
+ } else {
|
|
|
+ console.log('File downloaded successfully:', result.filePath);
|
|
|
+ world_active.value = 1
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+// function downloadByData(data: BlobPart, filename: string, mime?: string, bom?: BlobPart) {
|
|
|
+// const blobData = typeof bom !== 'undefined' ? [bom, data] : [data];
|
|
|
+// const blob = new Blob(blobData, { type: mime || 'application/octet-stream' });
|
|
|
+//
|
|
|
+// const blobURL = window.URL.createObjectURL(blob);
|
|
|
+// const tempLink = document.createElement('a');
|
|
|
+// tempLink.style.display = 'none';
|
|
|
+// tempLink.href = blobURL;
|
|
|
+// tempLink.setAttribute('download', filename);
|
|
|
+// if (typeof tempLink.download === 'undefined') {
|
|
|
+// tempLink.setAttribute('target', '_blank');
|
|
|
+// }
|
|
|
+// document.body.appendChild(tempLink);
|
|
|
+// tempLink.click();
|
|
|
+// document.body.removeChild(tempLink);
|
|
|
+// window.URL.revokeObjectURL(blobURL);
|
|
|
+// }
|
|
|
+
|
|
|
const queryLine = reactive({
|
|
|
dataName: '',
|
|
|
equipmentName: '',
|