将单据中商品的选择框改为可输入

This commit is contained in:
季圣华 2021-10-27 00:36:35 +08:00
parent 99422c7bd9
commit f517323f8b
2 changed files with 27 additions and 8 deletions

View File

@ -1,11 +1,7 @@
<template>
<div>
<a-input-search
v-model="names"
placeholder="请选择"
readOnly
@search="onSearch">
</a-input-search>
<a-input-search v-if="kind === 'material'" v-model="names" placeholder="请选择" @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-batch-modal v-if="kind === 'batch'" ref="selectModal" :modal-width="modalWidth" :rows="rows" :multi="multi" :bar-code="value" @ok="selectOK" @initComp="initComp"/>
<j-select-sn-modal v-if="kind === 'sn'" ref="selectModal" :modal-width="modalWidth" :rows="rows" :multi="multi" :bar-code="value" @ok="selectOK" @initComp="initComp"/>
@ -16,6 +12,9 @@
import JSelectMaterialModal from './modal/JSelectMaterialModal'
import JSelectBatchModal from './modal/JSelectBatchModal'
import JSelectSnModal from './modal/JSelectSnModal'
import { getMpListShort } from "@/utils/util"
import {getMaterialByBarCode} from '@/api/api'
import Vue from 'vue'
export default {
name: 'JSelectList',
@ -72,7 +71,26 @@
this.names = name
},
onSearch() {
this.$refs.selectModal.showModal()
if(this.kind === 'material') {
let param = {
barCode: this.names,
mpList: getMpListShort(Vue.ls.get('materialPropertyList')), //扩展属性
prefixNo: this.prefixNo
}
getMaterialByBarCode(param).then((res) => {
if (res && res.code === 200) {
let mList = res.data
if(mList && mList.length === 1) {
//如果条码可以查到商品则直接加载不用弹窗再选择
this.$emit("change", this.names)
} else {
this.$refs.selectModal.showModal(this.names)
}
}
})
} else {
this.$refs.selectModal.showModal()
}
},
selectOK(rows, idstr) {
console.log("选中id", idstr)

View File

@ -215,8 +215,9 @@
this.scrollTrigger = {};
}
},
showModal() {
showModal(barCode) {
this.visible = true;
this.queryParam.q = barCode
this.loadData();
this.form.resetFields();
},