cuiqian2004
2025-10-17 68ce9382090846dc3a03a057a18a7d09f30e45e5
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;