#
whycq
2024-03-14 1a3d4450cfcde83cb430d955f48fdf1775b539ca
pages/project/jmAGV/home.vue
@@ -25,14 +25,25 @@
      </view>
      
      <view>
         <uni-popup ref="revise2" type="dialog">
         <uni-popup ref="numberPopup" type="dialog">
            <view class="popup2">
               <view>123</view>
               <view class="button-nk" @click="inHouse">2个</view>
               <view class="button-nk" @click="outHouse">4个</view>
               <view>上架数量</view>
               <view class="button-nk" @click="goUp(2)">2个</view>
               <view class="button-nk" @click="goUp(4)">4个</view>
            </view>
         </uni-popup>
      </view>
      <view>
         <uni-popup ref="numberPopup" type="dialog">
            <view class="popup2">
               <view>上架数量</view>
               <view class="button-nk" @click="goUp(2)">2个</view>
               <view class="button-nk" @click="goUp(4)">4个</view>
            </view>
         </uni-popup>
      </view>
   </view>
</template>
@@ -72,7 +83,10 @@
            btnTitle2: '',
            btnTitle3: '',
            outType: '',
            stationType: 'load'
            stationType: 'load',
            type: '' ,
            originLocal: '',
            targetLocal: '',
         }
      },
      onShow() {
@@ -96,71 +110,31 @@
            }
            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
               this.type = 'load', // 上架
               this.originLocal = this.item.code,
               this.targetLocal = this.item.traget
               this.numberPopup()
            } else {
               type = 'in' // 入库
               originLocal = this.item.code,
               targetLocal = 'KW-J'
               this.type = 'in' // 入库
               this.originLocal = this.item.code,
               this.targetLocal = 'KW-J'
               this.pakin()
            }
            // 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' })
                  }
               }
            })
         },
         downTray() {
            let _this = this
            let type = '',originLocal = '',targetLocal = '';
            if (this.item.type == 'foolr') {
               type = 'unload', // 下架
               originLocal = this.item.traget,
               targetLocal = this.item.code
               this.type = 'unload', // 下架
               this.originLocal = this.item.traget,
               this.targetLocal = this.item.code
               this.numberPopup()
            } else {
               type = 'out1' // 出库
               originLocal = 'KW-C'
               targetLocal = this.item.code
               this.type = 'out1' // 出库
               this.originLocal = 'KW-C'
               this.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
@@ -194,8 +168,53 @@
                  }
               }
            })
         },
         numberPopup() {
            this.$refs.numberPopup.open('center')
         },
         // 上 / 下 架数量
         goUp(num) {
            let data = {}
            data = {
               originLocal: this.originLocal,
               targetLocal: this.targetLocal,
               type: this.type,
               anfme: num,
            }
            this.webServer(data)
            setTimeout(()=>{
               this.$refs.numberPopup.close()
            },300)
         },
         pakin() {
            let data = {}
            data = {
               originLocal: this.originLocal,
               targetLocal: this.targetLocal,
               type: this.type,
            }
            this.webServer(data)
         },
         // 所有服务
         webServer(data) {
            let _this = this
            uni.request({
               url: `${_this.baseUrl}/agv/requestTask`,
               data: data,
               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' })
                  }
               }
            })
         }
      }
   }
</script>