licp
2024-09-02 811bbc3feb318238214d022cb3a7458176f28e55
src/components/view/b1-sample.vue
@@ -222,7 +222,7 @@
                  effect="dark"
                  placement="top"
                  v-for="(n,j) in m.samples"
                  :key="j" :disabled="`${n.sample}${n.model}`.length<10">
                  :key="j" :disabled="`${n.sample}${n.model}`.length<5">
                    <div slot="content"><span>{{ n.sample }}</span>
                      <span>&nbsp;({{ n.model }})&nbsp;[{{ n.sampleCode }}]</span></div>
                    <li class="green"
@@ -366,6 +366,7 @@
        <el-button type="primary" @click="confirmShelves" :loading="upLoadShelves">确 定</el-button>
      </span>
    </el-dialog>
    <input type="password" id="ScanCodeInfo" v-model="codeInfo" @keyup.enter="keyup" style="opacity: 0;height: 0px;margin: 0px;padding: 0px;position: absolute;top: 0;"></input>
  </div>
</template>
@@ -382,6 +383,7 @@
          shelfId: null
        },
        warehouse: [],
        startTime: null,
        shelf: [],
        storageList:[],
        storageVisible: false,
@@ -406,13 +408,64 @@
        tableLoading:false,
        sampleCode:'',
        currentId:null,
        searchSampleCode:''
        searchSampleCode:'',
        codeInfo:null,
      }
    },
    watch:{
      storageVisible(newVal){
        if(newVal){
            // this.$message.success('扫码:打开')
            let input = document.getElementById('ScanCodeInfo');
            input.focus();
            this.startTime = setInterval(()=>{
                input.focus()
            },1000)
        }else{
            // this.$message.warning('扫码:关闭')
            clearInterval(this.startTime)
        }
      },
      exportVisible(newVal){
        if(newVal){
            // this.$message.success('扫码:打开')
            let input = document.getElementById('ScanCodeInfo');
            input.focus();
            this.startTime = setInterval(()=>{
                input.focus()
            },1000)
        }else{
            // this.$message.warning('扫码:关闭')
            clearInterval(this.startTime)
        }
      },
    },
    mounted() {
      this.selectList()
    },
    methods: {
      keyup(e){
        var code = ''
        var str = {}
        var that = this;
        console.log(3333,this.codeInfo)
        try{
            code = JSON.parse(this.codeInfo)
            if(code.moNo2==null||code.moNo2==undefined||code.moNo2==''){
                this.$message.error('该二维码有误')
            }else{
                str = {
                    moNo2: code.moNo2,
                }
                // if(this.storageVisible){
                // }else if(this.exportVisible){}
                this.sampleCode = code.moNo2
            }
        }catch(e){
            this.$message.error('该二维码有误')
        }
        this.codeInfo = null
      },
      selectList() {
        this.$axios.get(this.$api.warehouse.selectWarehouse).then(res => {
          this.warehouse = res.data