From bcfb05f5e7782ef23e4deb1b38a1ca4b4085181a Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期六, 11 十月 2025 17:09:47 +0800
Subject: [PATCH] test
---
pages/map/scene.vue | 127 ++++++++++++++++++++---------------------
1 files changed, 62 insertions(+), 65 deletions(-)
diff --git a/pages/map/scene.vue b/pages/map/scene.vue
index 8f93cbf..aa7af12 100644
--- a/pages/map/scene.vue
+++ b/pages/map/scene.vue
@@ -43,7 +43,8 @@
<view class="bottom-content" v-else-if="opSceneType =='scan'">
<view class="tip">鍦烘櫙鏋勫缓涓�/view>
<view>
- 璇锋搷浣滄惉杩愯溅鎵弿鍦板浘瑕嗙洊鐨勫尯鍩�+ <!-- 璇锋搷浣滄惉杩愯溅鎵弿鍦板浘瑕嗙洊鐨勫尯鍩�-->
+ {{mapServerPhase=== 1 ?"鍦烘櫙鏋勫缓鏈嶅姟锛氭湭鍚姩":mapServerPhase===2 ?"鍦烘櫙鏋勫缓鏈嶅姟锛氬惎鍔ㄤ腑":mapServerPhase===3 ?"鍦烘櫙鏋勫缓涓�:mapServerPhase}}
</view>
<view class="text-button-group">
@@ -51,13 +52,17 @@
</view>
</view>
<view class="bottom-content" v-else-if="opSceneType =='finish'">
- <view class="tip"> 鈥渰{sceneName}}鈥漿{opType == "extend"?"鍦烘櫙鎵╁睍瀹屾垚"+"":"鍦烘櫙鏋勫缓瀹屾垚"}}</view>
- <!-- <view> 宸叉垚鍔熸瀯寤衡�{{sceneName}}鈥�/view> -->
- <view class="loading-view">{{saveMapIsOk?"鏋勫浘淇濆瓨瀹屾垚":"绛夊緟鏋勫浘淇濆瓨瀹屾垚..."}}
- <view v-if="!saveMapIsOk" class="auto-circle"></view>
+ <view class="tip"> 鈥渰{sceneName}}鈥漿{opType == "extend"?"鍦烘櫙鎵╁睍缁撴潫"+"":"鍦烘櫙鏋勫缓缁撴潫"}}</view>
+ <!-- <view> 宸叉垚鍔熸瀯寤衡�{{sceneName}}鈥�/view> -->
+ <view class="loading-view">
+ 鏋勫浘鐘舵�锛歿{mapServerPhase===5?"淇濆瓨鎴愬姛":mapServerPhase===4?"淇濆瓨涓�:mapServerPhase===6?"淇濆瓨澶辫触":mapServerPhase}}
+ <view v-if="mapServerPhase === 4" class="auto-circle"></view>
</view>
<view class="text-button-group">
- <a-button type="primary" class="button" :disabled=" !saveMapIsOk || loading" @click="clickFinish">{{opType == "extend"?"鎵╁睍瀹屾垚":"鏋勫缓瀹屾垚"}}</a-button>
+ <a-button type="primary" class="button" v-if="mapServerPhase === 6"
+ @click="clickRecreate">{{opType == "extend"?"閲嶇幇鎵╁睍":"閲嶇幇鏋勫缓"}}</a-button>
+ <a-button type="primary" class="button" v-else :disabled=" mapServerPhase !==5 || loading"
+ @click="clickFinish">{{opType == "extend"?"鎵╁睍瀹屾垚":"鏋勫缓瀹屾垚"}}</a-button>
</view>
</view>
</view>
@@ -81,13 +86,15 @@
createScene,
addMap,
stopMap,
+ delScene,
//getAgvState,
getMapLaserData,
saveDBData,
- checkMapServerIsStart,
- startOrStopMapServer,
- checkMapServerIsOk,
- checkSaveMapIsOk,
+ // checkMapServerIsStart,
+ // startOrStopMapServer,
+ // checkMapServerIsOk,
+ // checkSaveMapIsOk,
+ getMapServerPhase,
getMapUrl
} from "@/api/vehicle.js"
@@ -110,7 +117,7 @@
localSceneList: [],
positioningAgv: true,
robotPos: {},
- mapserverIsOk: false,
+ mapServerPhase: 1,
extendBase64Img: "",
saveMapIsOk: false,
destroyFlag: false,
@@ -210,7 +217,6 @@
async loadData() {
try {
- // this.loadMapServerState()
if (this.opType == "") {
this.localSceneList = await this.loadLocalScene()
} else {
@@ -218,7 +224,9 @@
this.opSceneType = "add_name"
}
if (this.opType == "extend") {
+ this.mapServerPhase = 1
await addMap(this.ip, this.sceneName, "extend")
+ this.checkMapServerPhase()
this.opSceneType = 'scan'
}
// if (this.opType == "extend") {
@@ -234,6 +242,7 @@
// }
}
+
this.refreshMapLaserData()
@@ -251,58 +260,22 @@
return {}
}
},
- async loadMapServerState() {
+ async checkMapServerPhase() {
try {
- this.mapserverIsOk = false
- const res = await checkMapServerIsStart(this.ip)
- if (res) {
- this.mapserverIsOk = true
- } else {
- this.mapserverIsOk = false
- const res = await startOrStopMapServer(this.ip, 1)
- if (res) {
- this.checkMapServerState()
- }
+ const res = await getMapServerPhase(this.ip)
+ this.mapServerPhase = res || 1
+ if (this.mapServerPhase === 3) {
+ return
}
- } catch (ex) {
-
- showError(ex)
- }
- },
-
- async checkMapServerState() {
- try {
-
- const res = await checkMapServerIsOk(this.ip)
- if (res) {
- this.mapserverIsOk = true
- } else {
- this.mapserverIsOk = false
- setTimeout(this.checkMapServerState, 1000);
- }
-
- } catch (ex) {
- showError(ex).then((res) => {
- setTimeout(this.checkMapServerState, 1000);
- })
- }
- },
- async checkSaveMapState() {
- try {
-
- const res = await checkSaveMapIsOk(this.ip)
- if (res) {
+ if (this.mapServerPhase === 5 || this.mapServerPhase === 6) {
this.saveMapIsOk = true
- } else {
- this.saveMapIsOk = false
- setTimeout(this.checkSaveMapState, 1000);
+ return
}
-
+ setTimeout(this.checkMapServerPhase, 1000);
} catch (ex) {
- showError(ex).then((res) => {
- setTimeout(this.checkSaveMapState, 1000);
- })
+ showToast(ex)
+ setTimeout(this.checkMapServerPhase, 1000);
}
},
@@ -380,8 +353,11 @@
},
async clickStartConstructScene() {
try {
+ this.mapId = ""
if (this.opType == "extend") {
+ this.mapServerPhase = 1
await addMap(this.ip, this.sceneName, "extend")
+ this.checkMapServerPhase()
this.opSceneType = 'scan'
} else {
this.opSceneType = "add_name"
@@ -435,9 +411,11 @@
this.sceneName = name
await createScene(this.ip, name, 1)
await addMap(this.ip, name)
+ this.checkMapServerPhase()
uni.showLoading({
title: "寮�鎵弿鍦板浘"
})
+ this.mapId = ""
this.opSceneType = 'scan'
@@ -473,8 +451,8 @@
})
this.saveMapIsOk = false
await stopMap(this.ip, this.sceneName)
- // await startOrStopMapServer(this.ip, 2)
- // this.checkSaveMapState();
+ this.mapServerPhase = 4
+ this.checkMapServerPhase();
// if (this.opType == "extend") {
// this.opSceneType = ""
// const eventChannel = this.getOpenerEventChannel();
@@ -483,13 +461,12 @@
// delta: 1, //杩斿洖灞傛暟锛�鍒欎笂涓婇〉
// })
// }
- setTimeout(() => {this.saveMapIsOk = true}, 5000);
-
+
} catch (ex) {
console.log(ex)
showModal("璇锋鏌ヨ溅杈嗚繛鎺ワ紝骞堕噸鏂板紑濮嬫瀯寤哄満鏅�, "鍦烘櫙鏋勫缓澶辫触", false, "纭畾").then((res) => {
this.opSceneType = ''
- // this.loadMapServerState()
+
})
} finally {
this.loading = false
@@ -516,9 +493,28 @@
this.loading = false
uni.hideLoading()
}
-
-
},
+ async clickRecreate() {
+ try {
+ if (this.opType == "extend") {
+ this.mapServerPhase = 1
+ await addMap(this.ip, this.sceneName, "extend")
+ this.checkMapServerPhase()
+ this.opSceneType = 'scan'
+ } else {
+ this.mapServerPhase = 1
+ await delScene(this.ip, this.sceneName)
+ await createScene(this.ip, this.sceneName, 1)
+ await addMap(this.ip, this.sceneName)
+ this.checkMapServerPhase()
+ this.opSceneType = 'scan'
+ }
+ } catch (ex) {
+ console.log(ex)
+ }
+ },
+
+
async loadMapLaserData() {
try {
const info = await getMapLaserData(this.ip, this.mapId)
@@ -600,6 +596,7 @@
}
}
}
+
setTimeout(this.refreshMapLaserData, 1000);
} catch (ex) {
showToast(ex)
--
Gitblit v1.9.1