licp
2024-12-03 ba1b15ac2556a322d1cea9bdd108255e0ff32048
src/components/view/b1-sample.vue
@@ -255,7 +255,11 @@
        <el-col class="search_thing" :span="24">
          <div class="search_label"><span class="required-span">* </span>样品编号:</div>
          <div class="search_input">
            <el-input v-model="sampleCode" size="small" @change="sampleCodeChange"></el-input>
            <el-input v-model="sampleCode" size="small" @change="sampleCodeChange" :disabled="sampleCodeBtnDisabled">
              <el-tooltip :content="sampleCodeBtnDisabled?'手动输入':'扫码枪输入'" placement="top" slot="append">
                <el-button type="primary" icon="el-icon-edit" @click="sampleCodeBtnDisabled=!sampleCodeBtnDisabled"></el-button>
              </el-tooltip>
            </el-input>
          </div>
        </el-col>
      </el-row>
@@ -287,7 +291,11 @@
        <el-col class="search_thing" :span="24">
          <div class="search_label"><span class="required-span">* </span>样品编号:</div>
          <div class="search_input">
            <el-input v-model="sampleCode" size="small" @change="sampleCodeChange" clearable></el-input>
            <el-input v-model="sampleCode" size="small" @change="sampleCodeChange" clearable :disabled="sampleCodeBtnDisabled">
              <el-tooltip :content="sampleCodeBtnDisabled?'手动输入':'扫码枪输入'" placement="top" slot="append">
                <el-button type="primary" icon="el-icon-edit" @click="sampleCodeBtnDisabled=!sampleCodeBtnDisabled"></el-button>
              </el-tooltip>
            </el-input>
          </div>
        </el-col>
      </el-row>
@@ -366,7 +374,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> -->
    <input  id="ScanCodeInfo0" v-model="codeInfo" @keyup.enter="keyup" style="opacity: 0;height: 0px;margin: 0px;padding: 0px;position: absolute;top: 0;"></input>
  </div>
</template>
@@ -382,6 +390,7 @@
          warehouseId: null,
          shelfId: null
        },
        sampleCodeBtnDisabled:true,
        warehouse: [],
        startTime: null,
        shelf: [],
@@ -412,39 +421,55 @@
        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)
    //     }
    //   },
    //   isEdit(newVal){
    //     if(!newVal){
    //       this.shelves = {}
    //     }
    //   }
    // },
    watch:{
      storageVisible(newVal){
        if(newVal){
            this.sampleCode = null
            // this.$message.success('扫码:打开')
            let input = document.getElementById('ScanCodeInfo0');
            input.focus();
            this.startTime = setInterval(()=>{
                input.focus()
            },1000)
        }else{
            // this.$message.warning('扫码:关闭')
            clearInterval(this.startTime)
            this.sampleCodeBtnDisabled=true
        }
      },
      exportVisible(newVal){
        if(newVal){
            // this.$message.success('扫码:打开')
            this.sampleCode = null
            let input = document.getElementById('ScanCodeInfo0');
            input.focus();
            this.startTime = setInterval(()=>{
                input.focus()
            },1000)
        }else{
            // this.$message.warning('扫码:关闭')
            clearInterval(this.startTime)
            this.sampleCodeBtnDisabled=true
        }
      },
      sampleCodeBtnDisabled(val){
        if(!val){
          this.startTime&&clearInterval(this.startTime)
        }else if(this.exportVisible||this.storageVisible){
          this.sampleCode = null
          let input = document.getElementById('ScanCodeInfo');
          input.focus();
          this.startTime = setInterval(()=>{
              input.focus()
          },1000)
        }
      },
      isEdit(newVal){
        if(!newVal){
          this.shelves = {}
        }
      }
    },
    mounted() {
      this.selectList()
    },
@@ -452,6 +477,7 @@
      keyup(e){
        var code = ''
        try{
            console.log(2222,this.codeInfo)
            code = this.codeInfo.substring()
            if(code==null||code==undefined||code==''){
                this.$message.error('该二维码有误')