Refactor
This commit is contained in:
parent
d6f285211d
commit
714fd00971
@ -27,7 +27,7 @@
|
|||||||
v-model="search"
|
v-model="search"
|
||||||
@input="onInput"
|
@input="onInput"
|
||||||
:ref="'input-item-field-' + _uid"
|
:ref="'input-item-field-' + _uid"
|
||||||
@keydown.enter="onItemCreate"
|
@keydown.enter="inputEnterEvent"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
@ -324,6 +324,12 @@ export default {
|
|||||||
this.$emit('input', this.search);
|
this.$emit('input', this.search);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
inputEnterEvent(event) {
|
||||||
|
this.isItemMatched
|
||||||
|
? this.onItemSelected()
|
||||||
|
: this.onItemCreate()
|
||||||
|
},
|
||||||
|
|
||||||
async fetchMatchedItems() {
|
async fetchMatchedItems() {
|
||||||
await window.axios.get(url + '/common/items?search="' + this.search + '" limit:10')
|
await window.axios.get(url + '/common/items?search="' + this.search + '" limit:10')
|
||||||
.then(response => {
|
.then(response => {
|
||||||
@ -347,7 +353,8 @@ export default {
|
|||||||
.catch(error => {});
|
.catch(error => {});
|
||||||
},
|
},
|
||||||
|
|
||||||
onItemSelected(item) {
|
onItemSelected() {
|
||||||
|
const item = this.item_list[0]
|
||||||
const indexeditem = { ...item, index: this.currentIndex };
|
const indexeditem = { ...item, index: this.currentIndex };
|
||||||
|
|
||||||
this.addItem(indexeditem, 'oldItem');
|
this.addItem(indexeditem, 'oldItem');
|
||||||
@ -381,9 +388,7 @@ export default {
|
|||||||
tax_ids: [],
|
tax_ids: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
this.item_list.length === 1
|
this.newItems.push(item)
|
||||||
? item = this.item_list[0]
|
|
||||||
: this.newItems.push(item)
|
|
||||||
|
|
||||||
this.addItem(item, 'newItem');
|
this.addItem(item, 'newItem');
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user