#
whycq
2024-03-13 ee52ff98eebc3a6c29ca51d1b161d4bbab1e6103
pages/project/jmAGV/home.vue
@@ -18,20 +18,21 @@
            <view class="popup">
               <view>{{text}}</view>
               <view class="button-nk" @click="upTray()">{{btnTitle1}}</view>
               <view class="button-nk" @click="downTray">{{btnTitle2}}</view>
               <view class="button-nk" @click="downTray()">{{btnTitle2}}</view>
               <view v-show="outType" class="button-nk" @click="downTray1()">{{btnTitle3}}</view>
            </view>
         </uni-popup>
      </view>
      
      <!-- <view>
      <view>
         <uni-popup ref="revise2" type="dialog">
            <view class="popup2">
               <view>123</view>
               <view class="button-nk" @click="inHouse">托盘-仓库(入库)</view>
               <view class="button-nk" @click="outHouse">仓库-托盘(出库)</view>
               <view class="button-nk" @click="inHouse">2个</view>
               <view class="button-nk" @click="outHouse">4个</view>
            </view>
         </uni-popup>
      </view> -->
      </view>
   </view>
</template>
@@ -54,21 +55,23 @@
               {name: '10号地面站',code:'10-C1',traget: '10-A1',type: 'foolr'}
            ],
            traySiteList: [
               {name: '1号托盘站',code:'1-A1',inTraget: '1-C1',type: 'tray'},
               {name: '2号托盘站',code:'2-A1',inTraget: '1-C1',type: 'tray'},
               {name: '3号托盘站',code:'3-A1',inTraget: '1-C1',type: 'tray'},
               {name: '4号托盘站',code:'4-A1',inTraget: '1-C1',type: 'tray'},
               {name: '5号托盘站',code:'5-A1',inTraget: '1-C1',type: 'tray'},
               {name: '6号托盘站',code:'6-A1',inTraget: '1-C1',type: 'tray'},
               {name: '7号托盘站',code:'7-A1',inTraget: '1-C1',type: 'tray'},
               {name: '8号托盘站',code:'8-A1',inTraget: '1-C1',type: 'tray'},
               {name: '9号托盘站',code:'9-A1',inTraget: '1-C1',type: 'tray'},
               {name: '10号托盘站',code:'10-A1',inTraget: '1-C1',type: 'tray'}
               {name: '1号托盘站',code:'KW-1',type: 'tray'},
               {name: '2号托盘站',code:'KW-2',type: 'tray'},
               {name: '3号托盘站',code:'KW-3',type: 'tray'},
               {name: '4号托盘站',code:'KW-4',type: 'tray'},
               {name: '5号托盘站',code:'KW-5',type: 'tray'},
               {name: '6号托盘站',code:'KW-6',type: 'tray'},
               {name: '7号托盘站',code:'KW-7',type: 'tray'},
               {name: '8号托盘站',code:'KW-8',type: 'tray'},
               {name: '9号托盘站',code:'KW-9',type: 'tray'},
               {name: '10号托盘站',code:'KW-10',type: 'tray'}
            ],
            item: '',
            text: '',
            btnTitle1: '',
            btnTitle2: '',
            btnTitle3: '',
            outType: '',
            stationType: 'load'
         }
      },
@@ -82,32 +85,115 @@
            this.item = item
            this.text = item.name
            if (type == 'left') {
               this.outType = false
               this.btnTitle1 = '地面站放置托盘(上架)'
               this.btnTitle2 = '托盘站取置托盘(下架)'
               this.btnTitle2 = '托盘站取置地面(下架)'
            } else {
               this.outType = true
               this.btnTitle1 = '托盘-仓库(入库)'
               this.btnTitle2 = '仓库-托盘(出库)'
               this.btnTitle2 = '仓库-空托盘(出库)'
               this.btnTitle3 = '仓库-满托盘(出库)'
            }
            this.$refs.revise.open(type)
         },
         upTray() {
            let _this = this 
            let type = '',originLocal = '',targetLocal = '';
            if (this.item.type == 'foolr') {
               type = 'load', // 上架
               originLocal = this.item.code,
               targetLocal = this.item.traget
            } else {
               type = 'in' // 入库
               originLocal = this.item.code,
               targetLocal = 'KW-J'
            }
            // this.text = originLocal + targetLocal
            uni.request({
               url: `${_this.baseUrl}/agv/inBound`,
               url: `${_this.baseUrl}/agv/requestTask`,
               data: {
                  originLocal: _this.item.code,
                  targetLocal: _this.item.traget,
                  type: 'load'
                  originLocal: originLocal,
                  targetLocal: targetLocal,
                  type: type
               },
               header: { 'token': uni.getStorageSync('token') },
               method: 'POST',
               success(res) {
                  console.log(res);
                  res = res.data
                  if (res.code === 200) {
                     this.$refs.revise.close()
                     uni.showToast({ title: '操作成功', icon: "none", position: 'top' })
                  } else {
                     uni.showToast({ title: res.msg, icon: "none", position: 'top' })
                  }
               }
            })
         },
         downTray() {
            let _this = this
            let type = '',originLocal = '',targetLocal = '';
            if (this.item.type == 'foolr') {
               type = 'unload', // 下架
               originLocal = this.item.traget,
               targetLocal = this.item.code
            } else {
               type = 'out1' // 出库
               originLocal = 'KW-C'
               targetLocal = this.item.code
            }
            uni.request({
               url: `${_this.baseUrl}/agv/requestTask`,
               data: {
                  originLocal: originLocal,
                  targetLocal: targetLocal,
                  type: type
               },
               header: { 'token': uni.getStorageSync('token') },
               method: 'POST',
               success(res) {
                  res = res.data
                  if (res.code === 200) {
                     this.$refs.revise.close()
                     uni.showToast({ title: '操作成功', icon: "none", position: 'top' })
                  } else {
                     uni.showToast({ title: res.msg, icon: "none", position: 'top' })
                  }
               }
            })
         },
         downTray1() {
            let _this = this
            let type = '',originLocal = '',targetLocal = '';
            if (this.item.type == 'foolr') {
               type = 'unload', // 下架
               originLocal = this.item.traget,
               targetLocal = this.item.code
            } else {
               type = 'out2' // 出库
               originLocal = 'KW-C'
               targetLocal = this.item.code
            }
            // this.text = originLocal + targetLocal
            uni.request({
               url: `${_this.baseUrl}/agv/requestTask`,
               data: {
                  originLocal: originLocal,
                  targetLocal: targetLocal,
                  type: type
               },
               header: { 'token': uni.getStorageSync('token') },
               method: 'POST',
               success(res) {
                  res = res.data
                  if (res.code === 200) {
                     this.$refs.revise.close()
                     uni.showToast({ title: '操作成功', icon: "none", position: 'top' })
                  } else {
                     uni.showToast({ title: res.msg, icon: "none", position: 'top' })
                  }
               }
            })
         }
         
      }
@@ -126,12 +212,13 @@
      /* margin: 1%; */
      background-color: azure;
   }
   .zcard {
   /* .zcard {
      margin: 10px 100px;
      /* background-color: blanchedalmond; */
   }
      background-color: #409EFF;
   } */
   .zcard-flex {
      /* background-color: coral; */
      margin-top: 20rpx;
      width: 100%;
      height: 100%;
      display: flex;
@@ -141,15 +228,15 @@
      align-items: center;
   }
   .button-nk {
      margin: 10rpx;
      padding: 20rpx 70rpx;
      margin: 10rpx 0rpx;
      /* padding: 20rpx 70rpx; */
      /* background-color: azure; */
      min-width: 200rpx;
      min-width: 150rpx;
      /* margin: 0 auto; */
      height: 50px;
      height: 50rpx;
      text-align: center;
      line-height: 50px;
      font-size: 20px;
      line-height: 50rpx;
      font-size: 20rpx;
      background-color: #409EFF;
      color: #ECF0F1;
      border-radius: 7px;