|
@@ -41,9 +41,11 @@
|
|
<el-button type="primary" @click="goToUpdateStat">地图更新统计</el-button>
|
|
<el-button type="primary" @click="goToUpdateStat">地图更新统计</el-button>
|
|
<el-button type="primary" @click="mapDialogVisible = true">地图续扫提醒阈值</el-button>
|
|
<el-button type="primary" @click="mapDialogVisible = true">地图续扫提醒阈值</el-button>
|
|
<el-button type="primary" @click="goToMapRescan">地图续扫提醒</el-button>
|
|
<el-button type="primary" @click="goToMapRescan">地图续扫提醒</el-button>
|
|
|
|
+<!-- <el-button type="primary" @click="goToMapUpdate">地图更新</el-button>-->
|
|
|
|
|
|
<el-dialog
|
|
<el-dialog
|
|
v-model="updateDialogVisible"
|
|
v-model="updateDialogVisible"
|
|
|
|
+ v-if="updateDialogVisible"
|
|
title="地图更新"
|
|
title="地图更新"
|
|
width="400"
|
|
width="400"
|
|
:before-close="handleClose"
|
|
:before-close="handleClose"
|
|
@@ -55,7 +57,7 @@
|
|
</el-steps>
|
|
</el-steps>
|
|
|
|
|
|
<template #footer>
|
|
<template #footer>
|
|
- <el-button @click="goToMapUpdate" :disabled="update_active !== 2">去部署</el-button>
|
|
|
|
|
|
+ <el-button @click="goToMapUpdate" :disabled="update_active !== 2">上传地图</el-button>
|
|
</template>
|
|
</template>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
|
|
@@ -134,6 +136,7 @@
|
|
|
|
|
|
<el-dialog
|
|
<el-dialog
|
|
v-model="worldDialogVisible"
|
|
v-model="worldDialogVisible"
|
|
|
|
+ v-if="worldDialogVisible"
|
|
title="生成world"
|
|
title="生成world"
|
|
width="400"
|
|
width="400"
|
|
:before-close="handleWorldClose"
|
|
:before-close="handleWorldClose"
|
|
@@ -167,6 +170,7 @@
|
|
|
|
|
|
<el-dialog
|
|
<el-dialog
|
|
v-model="simulationDialogVisible"
|
|
v-model="simulationDialogVisible"
|
|
|
|
+ v-if="simulationDialogVisible"
|
|
title="启动仿真测试环境"
|
|
title="启动仿真测试环境"
|
|
width="400"
|
|
width="400"
|
|
:before-close="handleSimulationClose"
|
|
:before-close="handleSimulationClose"
|
|
@@ -180,6 +184,7 @@
|
|
<el-button @click="goToDetail" :disabled="simulation_active !== 2">开启仿真配置</el-button>
|
|
<el-button @click="goToDetail" :disabled="simulation_active !== 2">开启仿真配置</el-button>
|
|
</template>
|
|
</template>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
+
|
|
<el-table stripe style="background-color: rgba(255,0,0,99%);width: 100%" border :data="tableData"
|
|
<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'}">
|
|
fixed ref="multipleTableRef" @selection-change="handleSelectionChange" :cell-style="{ textAlign: 'center'}" :header-cell-style="{ textAlign: 'center'}">
|
|
<el-table-column type="selection" width="55"/>
|
|
<el-table-column type="selection" width="55"/>
|
|
@@ -284,6 +289,10 @@ const goToTestRecord = () => {
|
|
router.push('/test_record')
|
|
router.push('/test_record')
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+const goToPgmViewer = () => {
|
|
|
|
+ router.push('/pgm_viewer')
|
|
|
|
+}
|
|
|
|
+
|
|
const handleClose = (done: () => void) => {
|
|
const handleClose = (done: () => void) => {
|
|
done()
|
|
done()
|
|
}
|
|
}
|
|
@@ -453,28 +462,47 @@ const updateMap = async () => {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
// 检查记录的mapBuf是否一致
|
|
// 检查记录的mapBuf是否一致
|
|
- const ids = multipleSelection.value.map(item => item["id"])
|
|
|
|
|
|
+ let ids = multipleSelection.value.map(item => item["id"])
|
|
console.log("ids:",ids)
|
|
console.log("ids:",ids)
|
|
const status = checkMapbufConsistency(ids)
|
|
const status = checkMapbufConsistency(ids)
|
|
if(!status) { // mapBuf不一致
|
|
if(!status) { // mapBuf不一致
|
|
ElMessage.error("所选择的记录mapBuf不一致,请重新选择!")
|
|
ElMessage.error("所选择的记录mapBuf不一致,请重新选择!")
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // 准备数据
|
|
|
|
+ const currentRow = multipleSelection.value[0]
|
|
|
|
+ const device_id = currentRow.equipmentId
|
|
|
|
+ const device_no = currentRow.equipmentNo
|
|
|
|
+ const device_name = currentRow.equipmentName
|
|
|
|
+ const device_type = currentRow.equipmentTypeName
|
|
|
|
+ const updateTime = Date.now()
|
|
|
|
+ const updateFlag = 0
|
|
|
|
+
|
|
|
|
+ console.log(device_id, device_no, device_name, device_type, device_no, updateTime, updateFlag)
|
|
|
|
+
|
|
// 开启对话框
|
|
// 开启对话框
|
|
updateDialogVisible.value = true
|
|
updateDialogVisible.value = true
|
|
await nextTick()
|
|
await nextTick()
|
|
|
|
|
|
|
|
+ // 保证相同场景id列表下载压缩包文件名一致
|
|
|
|
+ ids = ids.sort()
|
|
|
|
+
|
|
// 根据id下载地图更新需要的数据(压缩包)
|
|
// 根据id下载地图更新需要的数据(压缩包)
|
|
- const id = ids[0]
|
|
|
|
- const url = "http://localhost:8888/map/download/zip?id=" + id // 此处url不受配置的代理规则影响,应传递后端完整url地址
|
|
|
|
- const fileName = "data-" + id + ".zip"
|
|
|
|
- const savePath = "/home/cicv/work/pji_desktop/tmp_download/map_zip"
|
|
|
|
|
|
+ const idList = ids.reduce((acc, id) => {return acc + "+" + id}, "")
|
|
|
|
+ const url = "http://localhost:8888/map/download/zip?id=" + ids.flat() // 此处url不受配置的代理规则影响,应传递后端完整url地址
|
|
|
|
+
|
|
|
|
+ const fileName = "data" + idList + ".zip"
|
|
|
|
+ const savePath = "/home/cicv/work/pji_desktop/tmp_download/map_zip/"
|
|
|
|
+ const filePath = savePath + fileName
|
|
|
|
+ const containerName = " map_update_20240923"
|
|
|
|
|
|
// 开启loading
|
|
// 开启loading
|
|
- const loadingInstance = ElLoading.service({fullscreen: false, target: '.el-dialog'})
|
|
|
|
|
|
+ let loadingInstance = ElLoading.service({fullscreen: false, target: '.el-dialog', text: '依赖数据拉取中...'})
|
|
const result = await window.electronAPI.downloadFile(url, fileName, savePath, false, false, "get", {});
|
|
const result = await window.electronAPI.downloadFile(url, fileName, savePath, false, false, "get", {});
|
|
if (!result.success) { // 下载失败
|
|
if (!result.success) { // 下载失败
|
|
console.error('File download failed:', result.error);
|
|
console.error('File download failed:', result.error);
|
|
|
|
+ loadingInstance.close()
|
|
ElMessage.error("地图更新数据拉取失败!");
|
|
ElMessage.error("地图更新数据拉取失败!");
|
|
} else { // 下载成功
|
|
} else { // 下载成功
|
|
console.log('File downloaded successfully:', result.filePath);
|
|
console.log('File downloaded successfully:', result.filePath);
|
|
@@ -482,6 +510,65 @@ const updateMap = async () => {
|
|
loadingInstance.close()
|
|
loadingInstance.close()
|
|
// 更新步骤条状态
|
|
// 更新步骤条状态
|
|
update_active.value = 1
|
|
update_active.value = 1
|
|
|
|
+ console.log("Starting update map...")
|
|
|
|
+ // 执行脚本 - 生成world,启动gazebo
|
|
|
|
+ window.electronAPI.updateMap(containerName, filePath);
|
|
|
|
+ // 开启loading
|
|
|
|
+ loadingInstance = ElLoading.service({fullscreen: false, target: '.el-dialog', text: '地图更新中...'})
|
|
|
|
+ // 监听脚本执行状态
|
|
|
|
+ window.electronAPI.onUpdateMapResponse( async (event, result) => {
|
|
|
|
+ if (result.success) { // 脚本执行成功
|
|
|
|
+ console.log('Script execution completed successfully.')
|
|
|
|
+ // 关闭loading
|
|
|
|
+ loadingInstance.close()
|
|
|
|
+ // 更新步骤条状态
|
|
|
|
+ update_active.value = 2
|
|
|
|
+ // // 使用 Electron 进行文件删除操作
|
|
|
|
+ // window.electronAPI.deleteFile(fileName, savePath)
|
|
|
|
+ // // 监听删除文件的响应
|
|
|
|
+ // window.electronAPI.onDeleteFileResponse((event, response) => {
|
|
|
|
+ // if (response.success) { // 删除成功
|
|
|
|
+ // console.log("File deleted successfully.")
|
|
|
|
+ // } else { // 删除失败
|
|
|
|
+ // console.log(`Error: ${response.message}`)
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+
|
|
|
|
+ const res = await window.electronAPI.processMapUpdateFiles();
|
|
|
|
+ console.log("res", res)
|
|
|
|
+ if (res.success) {
|
|
|
|
+ let data = res.data
|
|
|
|
+ // 拼接待上传数据
|
|
|
|
+ let map_update_data = {
|
|
|
|
+ "map_id": data["jsonData"]["origin_pgm_id"],
|
|
|
|
+ "device_id": device_id,
|
|
|
|
+ "device_sn": device_no,
|
|
|
|
+ "device_name": device_name,
|
|
|
|
+ "device_type": device_type,
|
|
|
|
+ "pre_pgm_url": data["prePgmUrl"],
|
|
|
|
+ "pre_png_url": data["prePngUrl"],
|
|
|
|
+ "current_pgm_url": data["updatePgmUrl"],
|
|
|
|
+ "current_png_url": data["updatePngUrl"],
|
|
|
|
+ "update_rate": data["jsonData"]["update_perecent"],
|
|
|
|
+ "cumulative_update_rate": data["jsonData"]["origin_update_perecent"],
|
|
|
|
+ "update_time": String(updateTime),
|
|
|
|
+ "from_scene_list": "1, 2",
|
|
|
|
+ "update_flag": updateFlag
|
|
|
|
+ }
|
|
|
|
+ console.log("map_update_data", map_update_data)
|
|
|
|
+ // 上传数据
|
|
|
|
+ let response = await axios.post('/local/map/add/record', map_update_data)
|
|
|
|
+ console.log("res", response)
|
|
|
|
+ } else {
|
|
|
|
+ ElMessage.error("地图更新数据保存失败!");
|
|
|
|
+ loadingInstance.close()
|
|
|
|
+ }
|
|
|
|
+ } else { // 脚本执行过程中发生错误
|
|
|
|
+ console.error('Script execution failed.');
|
|
|
|
+ loadingInstance.close()
|
|
|
|
+ ElMessage.error("地图更新发生错误!");
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -527,13 +614,18 @@ const generateWorld = async (row) => {
|
|
console.log("Downloading file: map.bag...")
|
|
console.log("Downloading file: map.bag...")
|
|
// 开启对话框
|
|
// 开启对话框
|
|
worldDialogVisible.value = true
|
|
worldDialogVisible.value = true
|
|
-
|
|
|
|
|
|
+ // 开启loading
|
|
|
|
+ let loadingInstance = ElLoading.service({fullscreen: false, target: '.el-dialog', text: "依赖数据拉取中..."})
|
|
// 下载map.bag
|
|
// 下载map.bag
|
|
const result = await window.electronAPI.downloadFile(url, fileName, savePath, false, false, "get", {});
|
|
const result = await window.electronAPI.downloadFile(url, fileName, savePath, false, false, "get", {});
|
|
if (!result.success) { // 下载失败
|
|
if (!result.success) { // 下载失败
|
|
console.error('File download failed:', result.error);
|
|
console.error('File download failed:', result.error);
|
|
|
|
+ // 关闭loading
|
|
|
|
+ loadingInstance.close()
|
|
ElMessage.error("地图bag数据拉取失败!");
|
|
ElMessage.error("地图bag数据拉取失败!");
|
|
} else { // 下载成功
|
|
} else { // 下载成功
|
|
|
|
+ // 关闭loading
|
|
|
|
+ loadingInstance.close()
|
|
console.log('File downloaded successfully:', result.filePath);
|
|
console.log('File downloaded successfully:', result.filePath);
|
|
// 更新步骤条状态
|
|
// 更新步骤条状态
|
|
world_active.value = 1
|
|
world_active.value = 1
|
|
@@ -541,7 +633,7 @@ const generateWorld = async (row) => {
|
|
// 执行脚本 - 生成world,启动gazebo
|
|
// 执行脚本 - 生成world,启动gazebo
|
|
window.electronAPI.generateWorld(result.filePath);
|
|
window.electronAPI.generateWorld(result.filePath);
|
|
// 开启loading
|
|
// 开启loading
|
|
- const loadingInstance = ElLoading.service({fullscreen: false, target: '.el-dialog'})
|
|
|
|
|
|
+ loadingInstance = ElLoading.service({fullscreen: false, target: '.el-dialog', text: "world文件生成中..."})
|
|
// 监听脚本执行状态
|
|
// 监听脚本执行状态
|
|
window.electronAPI.onGenerateWorldResponse( (event, result) => {
|
|
window.electronAPI.onGenerateWorldResponse( (event, result) => {
|
|
if (result.success) { // 脚本执行成功
|
|
if (result.success) { // 脚本执行成功
|
|
@@ -560,6 +652,8 @@ const generateWorld = async (row) => {
|
|
})
|
|
})
|
|
} else { // 脚本执行过程中发生错误
|
|
} else { // 脚本执行过程中发生错误
|
|
console.error('Script execution failed.');
|
|
console.error('Script execution failed.');
|
|
|
|
+ // 关闭loading
|
|
|
|
+ loadingInstance.close()
|
|
ElMessage.error("world生成发生错误!");
|
|
ElMessage.error("world生成发生错误!");
|
|
}
|
|
}
|
|
})
|
|
})
|
|
@@ -607,10 +701,11 @@ const startSimulation = async (row) => {
|
|
|
|
|
|
console.log("Starting download files...")
|
|
console.log("Starting download files...")
|
|
// 开启loading
|
|
// 开启loading
|
|
- let loadingInstance = ElLoading.service({fullscreen: false, target: '.el-dialog'})
|
|
|
|
|
|
+ let loadingInstance = ElLoading.service({fullscreen: false, target: '.el-dialog', text: "依赖数据拉取中..."})
|
|
const result = await window.electronAPI.downloadFile(url, fileName, savePath, false, false, "get", {});
|
|
const result = await window.electronAPI.downloadFile(url, fileName, savePath, false, false, "get", {});
|
|
if (!result.success) { // 下载失败
|
|
if (!result.success) { // 下载失败
|
|
console.error('File download failed:', result.error);
|
|
console.error('File download failed:', result.error);
|
|
|
|
+ loadingInstance.close()
|
|
ElMessage.error("仿真测试数据拉取失败!");
|
|
ElMessage.error("仿真测试数据拉取失败!");
|
|
} else { // 下载成功
|
|
} else { // 下载成功
|
|
console.log('File downloaded successfully:', result.filePath);
|
|
console.log('File downloaded successfully:', result.filePath);
|
|
@@ -620,7 +715,7 @@ const startSimulation = async (row) => {
|
|
// // 延时
|
|
// // 延时
|
|
// setTimeout(() => {}, 500)
|
|
// setTimeout(() => {}, 500)
|
|
// 开启loading
|
|
// 开启loading
|
|
- loadingInstance = ElLoading.service({fullscreen: false, target: '.el-dialog'})
|
|
|
|
|
|
+ loadingInstance = ElLoading.service({fullscreen: false, target: '.el-dialog', text: "仿真环境准启动中..."})
|
|
// 执行脚本 - 数据准备,启动容器
|
|
// 执行脚本 - 数据准备,启动容器
|
|
window.electronAPI.startContainer(result.filePath, imageName, containerName);
|
|
window.electronAPI.startContainer(result.filePath, imageName, containerName);
|
|
// 监听脚本执行状态
|
|
// 监听脚本执行状态
|