解决BUG:条码选择框选商品的时候,如果已经选过则不能再切换

This commit is contained in:
神话
2022-05-05 23:59:24 +08:00
parent b2a7e83432
commit 664f50a7b5

View File

@@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<a-input-search v-if="kind === 'material'" v-model="names" placeholder="请选择" @search="onSearch"></a-input-search> <a-input-search v-if="kind === 'material'" v-model="names" placeholder="请选择" @pressEnter="onPressEnter" @search="onSearch"></a-input-search>
<a-input-search v-if="kind === 'batch'||kind === 'sn'" v-model="names" placeholder="请选择" readOnly @search="onSearch"></a-input-search> <a-input-search v-if="kind === 'batch'||kind === 'sn'" v-model="names" placeholder="请选择" readOnly @search="onSearch"></a-input-search>
<j-select-material-modal v-if="kind === 'material'" ref="selectModal" :modal-width="modalWidth" :rows="rows" :multi="multi" :bar-code="value" @ok="selectOK" @initComp="initComp"/> <j-select-material-modal v-if="kind === 'material'" ref="selectModal" :modal-width="modalWidth" :rows="rows" :multi="multi" :bar-code="value" @ok="selectOK" @initComp="initComp"/>
<j-select-batch-modal v-if="kind === 'batch'" ref="selectModal" :modal-width="modalWidth" :rows="rows" :multi="multi" :bar-code="value" @ok="selectOK" @initComp="initComp"/> <j-select-batch-modal v-if="kind === 'batch'" ref="selectModal" :modal-width="modalWidth" :rows="rows" :multi="multi" :bar-code="value" @ok="selectOK" @initComp="initComp"/>
@@ -70,7 +70,7 @@
initComp(name) { initComp(name) {
this.names = name this.names = name
}, },
onSearch() { onPressEnter() {
if(this.kind === 'material') { if(this.kind === 'material') {
let param = { let param = {
barCode: this.names, barCode: this.names,
@@ -84,6 +84,7 @@
//如果条码可以查到商品,则直接加载,不用弹窗再选择 //如果条码可以查到商品,则直接加载,不用弹窗再选择
this.$emit("change", this.names) this.$emit("change", this.names)
} else { } else {
//匹配不到进行弹窗
this.$refs.selectModal.showModal(this.names) this.$refs.selectModal.showModal(this.names)
} }
} }
@@ -92,6 +93,14 @@
this.$refs.selectModal.showModal() this.$refs.selectModal.showModal()
} }
}, },
onSearch() {
if(this.kind === 'material') {
//直接进行弹窗
this.$refs.selectModal.showModal(this.names)
} else {
this.$refs.selectModal.showModal()
}
},
selectOK(rows, idstr) { selectOK(rows, idstr) {
console.log("选中id", idstr) console.log("选中id", idstr)
if (!rows) { if (!rows) {