|
|
@@ -37,8 +37,8 @@
|
|
|
<div class="btn btn-sm btn-outline-primary" v-if="status.barcodeDisable" @click="status.barcodeDisable=false">手动输入</div>
|
|
|
<div class="btn btn-sm btn-outline-danger" v-if="!status.barcodeDisable" @click="status.barcodeDisable=true">扫描输入</div>
|
|
|
</div>
|
|
|
- <input type="text" id="barcode" class="form-control" placeholder="扫入条码" :class="inputMode=='regular' ? '' : 'mt-2'"
|
|
|
- :disabled="status.barcodeDisable" v-model="inputting.barcode" {{-- @focusin="focusOutDocument" @focusout="focusDocument" --}}>
|
|
|
+ <input type="text" id="barcode" class="form-control"
|
|
|
+ :placeholder="status.barcodeDisable ? '扫入条码' : '输入条码'" :disabled="status.barcodeDisable" v-model="inputting.barcode" :class="inputMode=='regular' ? '' : 'mt-4'" {{-- @focusin="focusOutDocument" @focusout="focusDocument" --}}>
|
|
|
|
|
|
<div v-if="inputMode=='regular'">
|
|
|
<div class="card-title">生产日期:</div>
|
|
|
@@ -59,16 +59,16 @@
|
|
|
|
|
|
<div class="card-title">格口号:</div>
|
|
|
<input type="number" id="bin" class="form-control mt-n2 mb-2" style='height: 80px;font-size: 5em;color:red;font-weight: bolder;padding: 3px;text-align: center'
|
|
|
- {{--v-model="inputting.bin" :disabled="status.binDisable" @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter"--}}>
|
|
|
+ v-model="inputting.bin"{{-- :disabled="status.binDisable" @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter"--}}>
|
|
|
|
|
|
<div v-if="inputMode=='regular'">
|
|
|
<div class="card-title">批次号:</div>
|
|
|
<input type="text" class="form-control mb-2"
|
|
|
- {{--v-model="inputting.batch_number" @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter"--}}>
|
|
|
+ v-model="inputting.batch_number"{{-- @focusin="focusOutDocument" @focusout="focusDocument" @keyup="oninputEnter"--}}>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="col-12" v-if="status.commitButtonVisible && inputMode=='regular'" >
|
|
|
- <button class="btn btn-success btn form-control" {{--@click="commitGoods"--}}>确定</button>
|
|
|
+ <button class="btn btn-success btn form-control" @click="commitGoods">确定</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<p class="card-text text-muted mt-3 mb-n3 text-center">已完成:</p>
|
|
|
@@ -166,7 +166,10 @@
|
|
|
inputting:{
|
|
|
barcode : '',
|
|
|
amount : '',
|
|
|
+ bin : '',
|
|
|
+ batch_number : '',
|
|
|
},
|
|
|
+ goodses : [],
|
|
|
},
|
|
|
mounted(){
|
|
|
$('#container').removeClass('d-none');
|
|
|
@@ -201,10 +204,10 @@
|
|
|
this.inputMode = menuName;
|
|
|
this.inputting.barcode='';
|
|
|
if (menuName === 'regular') {
|
|
|
- this.amountDisable = false;
|
|
|
+ this.status.amountDisable = false;
|
|
|
$('#amountLabel').text('输入数量:');
|
|
|
- } else {
|
|
|
- this.amountDisable = true;
|
|
|
+ }else {
|
|
|
+ this.status.amountDisable = true;
|
|
|
$('#amountLabel').text('自动扫入数量:');
|
|
|
}
|
|
|
},
|
|
|
@@ -236,10 +239,35 @@
|
|
|
});
|
|
|
},
|
|
|
showCommitButton: function () {
|
|
|
- if(this.inputting.barcode && this.inputting.amount && this.inputting.bin_number){
|
|
|
- this.commitButtonVisible=true;
|
|
|
+ if(this.inputting.barcode && this.inputting.amount && this.inputting.bin){
|
|
|
+ if (this.status.commitButtonVisible){
|
|
|
+ this.commitGoods();
|
|
|
+ this.status.commitButtonVisible=false;
|
|
|
+ }else this.status.commitButtonVisible=true;
|
|
|
}
|
|
|
},
|
|
|
+ commitGoods: function () {
|
|
|
+ window.tempTip.setDuration(3500);
|
|
|
+ if(!this.inputting.barcode){window.tempTip.show('请扫入条码');return;}
|
|
|
+ else if(!this.inputting.amount){window.tempTip.show('请输入数量');return;}
|
|
|
+ else if(!this.inputting.bin){window.tempTip.show('请输入隔口号');return;}
|
|
|
+ this.recordOrPlusGoods();
|
|
|
+ window.tempTip.setDuration(1500);
|
|
|
+ window.tempTip.showSuccess('成功提交:' + data.inputting.barcode);
|
|
|
+ this.cleanInputs();
|
|
|
+ this.audioDing();
|
|
|
+ },
|
|
|
+ cleanInputs: function () {
|
|
|
+ this.changeToScanInputBarcode();
|
|
|
+ this.inputting.barcode='';
|
|
|
+ this.inputting.amount='';
|
|
|
+ this.inputting.bin='';
|
|
|
+ this.inputting.produce_date='';
|
|
|
+ this.inputting.valid_date='';
|
|
|
+ this.inputting.batch_number='';
|
|
|
+ this.status.commitButtonVisible=false;
|
|
|
+ this.status.binDisable=false;
|
|
|
+ },
|
|
|
autoFillBin: function () {
|
|
|
let data = this;
|
|
|
let isNotRepeatingBarcode=this.goodses.every(function(goods){
|
|
|
@@ -301,7 +329,6 @@
|
|
|
data.focusOutDocument();
|
|
|
window.tempTip.confirm('扫到其它条码,是否切换至新条码并记录?', doIt, function () {
|
|
|
data.inputting.barcode = data.lastScannedBarcode;
|
|
|
- // data.cleanInputs();
|
|
|
data.focusDocument();
|
|
|
})
|
|
|
} else {
|
|
|
@@ -379,6 +406,23 @@
|
|
|
}
|
|
|
startVibrate(500);
|
|
|
},
|
|
|
+ recordOrPlusGoods: function () {
|
|
|
+ if(this.inputMode==='regular'){
|
|
|
+ this.addGoods();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let isNotRepeating=this.goodses.every(goods => {
|
|
|
+ if(goods.barcode===this.inputting.barcode){
|
|
|
+ goods.amount=parseInt(goods.amount)+parseInt(this.inputting.amount);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ });
|
|
|
+ if(isNotRepeating)this.addGoods();
|
|
|
+ },
|
|
|
+ addGoods(){
|
|
|
+ this.goodses.unshift(JSON.parse(JSON.stringify(this.inputting)));
|
|
|
+ }
|
|
|
},
|
|
|
});
|
|
|
</script>
|