#
zjj
2025-09-23 97486704c3d2d230fa0be89630f0fe950554b16b
pages/AGV/AGVStart.vue
@@ -1,19 +1,19 @@
<template>
   <view>
      <view class="code">
         <view class="item">
            <view class="code-decs">楼号:</view>
            <uni-combox :candidates="floorList" placeholder="请选择楼号" v-model="floor" @input="getFloor"></uni-combox>
         </view>
      <view class="code">
         <view class="item">
            <view class="code-decs">暂存位:</view>
            <input type="text" placeholder=" 扫码 / 输入" v-model="stationCode" :focus="stationCodeFocus"
               @input="stationCodeInput()">
            @input="stationCodeInput()"   >
         </view>
         <view class="item">
            <view class="code-decs">入库站:</view>
            <uni-combox :candidates="staList" placeholder="请选择站点"  v-model="sta"></uni-combox>
         </view>
      </view>
      
      <view class="mat-list-title">
         <view style="-webkit-flex: 1;flex: 1;">站点列表</view>
         <view style="-webkit-flex: 1;flex: 1;"></view>
      </view>
      <scroll-view>
         <view class="list" v-for="(item,i) in dataList" :key="i" :class="'bg-'+item.color">
@@ -32,7 +32,7 @@
      <!-- 底部操作按钮 -->
      <view class="buttom">
         <button size="mini" @click="reset('warn')">重置</button>
         <button size="mini" type="primary" @click="combConfirm('warn')">启动</button>
         <button size="mini" type="primary" @click="combConfirm('warn')" :disabled="isDisabled">启动</button>
      </view>
      <!-- 弹窗 -->
      <!-- 修改数量 -->
@@ -126,7 +126,10 @@
            removeNum: 0,
            floorList: [1,3],
            floor: "",
            devNo: []
            devNo: [],
            staList:[],
            sta:'',
            isDisabled:false
         }
      },
      onLoad() {
@@ -138,19 +141,30 @@
      methods: {
         stationCodeInput() {
            setTimeout(() => {
               var len = this.stationCode.length
               if (len != 15) {
                  this.stationCode = ''
                  this.stationCodeFocus = true
                  uni.showToast({
                     title: '暂存码有误请重试',
                     icon: "none",
                     position: 'top'
                  });
                  return;
               console.log(this.stationCode.substring(0,1))
               this.staList=[]
               this.sta = ''
               if(this.stationCode.substring(0,1) == 'a'){
                  this.staList.push(1040)
                  this.sta = 1040
               }else if(this.stationCode.substring(0,1) == 'b'){
                  this.staList.push(2010)
                  // this.staList.push(2000)
                  this.sta = 2010
               }else if(this.stationCode.substring(0,1) == 'c'){
                  this.staList.push(3010)
                  this.sta = 3010
               }else if(this.stationCode.substring(0,1) == 'd'){
                  this.staList.push(2000)
                  this.sta = 2000
               }else if(this.stationCode.substring(0,1) == 'e'){
                  this.staList.push(1000)
                  this.staList.push(1035)
                  this.sta = 1035
               }
               this.pushDevNo()
               this.stationCodeFocuss()
            }, 200)
         },
         pushDevNo() {
@@ -221,7 +235,7 @@
               }
            });
         },
         messageToggle(type) {
         messageToggle(type) {
            this.msgType1 = type
            this.$refs.message.open()
         },
@@ -423,44 +437,58 @@
         combClose() {
            this.$refs.combConfirm.close()
         },
         comb() {
            this.devNo = []
            uni.vibrateShort();
         comb() {
            let that = this;
            for (var i = 0; i < this.dataList.length; i++) {
               if (this.dataList[i].checked) {
                  this.devNo.push(this.dataList[i].devNo)
               }
            that.isDisabled = true
            if (that.stationCode === '') {
               this.messageText = "请扫描暂存位条码"
               this.messageToggle('error')
               that.isDisabled = false
               return;
            }
            uni.request({
               url: that.baseUrl + '/agvMobile/pakin/auth',
               data: JSON.stringify({
                  devNo: that.devNo
               }),
               method: 'POST',
               header: {
                  'token': uni.getStorageSync('token')
               },
               success(result) {
                  var res = result.data
                  if (res.code === 200) {
                     that.resst();
                     that.messageText = "启动成功"
                     that.messageToggle('success')
                  } else if (res.code == 403) {
                     that.messageText = res.msg
               uni.request({
                  url: that.baseUrl + '/mobile/agv/start',
                  data: JSON.stringify({
                     sta: that.stationCode,
                     inSta: that.sta
                  }),
                  method: 'POST',
                  header: {
                     'token': uni.getStorageSync('token')
                  },
                  success(result) {
                     var res = result.data
                     if (res.code === 200) {
                        that.resst();
                        that.messageText = "启动成功"
                        that.messageToggle('success')
                     } else if (res.code == 403) {
                        that.messageText = res.msg
                        that.messageToggle('error')
                        setTimeout(() => {
                           uni.reLaunch({
                              url: '../login/login'
                           });
                        }, 1000);
                     } else {
                        that.messageText = res.msg
                        that.messageToggle('error')
                     }
                  },
                  fail: () => {
                     that.messageText = "接口超时"
                     that.messageToggle('error')
                     setTimeout(() => {
                        uni.reLaunch({
                           url: '../login/login'
                        });
                     }, 1000);
                  } else {
                     that.messageText = res.msg
                     that.messageToggle('error')
                  },
                  complete(){
                     that.isDisabled = false
                  }
               }
            });
               });
         },
         reset(type) {
            this.msgType = type
@@ -482,8 +510,8 @@
         },
         // 清空
         resst() {
            this.dataList = []
            this.barcode = ''
            this.staList = []
            this.sta = ''
            this.stationCode = ''
            this.floor = ''
            this.barcodeFocuss()
@@ -553,7 +581,7 @@
   .mat-list-title {
      display: flex;
      align-items: center;
      height: 80rpx;
      height: 30rpx;
      width: 100%;
      background-color: white;
      position: fixed;