扫码问题

This commit is contained in:
2024-03-13 17:01:16 +08:00
parent 406787cc09
commit dd8471def6
5 changed files with 33 additions and 21 deletions

View File

@@ -7,7 +7,6 @@
class="filter-input filter-scan-input search_input" class="filter-input filter-scan-input search_input"
ref="scaninput" ref="scaninput"
:placeholder="keyCode === '' ? placeholder : keyCode" :placeholder="keyCode === '' ? placeholder : keyCode"
:disabled="disabled"
:value="value" :value="value"
@focus="handleFocus($event)" @focus="handleFocus($event)"
@blur="handleBlur($event)" @blur="handleBlur($event)"
@@ -37,10 +36,6 @@ export default {
props: { props: {
value: String, value: String,
label: String, label: String,
focused: {
type: Boolean,
default: false
},
seaShow: { seaShow: {
type: Boolean, type: Boolean,
default: true default: true
@@ -48,10 +43,6 @@ export default {
keyCode: { keyCode: {
type: String, type: String,
default: '' default: ''
},
disabled: {
type: Boolean,
default: false
} }
}, },
data () { data () {
@@ -61,13 +52,10 @@ export default {
cur: '' cur: ''
} }
}, },
mounted () {
if (!this.focused) this.handleScan()
},
methods: { methods: {
handleScan () { handleScan () {
this.$refs.scaninput.focus() this.$refs.scaninput.focus()
this.placeholder = '请扫码键输入' this.placeholder = '请扫码键输入'
this.type = true this.type = true
this.$emit('input', '') this.$emit('input', '')
}, },
@@ -78,11 +66,11 @@ export default {
// this.$emit('input', this.cur) // this.$emit('input', this.cur)
}, },
handleFocus ($event) { handleFocus ($event) {
this.cur = $event.target.value // this.cur = $event.target.value
this.placeholder = '请扫码键输入' this.placeholder = '请扫码键输入'
this.type = false this.type = true
// $event.target.value = '' $event.target.value = ''
// this.$emit('input', $event.target.value) this.$emit('input', $event.target.value)
}, },
handleBlur ($event) { handleBlur ($event) {
this.type = '' this.type = ''

View File

@@ -4,13 +4,14 @@
<section class="content"> <section class="content">
<div class="filter-wraper"> <div class="filter-wraper">
<search-box <search-box
ref="myInput1"
label="托盘码" label="托盘码"
v-model="val1" v-model="val1"
@handleChange="handleChange1" @handleChange="handleChange1"
></search-box> ></search-box>
<search-box <search-box
ref="myInput2"
label="物料条码" label="物料条码"
:focused="true"
v-model="val2" v-model="val2"
@handleChange="handleChange2" @handleChange="handleChange2"
></search-box> ></search-box>
@@ -71,12 +72,16 @@ export default {
disabled: false disabled: false
} }
}, },
mounted () {
this.$refs.myInput1.handleScan()
},
methods: { methods: {
/** 读取托盘码 */ /** 读取托盘码 */
async _RFReadTrayStateInventory (val) { async _RFReadTrayStateInventory (val) {
try { try {
let res = await RFReadTrayStateInventory(val) let res = await RFReadTrayStateInventory(val)
if (res.ErrNO === '1') { if (res.ErrNO === '1') {
this.$refs.myInput2.handleScan()
this._RFReadTrayStorageInventory() this._RFReadTrayStorageInventory()
} else { } else {
this.toast(res.ErrMsg) this.toast(res.ErrMsg)
@@ -145,6 +150,7 @@ export default {
this.val2 = '' this.val2 = ''
this.dataList = [] this.dataList = []
this.disabled = false this.disabled = false
this.$refs.myInput1.handleScan()
} }
} }
} }

View File

@@ -4,11 +4,13 @@
<section class="content"> <section class="content">
<div class="filter-wraper"> <div class="filter-wraper">
<search-box <search-box
ref="myInput1"
label="托盘码" label="托盘码"
v-model="val1" v-model="val1"
@handleChange="handleChange1" @handleChange="handleChange1"
></search-box> ></search-box>
<search-box <search-box
ref="myInput2"
label="物料条码" label="物料条码"
:focused="true" :focused="true"
v-model="val2" v-model="val2"
@@ -86,13 +88,17 @@ export default {
disabled: false disabled: false
} }
}, },
mounted () {
this.$refs.myInput1.handleScan()
},
methods: { methods: {
/** 读取托盘码 */ /** 读取托盘码 */
async _rfReadTrayStatePackage (val) { async _rfReadTrayStatePackage (val) {
try { try {
let res = await rfReadTrayStatePackage(val) let res = await rfReadTrayStatePackage(val)
if (res.ErrNO === '1') { if (res.ErrNO === '1') {
this.toast(res.ErrMsg) // this.toast(res.ErrMsg)
this.$refs.myInput2.handleScan()
this._rfReadTrayStoragePackage() this._rfReadTrayStoragePackage()
} else { } else {
this.toast(res.ErrMsg) this.toast(res.ErrMsg)
@@ -162,6 +168,7 @@ export default {
this.dataList = [] this.dataList = []
this.active = '' this.active = ''
this.disabled = false this.disabled = false
this.$refs.myInput1.handleScan()
}, },
toggleItem () { toggleItem () {
if (!this.open) { if (!this.open) {

View File

@@ -4,6 +4,7 @@
<section class="content"> <section class="content">
<div class="filter-wraper"> <div class="filter-wraper">
<search-box <search-box
ref="myInput1"
label="托盘码" label="托盘码"
v-model="val1" v-model="val1"
@handleChange="handleChange1" @handleChange="handleChange1"
@@ -62,6 +63,9 @@ export default {
disabled: false disabled: false
} }
}, },
mounted () {
this.$refs.myInput1.handleScan()
},
methods: { methods: {
/** 读取托盘码 */ /** 读取托盘码 */
async _rfReadTrayStateUnPackage (val) { async _rfReadTrayStateUnPackage (val) {
@@ -116,6 +120,7 @@ export default {
this.val1 = '' this.val1 = ''
this.dataList = [] this.dataList = []
this.disabled = false this.disabled = false
this.$refs.myInput1.handleScan()
} }
} }
} }

View File

@@ -4,13 +4,14 @@
<section class="content"> <section class="content">
<div class="filter-wraper"> <div class="filter-wraper">
<search-box <search-box
ref="myInput1"
label="托盘码" label="托盘码"
v-model="val1" v-model="val1"
@handleChange="handleChange1" @handleChange="handleChange1"
></search-box> ></search-box>
<search-box <search-box
ref="myInput2"
label="物料条码" label="物料条码"
:focused="true"
v-model="val2" v-model="val2"
@handleChange="handleChange2" @handleChange="handleChange2"
></search-box> ></search-box>
@@ -71,12 +72,16 @@ export default {
disabled: false disabled: false
} }
}, },
mounted () {
this.$refs.myInput1.handleScan()
},
methods: { methods: {
/** 读取托盘码 */ /** 读取托盘码 */
async _RFReadTrayStatePick (val) { async _RFReadTrayStatePick (val) {
try { try {
let res = await RFReadTrayStatePick(val) let res = await RFReadTrayStatePick(val)
if (res.ErrNO === '1') { if (res.ErrNO === '1') {
this.$refs.myInput2.handleScan()
this._RFReadTrayStoragePick() this._RFReadTrayStoragePick()
} else { } else {
this.toast(res.ErrMsg) this.toast(res.ErrMsg)
@@ -145,6 +150,7 @@ export default {
this.val2 = '' this.val2 = ''
this.dataList = [] this.dataList = []
this.disabled = false this.disabled = false
this.$refs.myInput1.handleScan()
} }
} }
} }