From d8743368ffda9bc0fb2c6818f695a9a6b1079e57 Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期五, 19 九月 2025 18:22:15 +0800
Subject: [PATCH] laster

---
 pages/map/scene.vue |  107 ++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 68 insertions(+), 39 deletions(-)

diff --git a/pages/map/scene.vue b/pages/map/scene.vue
index 4da13fa..74d3bfd 100644
--- a/pages/map/scene.vue
+++ b/pages/map/scene.vue
@@ -17,6 +17,9 @@
 		</view>
 		<view class="content" v-show="opSceneType =='scan'">
 			<view class="fabric" :message="ctxDataStr" :change:message="ctx.receiveMsg" id="canvasMap"></view>
+			<view class="position" @click="clickVehiclePosition">
+				<text class="ico my-location-rounded"></text>
+			</view>
 		</view>
 		<view class="bottom">
 			<view class="bottom-content" v-if="opSceneType =='add_name' ">
@@ -64,6 +67,8 @@
 		showToast,
 		showModal,
 		session,
+		showError,
+		showInfo
 	} from "@/comm/utils.js"
 	import {
 		Button
@@ -94,7 +99,9 @@
 				showClearName: false,
 				mapId: "",
 				ctxDataStr: "[]",
-				localSceneList: []
+				localSceneList: [],
+				positioningAgv: true,
+				robotPos: {}
 
 			}
 		},
@@ -139,6 +146,10 @@
 				})
 				return true
 
+			} else if (this.opSceneType == "finish") {
+				const eventChannel = this.getOpenerEventChannel();
+				eventChannel.emit('create_finish', this.sceneName);
+				return false
 			} else {
 				return false
 			}
@@ -186,7 +197,7 @@
 
 				} catch (ex) {
 
-					this.showError(ex)
+					showError(ex)
 				}
 			},
 			receiveRenderData(param) {
@@ -219,6 +230,8 @@
 						})
 					}
 
+				} else if (param.method == "cancel_positioning_agv") {
+					this.positioningAgv = false
 				}
 			},
 
@@ -227,7 +240,7 @@
 					const list = session.getValue("scene_db") || []
 					return list
 				} catch (ex) {
-					this.showError(ex)
+					showError(ex)
 					return []
 				}
 			},
@@ -250,7 +263,7 @@
 						delta: 1, //杩斿洖灞傛暟锛�鍒欎笂涓婇〉
 					})
 				} catch (ex) {
-					this.showError(ex)
+					showError(ex)
 				} finally {
 					this.loading = false
 					uni.hideLoading()
@@ -286,7 +299,7 @@
 
 
 				} catch (ex) {
-					this.showError(ex)
+					showError(ex)
 					this.opSceneType = 'add_name'
 				} finally {
 					this.loading = false
@@ -349,7 +362,6 @@
 						title: "缁撴潫鍦烘櫙鏋勫缓"
 					})
 					this.opSceneType = ""
-					await createScene(this.ip, this.sceneName, 0)
 					const eventChannel = this.getOpenerEventChannel();
 					eventChannel.emit('create_finish', this.sceneName);
 					uni.navigateBack({
@@ -376,7 +388,7 @@
 					const info = await getMapLaserData(this.ip, this.mapId)
 					return info
 				} catch (ex) {
-					this.showError(ex)
+					showError(ex)
 					return {}
 				}
 			},
@@ -388,7 +400,7 @@
 
 						const listCtrData = []
 						if (data.base_map?.image_base64) {
-
+							this.robotPos = {}
 							this.mapId = data.base_map.map_id
 							listCtrData.push({
 								method: "background",
@@ -404,49 +416,56 @@
 									filedata: data.base_map.image_base64
 								}
 							})
+
+
+						}
+						listCtrData.push({
+							method: "agv_laser",
+							param: data.robot_pose
+						})
+						listCtrData.push({
+							method: "point_cloud",
+							param: data.point_cloud
+						})
+						if (this.positioningAgv) {
 							listCtrData.push({
-								method: "agv_laser",
-								param: data.robot_pose
-							})
-							listCtrData.push({
-								method: "point_cloud",
-								param: data.point_cloud
-							})
-							listCtrData.push({
-								method: "move_canvas",
+								method: "move_pt_visible",
 								param: {
 									x: data.robot_pose.x,
-									y: data.robot_pose.y
+									y: data.robot_pose.y,
+									width:50,
+									height:50,
 								}
 							})
-
-						} else {
-							listCtrData.push({
-								method: "agv_laser",
-								param: data.robot_pose
-							})
-							listCtrData.push({
-								method: "point_cloud",
-								param: data.point_cloud
-							})
 						}
+
 						this.ctxDataStr = JSON.stringify(listCtrData)
+						this.robotPos = {
+							x: data.robot_pose.x,
+							y: data.robot_pose.y
+						}
 					}
-				} catch (ex) {
-					this.showError(ex)
-				} finally {
-					// 鏃犺鎴愬姛澶辫触锛� 绉掑悗鍐嶆潵
 					setTimeout(this.refreshMapLaserData, 1000);
+				} catch (ex) {
+					showError(ex).then((res) => {
+						setTimeout(this.refreshMapLaserData, 1000);
+					})
 				}
 			},
+			async clickVehiclePosition() {
+				this.positioningAgv = true
 
-			showError(ex) {
-				console.log(ex)
-				let exStr = JSON.stringify(ex)
-				if (exStr == "{}")
-					exStr = ex
-				let tip = typeof ex.msg == "string" ? ex.msg : exStr
-				showModal(tip, "閿欒", false, "纭畾")
+				if (this.robotPos.x) {
+					this.ctxDataStr = JSON.stringify([{
+						method: "move_pt_center",
+						param: {
+							x: this.robotPos.x,
+							y: this.robotPos.y
+						}
+					}])
+				}
+
+
 			},
 
 
@@ -475,6 +494,16 @@
 				background-color: #fff;
 			}
 
+			.position {
+				position: absolute;
+				right: 50rpx;
+				bottom: 500rpx;
+
+				.ico {
+					font-size: 65rpx;
+					color: #1890FF;
+				}
+			}
 
 		}
 

--
Gitblit v1.9.1