cuiqian2004
2025-09-19 d8743368ffda9bc0fb2c6818f695a9a6b1079e57
pages/teaching/index.vue
@@ -150,7 +150,9 @@
<script>
   import {
      showToast,
      showModal
      showModal,
      showError,
      showInfo
   } from "@/comm/utils.js"
   import {
      Button
@@ -284,7 +286,7 @@
            } catch (ex) {
               this.showError(ex)
               showError(ex)
            }
         },
         async loadAgvState() {
@@ -292,7 +294,7 @@
               const info = await getAgvState(this.ip)
               return info
            } catch (ex) {
               this.showError(ex)
               showError(ex)
               return {}
            }
         },
@@ -301,7 +303,7 @@
               const info = await stations(this.ip)
               return info.station_list || []
            } catch (ex) {
               this.showError(ex)
               showError(ex)
               return []
            }
         },
@@ -367,7 +369,7 @@
               }
            } catch (ex) {
               this.showError(ex)
               showError(ex)
            }
         },
@@ -379,21 +381,14 @@
                     this.calibratioStationType = "end"
                     this.$refs.refPopupCalibration.open()
                  } else {
                     this.teachingModeCur.teaching_flag = 0
                     await teachingModeFlag(this.ip, this.teachingModeCur)
                     this.teachingMode = await getTeachingMode(this.ip)
                     this.teachingStatus = "end"
                     this.askTeachingBiDirection(this.teachingModeCur)
                  }
               } else {
                  this.teachingModeCur.teaching_flag = 0
                  await teachingModeFlag(this.ip, this.teachingModeCur)
                  this.teachingMode = await getTeachingMode(this.ip)
                  this.teachingStatus = "end"
                  this.askTeachingBiDirection(this.teachingModeCur)
               }
            } catch (ex) {
               this.showError(ex)
               showError(ex)
            }
         },
@@ -412,7 +407,7 @@
               }
            } catch (ex) {
               this.showError(ex)
               showError(ex)
            }
         },
         async clickTeachingStart() {
@@ -440,7 +435,7 @@
                              stationTeaching.splice(curIndex, 1)
                              _this.teachingStart("Stations")
                           } catch (ex) {
                              this.showError(ex)
                              showError(ex)
                           }
                        } else {
@@ -459,7 +454,7 @@
               }
            } catch (ex) {
               this.showError(ex)
               showError(ex)
            }
         },
         clickTeachingEnd() {
@@ -480,7 +475,7 @@
                     _this.teachingMode = await getTeachingMode(_this.ip)
                  } catch (ex) {
                     this.showError(ex)
                     showError(ex)
                  }
               } else {
                  _this.teachingStatus = "save"
@@ -492,7 +487,7 @@
            this.teachingStatus = "save"
            try {} catch (ex) {
               this.showError(ex)
               showError(ex)
            }
         },
@@ -639,14 +634,12 @@
                     list[curIndex].y = infoAgv.y
                  }
                  this.teachingStatus = "end"
                  this.teachingModeCur.teaching_flag = 0
                  await teachingModeFlag(this.ip, this.teachingModeCur)
                  this.teachingMode = await getTeachingMode(this.ip)
                  this.askTeachingBiDirection(this.teachingModeCur)
               }
            } catch (ex) {
               this.showError(ex)
               showError(ex)
            }
         },
         async clickNoCalibration() {
@@ -667,27 +660,38 @@
               } else if (this.calibratioStationType == "end") {
                  this.teachingModeCur.teaching_flag = 0
                  await teachingModeFlag(this.ip, this.teachingModeCur)
                  this.teachingMode = await getTeachingMode(this.ip)
                  this.askTeachingBiDirection(this.teachingModeCur)
               }
            } catch (ex) {
               this.showError(ex)
               showError(ex)
            }
         },
         askTeachingBiDirection(teachingMode) {
            showModal("是否将当前示教路线设置为双向?", "示教结束").then((res) => {
               if (res) {
                  teachingMode.bidirection = "1"
               } else {
                  teachingMode.bidirection = "0"
               }
               teachingMode.teaching_flag = 0
               this.finishTeaching(teachingMode)
            })
         },
         async finishTeaching(teachingMode) {
            try {
               await teachingModeFlag(this.ip, teachingMode)
               this.teachingMode = await getTeachingMode(this.ip)
               this.teachingStatus = "end"
            } catch (ex) {
               showError(ex)
            }
         },
         clickBackTeaching() {
            this.$refs.refPopupCalibration.close()
            this.teachingStatus = ""
         },
         showError(ex) {
            let exStr = JSON.stringify(ex)
            if (exStr == "{}")
               exStr = ex
            let tip = typeof ex.msg == "string" ? ex.msg : exStr
            showModal(tip, "错误", false)
         },
      }
   }