From 68ce9382090846dc3a03a057a18a7d09f30e45e5 Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期五, 17 十月 2025 17:39:03 +0800
Subject: [PATCH] test

---
 pages/map/index.vue |  132 ++++++++++++++++++++++++++++++++------------
 1 files changed, 96 insertions(+), 36 deletions(-)

diff --git a/pages/map/index.vue b/pages/map/index.vue
index 1c35489..7c03354 100644
--- a/pages/map/index.vue
+++ b/pages/map/index.vue
@@ -394,31 +394,31 @@
 				<uni-popup-dialog type="info" cancelText="鍙栨秷" confirmText="纭畾" title="绀烘暀鏇存柊"
 					@confirm="dialogTeachingUpdateConfirm" @close="dialogTeachingUpdateClose">
 
-					<view>
-
-						<radio-group @change="radioTeachinMainRoadChange">
-							<label class="radio">
-								<radio :value="1" :checked="selectTeachingMode.main_road == 1" />涓昏矾
-							</label>
-							<label class="radio">
-								<radio :value="0" :checked="selectTeachingMode.main_road != 1" />鏀矾
-							</label>
-						</radio-group>
+					<view class="popup-dialog-content">
+						<view class="popup-content-item">
+							<radio-group @change="radioTeachinMainRoadChange">
+								<label class="radio">
+									<radio :value="1" :checked="selectTeachingMode.main_road == 1" />涓昏矾
+								</label>
+								<label class="radio">
+									<radio :value="0" :checked="selectTeachingMode.main_road != 1" />鏀矾
+								</label>
+							</radio-group>
 
 
+						</view>
+						<view class="popup-content-item">
+							<radio-group @change="radioTeachinBidirectionChange">
+								<label class="radio">
+									<radio :value="1" :checked="selectTeachingMode.bidirection == 1" />鍙屽悜
+								</label>
+								<label class="radio">
+									<radio :value="0" :checked="selectTeachingMode.bidirection != 1" />鍗曞悜
+								</label>
+							</radio-group>
+
+						</view>
 					</view>
-					<view>
-						<radio-group @change="radioTeachinBidirectionChange">
-							<label class="radio">
-								<radio :value="1" :checked="selectTeachingMode.bidirection == 1" />鍙屽悜
-							</label>
-							<label class="radio">
-								<radio :value="0" :checked="selectTeachingMode.bidirection != 1" />鍗曞悜
-							</label>
-						</radio-group>
-
-					</view>
-
 				</uni-popup-dialog>
 			</uni-popup>
 
@@ -520,6 +520,7 @@
 				unlinked: false,
 				showTeachingPathFlag: true,
 				curTeachingPathFlag: false,
+				curTeachingPathTime: 0,
 				curMapInfo: {
 					proportion: 1,
 					img_proportion: 1,
@@ -803,9 +804,7 @@
 								if (this.mapOperationStatus == 'end' || this.mapOperationStatus ==
 									'save') {
 									try {
-										//	await delTeachingMode(this.vehicleIp, [this.teachingModeCur])
-										await deleteSplitTeachingData(this.vehicleIp, this.teachingModeCur
-											.edge_name, this.teachingModeCur.name)
+										await delTeachingMode(this.vehicleIp, [this.teachingModeCur])
 
 										listDataStr.push({
 											method: "remove_teaching_path",
@@ -1193,8 +1192,9 @@
 							name: param.data?.name || "",
 							point: param.point,
 							main_road: param.data?.main_road || 0,
-							bidirection: param.data?.name || 0,
+							bidirection: param.data?.bidirection || 0,
 						}
+						console.log(this.selectTeachingMode.main_road, this.selectTeachingMode)
 					}
 					this.$refs.refPopupOperateTeaching.open("bottom")
 				} else if (param.method == "cancel_positioning_agv") {
@@ -2087,10 +2087,19 @@
 							}
 						})
 						if (list.length > 0) {
+							this.curTeachingPathTime += 1
 							this.curTeachingPathFlag = true
+							if (this.curTeachingPathTime % 5 == 0) {
+								const listStationCtxData = await this.getRefreshStationCtxData() || []
+								if (listStationCtxData.length > 0) {
+									listCtrData.push(...listStationCtxData)
+								}
+							}
 						} else {
 							if (this.curTeachingPathFlag) {
 								this.curTeachingPathFlag = false
+								this.curTeachingPathTime = 0
+
 								const teaching = await this.loadTeachingMode()
 
 								const publicOld = this.teachingMode.Public || []
@@ -2101,8 +2110,8 @@
 								const stationAdd = []
 								for (let i in publicNew) {
 									const item = publicNew[i]
-									const curIndex = publicOld.findIndex((a) => a.name == item.name)
-									console.log(curIndex, item)
+									const curIndex = publicOld.findIndex((a) => a.name == item.name && a.edge_name == item.edge_name )
+									
 									if (curIndex < 0) {
 										publicAdd.push(item)
 										publicOld.push(item)
@@ -2138,6 +2147,10 @@
 											show: this.showTeachingPathFlag
 										}
 									})
+								}
+								const listStationCtxData = await this.getRefreshStationCtxData() || []
+								if (listStationCtxData.length > 0) {
+									listCtrData.push(...listStationCtxData)
 								}
 							}
 						}
@@ -2182,7 +2195,45 @@
 				}
 
 			},
+			async getRefreshStationCtxData() {
+				try {
+					const listCtrData = []
+					const listOld = this.stationList
+					const listId = listOld.map((a) => a.stationID)
+					const stationLst = await this.loadStations()
+					const listNew = stationLst.filter((a) => {
+						return !listId.includes(a.stationID)
+					})
+					// console.log(listId.length,listNew.length,stationLst.length)
+					// console.log(listId)
+					if (listId.length + listNew.length > stationLst.length) {
+						const listId2 = stationLst.map((a) => a.stationID)
 
+						const listRemove = listOld.filter((a) => {
+							return !listId2.includes(a.stationID)
+						})
+						if (listRemove.length > 0) {
+							listCtrData.push({
+								method: "remove_station",
+								param: listRemove
+							})
+							this.stationList = stationLst
+						}
+					}
+					if (listNew.length > 0) {
+						listCtrData.push({
+							method: "add_station",
+							param: listNew
+						})
+						this.stationList = stationLst
+					}
+					return listCtrData
+				} catch (ex) {
+
+					showToast(ex)
+					return []
+				}
+			},
 			askTeachingBiDirection(teachingMode) {
 				showModal("閫夋嫨褰撳墠绀烘暀璺嚎绫诲瀷?", "绀烘暀缁撴潫", true, "鍙屽悜璺嚎",
 					"鍗曞悜璺嚎").then((res) => {
@@ -2245,9 +2296,7 @@
 						if (res) {
 							try {
 								this.loading = true
-								//await delTeachingMode(_this.vehicleIp, [_this.teachingModeCur])
-								await deleteSplitTeachingData(_this.vehicleIp, _this.teachingModeCur.edge_name,
-									_this.teachingModeCur.name)
+								await delTeachingMode(_this.vehicleIp, [_this.teachingModeCur])
 								_this.mapOperationStatus = ""
 								const listDataStr = []
 								listDataStr.push({
@@ -2378,7 +2427,8 @@
 						this.teachingModeCur.teaching_flag = 1
 						this.teachingModeCur.mode = "Public"
 						this.teachingModeCur.name = ""
-						const res = await teachingModeFlag(this.vehicleIp, this.teachingModeCur)
+						const res = await teachingModeFlag(this.vehicleIp, this
+							.teachingModeCur)
 						if (val == 1)
 							showToast("宸插皢绀烘暀鍒囨崲鎴愬弻鍚戞ā寮�)
 						else if (val == 2)
@@ -2445,7 +2495,7 @@
 				// 		param: this.selectTeachingMode,
 				// 	}])
 			},
-			radioTeachinMainRoadChange(e) {
+			radioTeachinMainRoadChange(evt) {
 				this.selectTeachingMode.main_road = evt.detail.value
 			},
 			radioTeachinBidirectionChange(evt) {
@@ -2483,7 +2533,8 @@
 					uni.showLoading({
 						title: "鍒犻櫎绀烘暀涓�
 					})
-					await deleteSplitTeachingData(this.vehicleIp, item.edge_name, item.name)
+					await deleteSplitTeachingData(this.vehicleIp, item
+						.edge_name, item.name)
 					//await delTeachingMode(this.vehicleIp, [item])
 					this.ctxDataStr =
 						JSON.stringify(
@@ -2504,8 +2555,7 @@
 					uni.showLoading({
 						title: "鍒犻櫎绀烘暀鏁版嵁涓�
 					})
-					await deleteSplitTeachingData(this.vehicleIp, data.edge_name, data.name)
-					//await delTeachingModeData(this.vehicleIp, data)
+					await delTeachingModeData(this.vehicleIp, data)
 					showToast("鍒犻櫎绀烘暀鎴愬姛")
 					this.reloadTeachingMode()
 				} catch (ex) {
@@ -2950,6 +3000,7 @@
 						height: 32px;
 						line-height: 32px;
 						text-align: center;
+						box-shadow: 0px 2px 8px 0px #0000000C;
 					}
 
 					.switch-button-checked {
@@ -2978,6 +3029,15 @@
 			background-color: transparent;
 		}
 
+		.popup-dialog-content {
+			display: flex;
+			flex-direction: column;
+
+			.popup-content-item {
+				padding: 10rpx;
+			}
+		}
+
 		.popup-content-menu {
 			margin-top: 140rpx;
 			margin-left: 225rpx;

--
Gitblit v1.9.1