优化单据中商品条码的模糊匹配
This commit is contained in:
@@ -53,6 +53,7 @@ const editMaterial = (params)=>putAction("/material/update",params);
|
||||
const checkMaterial = (params)=>getAction("/material/checkIsExist",params);
|
||||
const getMaterialBySelect = (params)=>getAction("/material/findBySelect",params);
|
||||
const getSerialMaterialBySelect = (params)=>getAction("/material/getMaterialEnableSerialNumberList",params);
|
||||
const getMaterialByParam = (params)=>getAction("/material/getMaterialByParam",params);
|
||||
const getMaterialByBarCode = (params)=>getAction("/material/getMaterialByBarCode",params);
|
||||
const getMaxBarCode = (params)=>getAction("/material/getMaxBarCode",params);
|
||||
const checkMaterialBarCode = (params)=>getAction("/materialsExtend/checkIsBarCodeExist",params);
|
||||
@@ -149,6 +150,7 @@ export {
|
||||
checkMaterial,
|
||||
getMaterialBySelect,
|
||||
getSerialMaterialBySelect,
|
||||
getMaterialByParam,
|
||||
getMaterialByBarCode,
|
||||
getMaxBarCode,
|
||||
checkMaterialBarCode,
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
<template>
|
||||
<div>
|
||||
<a-input-search v-if="kind === 'material'" v-model="names" placeholder="条码|名称并回车" @pressEnter="onPressEnter" @search="onSearch"></a-input-search>
|
||||
<a-input-group v-if="kind === 'material'" compact style="width:100%">
|
||||
<a-select placeholder="条码|名称" :dropdownMatchSelectWidth="false" showSearch :showArrow="false"
|
||||
v-model="names" optionFilterProp="children" style="width:80%"
|
||||
@search="handleSearch" @change="handleChange">
|
||||
<a-select-option v-for="item in materialData" :key="item.barCode">
|
||||
{{ item.materialStr }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
<a-button icon="search" @click="onSearch" />
|
||||
</a-input-group>
|
||||
<a-input-search v-if="kind === 'batch'||kind === 'sn'||kind === 'snAdd'" v-model="names" placeholder="请点开弹窗" readOnly @search="onSearch"></a-input-search>
|
||||
<j-select-material-modal v-if="kind === 'material'" ref="selectModal" :rows="rows" :multi="multi" :bar-code="value" @ok="selectOK" @initComp="initComp"/>
|
||||
<j-select-batch-modal v-if="kind === 'batch'" ref="selectModal" :rows="rows" :multi="multi" :bar-code="value" @ok="selectOK" @initComp="initComp"/>
|
||||
@@ -14,9 +23,7 @@
|
||||
import JSelectBatchModal from './modal/JSelectBatchModal'
|
||||
import JSelectSnModal from './modal/JSelectSnModal'
|
||||
import JSelectSnAddModal from './modal/JSelectSnAddModal'
|
||||
import { getMpListShort } from "@/utils/util"
|
||||
import {getMaterialByBarCode} from '@/api/api'
|
||||
import Vue from 'vue'
|
||||
import { getMaterialByParam } from '@/api/api'
|
||||
|
||||
export default {
|
||||
name: 'JSelectList',
|
||||
@@ -49,6 +56,7 @@
|
||||
return {
|
||||
ids: "",
|
||||
names: "",
|
||||
materialData: [],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@@ -65,38 +73,20 @@
|
||||
},
|
||||
methods: {
|
||||
initComp(name) {
|
||||
this.names = name
|
||||
},
|
||||
onPressEnter() {
|
||||
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()
|
||||
}
|
||||
this.names = name?name:'输入条码或名称'
|
||||
},
|
||||
onSearch() {
|
||||
if(this.kind === 'material') {
|
||||
//直接进行弹窗
|
||||
this.$refs.selectModal.showModal(this.names)
|
||||
} else {
|
||||
this.$refs.selectModal.showModal()
|
||||
}
|
||||
this.$refs.selectModal.showModal()
|
||||
},
|
||||
handleSearch(value) {
|
||||
getMaterialByParam({q: value}).then((res) => {
|
||||
if (res && res.code === 200) {
|
||||
this.materialData = res.data
|
||||
}
|
||||
})
|
||||
},
|
||||
handleChange(value) {
|
||||
this.$emit("change", value)
|
||||
},
|
||||
selectOK(rows, idstr) {
|
||||
console.log("选中id", idstr)
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
||||
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||
},
|
||||
{ title: '条码', key: 'barCode', width: '10%', type: FormTypes.popupJsh, kind: 'material', multi: true,
|
||||
{ title: '条码', key: 'barCode', width: '12%', type: FormTypes.popupJsh, kind: 'material', multi: true,
|
||||
validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||
},
|
||||
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
||||
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||
},
|
||||
{ title: '条码', key: 'barCode', width: '10%', type: FormTypes.popupJsh, kind: 'material', multi: true,
|
||||
{ title: '条码', key: 'barCode', width: '12%', type: FormTypes.popupJsh, kind: 'material', multi: true,
|
||||
validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||
},
|
||||
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
||||
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||
},
|
||||
{ title: '条码', key: 'barCode', width: '10%', type: FormTypes.popupJsh, kind: 'material', multi: true,
|
||||
{ title: '条码', key: 'barCode', width: '12%', type: FormTypes.popupJsh, kind: 'material', multi: true,
|
||||
validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||
},
|
||||
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
||||
|
||||
@@ -160,7 +160,7 @@
|
||||
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
||||
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||
},
|
||||
{ title: '条码', key: 'barCode', width: '10%', type: FormTypes.popupJsh, kind: 'material', multi: true,
|
||||
{ title: '条码', key: 'barCode', width: '12%', type: FormTypes.popupJsh, kind: 'material', multi: true,
|
||||
validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||
},
|
||||
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
||||
|
||||
@@ -160,7 +160,7 @@
|
||||
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
||||
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||
},
|
||||
{ title: '条码', key: 'barCode', width: '10%', type: FormTypes.popupJsh, kind: 'material', multi: true,
|
||||
{ title: '条码', key: 'barCode', width: '12%', type: FormTypes.popupJsh, kind: 'material', multi: true,
|
||||
validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||
},
|
||||
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
||||
|
||||
@@ -231,7 +231,7 @@
|
||||
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
||||
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||
},
|
||||
{ title: '条码', key: 'barCode', width: '10%', type: FormTypes.popupJsh, kind: 'material', multi: true,
|
||||
{ title: '条码', key: 'barCode', width: '12%', type: FormTypes.popupJsh, kind: 'material', multi: true,
|
||||
validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||
},
|
||||
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
||||
|
||||
@@ -257,7 +257,7 @@
|
||||
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
||||
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||
},
|
||||
{ title: '条码', key: 'barCode', width: '10%', type: FormTypes.popupJsh, kind: 'material', multi: true,
|
||||
{ title: '条码', key: 'barCode', width: '12%', type: FormTypes.popupJsh, kind: 'material', multi: true,
|
||||
validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||
},
|
||||
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
||||
|
||||
@@ -227,7 +227,7 @@
|
||||
loading: false,
|
||||
dataSource: [],
|
||||
columns: [
|
||||
{ title: '条码', key: 'barCode', width: '10%', type: FormTypes.popupJsh, kind: 'material', multi: true,
|
||||
{ title: '条码', key: 'barCode', width: '12%', type: FormTypes.popupJsh, kind: 'material', multi: true,
|
||||
validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||
},
|
||||
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
||||
|
||||
@@ -219,7 +219,7 @@
|
||||
{ title: '仓库名称', key: 'depotId', width: '10%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
||||
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||
},
|
||||
{ title: '条码', key: 'barCode', width: '14%', type: FormTypes.popupJsh, kind: 'material', multi: true,
|
||||
{ title: '条码', key: 'barCode', width: '16%', type: FormTypes.popupJsh, kind: 'material', multi: true,
|
||||
validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||
},
|
||||
{ title: '名称', key: 'name', width: '10%', type: FormTypes.normal },
|
||||
|
||||
@@ -231,7 +231,7 @@
|
||||
{ title: '仓库名称', key: 'depotId', width: '10%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
||||
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||
},
|
||||
{ title: '条码', key: 'barCode', width: '14%', type: FormTypes.popupJsh, kind: 'material', multi: true,
|
||||
{ title: '条码', key: 'barCode', width: '16%', type: FormTypes.popupJsh, kind: 'material', multi: true,
|
||||
validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||
},
|
||||
{ title: '名称', key: 'name', width: '10%', type: FormTypes.normal },
|
||||
|
||||
@@ -236,7 +236,7 @@
|
||||
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
||||
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||
},
|
||||
{ title: '条码', key: 'barCode', width: '10%', type: FormTypes.popupJsh, kind: 'material', multi: true,
|
||||
{ title: '条码', key: 'barCode', width: '12%', type: FormTypes.popupJsh, kind: 'material', multi: true,
|
||||
validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||
},
|
||||
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
||||
|
||||
@@ -220,7 +220,7 @@
|
||||
loading: false,
|
||||
dataSource: [],
|
||||
columns: [
|
||||
{ title: '条码', key: 'barCode', width: '10%', type: FormTypes.popupJsh, kind: 'material', multi: true,
|
||||
{ title: '条码', key: 'barCode', width: '12%', type: FormTypes.popupJsh, kind: 'material', multi: true,
|
||||
validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||
},
|
||||
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
||||
|
||||
@@ -273,7 +273,7 @@
|
||||
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
||||
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||
},
|
||||
{ title: '条码', key: 'barCode', width: '10%', type: FormTypes.popupJsh, kind: 'material', multi: true,
|
||||
{ title: '条码', key: 'barCode', width: '12%', type: FormTypes.popupJsh, kind: 'material', multi: true,
|
||||
validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||
},
|
||||
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
||||
|
||||
Reference in New Issue
Block a user