1
wankeda
2 天以前 844c7c3ce2c39139490a6ecb0f35170f6cade290
¼ª°²PDA/pages/stash/Syncretism.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,121 @@
<template>
   <view>
      <view class="itemstyle">
         <uni-forms label-width="180">
            <uni-forms-item label="原始托盘条码:">
               <uni-easyinput type="text" placeholder="请扫描托盘条码" ref='midInput' :focus="sourceFocus"
                  v-model="soussAddress" @input="barcodeInput" />
            </uni-forms-item>
            <uni-forms-item label="目标托盘条码:">
               <uni-easyinput type="text" placeholder="请扫描托盘条码" ref='midInput' :focus="targetFocus"
                  v-model="targetAddress" @input="barcodeInput" />
            </uni-forms-item>
            <uni-forms-item>
               <button @click="AGVTasks" type="primary" size="default" style="margin-top: 2%;">确认完成</button>
            </uni-forms-item>
         </uni-forms>
      </view>
      <u-toast ref="uToast" />
   </view>
</template>
<script>
   export default {
      data() {
         return {
            sourceFocus: true, // é»˜è®¤åŽŸå§‹æ‰˜ç›˜è¾“å…¥æ¡†èŽ·å¾—ç„¦ç‚¹
            targetFocus: false, // ç›®æ ‡æ‰˜ç›˜è¾“入框不获得焦点
            soussAddress: "",
            targetAddress: "",
            warehouseId: "",
         }
      },
      onLoad(res) {
         this.warehouseId = res.warehouseId;
      },
      methods: {
         barcodeInput(type) {
            if (type != '') {
               if (this.soussAddress == "") {
                  setTimeout(() => {
                     this.sourceFocus = false;
                     this.targetFocus = true;
                  }, 100);
               }
            }
         },
         AGVTasks() {
            if (this.soussAddress == "") {
               this.$refs.uToast.show({
                  title: "请扫描原始托盘条码",
                  type: 'error'
               })
               this.sourceFocus = true;
               this.targetFocus = false;
               return;
            }
            if (this.targetAddress == "") {
               this.$refs.uToast.show({
                  title: "请扫描目标托盘条码",
                  type: 'error'
               })
               this.sourceFocus = false;
               this.targetFocus = true;
               return;
            }
            var postDate = {
               MainData: {
                  soussAddress: this.soussAddress,
                  targetAddress: this.targetAddress,
                  warehouseId: this.warehouseId,
               }
            }
            this.$u.post('/api/InboundOrder/SYMaterielGroup', postDate).then(
               res => {
                  if (res.status) {
                     this.$refs.uToast.show({
                        title: "合托成功",
                        type: "success"
                     })
                     this.soussAddress = "";
                     this.targetAddress = "";
                     this.sourceFocus = true;
                     this.targetFocus = false;
                  } else {
                     this.$refs.uToast.show({
                        title: res.message,
                        type: "error"
                     })
                     this.sourceFocus = true;
                     this.targetFocus = false;
                  }
               })
         },
      }
   }
</script>
<style lang="scss">
   @import '@/common/uni-ui.scss';
   .content {
      display: flex;
      height: 150px;
   }
   .content-text {
      font-size: 14px;
      color: #666;
   }
   .itemstyle {
      margin-top: 30px;
      margin-left: 5%;
   }
   .headerstyle {
      width: 90%;
   }
</style>