优化单据中商品条码的模糊匹配
This commit is contained in:
@@ -53,6 +53,7 @@ const editMaterial = (params)=>putAction("/material/update",params);
|
|||||||
const checkMaterial = (params)=>getAction("/material/checkIsExist",params);
|
const checkMaterial = (params)=>getAction("/material/checkIsExist",params);
|
||||||
const getMaterialBySelect = (params)=>getAction("/material/findBySelect",params);
|
const getMaterialBySelect = (params)=>getAction("/material/findBySelect",params);
|
||||||
const getSerialMaterialBySelect = (params)=>getAction("/material/getMaterialEnableSerialNumberList",params);
|
const getSerialMaterialBySelect = (params)=>getAction("/material/getMaterialEnableSerialNumberList",params);
|
||||||
|
const getMaterialByParam = (params)=>getAction("/material/getMaterialByParam",params);
|
||||||
const getMaterialByBarCode = (params)=>getAction("/material/getMaterialByBarCode",params);
|
const getMaterialByBarCode = (params)=>getAction("/material/getMaterialByBarCode",params);
|
||||||
const getMaxBarCode = (params)=>getAction("/material/getMaxBarCode",params);
|
const getMaxBarCode = (params)=>getAction("/material/getMaxBarCode",params);
|
||||||
const checkMaterialBarCode = (params)=>getAction("/materialsExtend/checkIsBarCodeExist",params);
|
const checkMaterialBarCode = (params)=>getAction("/materialsExtend/checkIsBarCodeExist",params);
|
||||||
@@ -149,6 +150,7 @@ export {
|
|||||||
checkMaterial,
|
checkMaterial,
|
||||||
getMaterialBySelect,
|
getMaterialBySelect,
|
||||||
getSerialMaterialBySelect,
|
getSerialMaterialBySelect,
|
||||||
|
getMaterialByParam,
|
||||||
getMaterialByBarCode,
|
getMaterialByBarCode,
|
||||||
getMaxBarCode,
|
getMaxBarCode,
|
||||||
checkMaterialBarCode,
|
checkMaterialBarCode,
|
||||||
|
|||||||
@@ -1,6 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<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>
|
<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-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"/>
|
<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 JSelectBatchModal from './modal/JSelectBatchModal'
|
||||||
import JSelectSnModal from './modal/JSelectSnModal'
|
import JSelectSnModal from './modal/JSelectSnModal'
|
||||||
import JSelectSnAddModal from './modal/JSelectSnAddModal'
|
import JSelectSnAddModal from './modal/JSelectSnAddModal'
|
||||||
import { getMpListShort } from "@/utils/util"
|
import { getMaterialByParam } from '@/api/api'
|
||||||
import {getMaterialByBarCode} from '@/api/api'
|
|
||||||
import Vue from 'vue'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'JSelectList',
|
name: 'JSelectList',
|
||||||
@@ -49,6 +56,7 @@
|
|||||||
return {
|
return {
|
||||||
ids: "",
|
ids: "",
|
||||||
names: "",
|
names: "",
|
||||||
|
materialData: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@@ -65,38 +73,20 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initComp(name) {
|
initComp(name) {
|
||||||
this.names = name
|
this.names = name?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()
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
onSearch() {
|
onSearch() {
|
||||||
if(this.kind === 'material') {
|
this.$refs.selectModal.showModal()
|
||||||
//直接进行弹窗
|
},
|
||||||
this.$refs.selectModal.showModal(this.names)
|
handleSearch(value) {
|
||||||
} else {
|
getMaterialByParam({q: value}).then((res) => {
|
||||||
this.$refs.selectModal.showModal()
|
if (res && res.code === 200) {
|
||||||
}
|
this.materialData = res.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleChange(value) {
|
||||||
|
this.$emit("change", value)
|
||||||
},
|
},
|
||||||
selectOK(rows, idstr) {
|
selectOK(rows, idstr) {
|
||||||
console.log("选中id", idstr)
|
console.log("选中id", idstr)
|
||||||
|
|||||||
@@ -138,7 +138,7 @@
|
|||||||
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
||||||
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
|
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}不能为空' }]
|
validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||||
},
|
},
|
||||||
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
||||||
|
|||||||
@@ -139,7 +139,7 @@
|
|||||||
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
||||||
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
|
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}不能为空' }]
|
validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||||
},
|
},
|
||||||
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
||||||
|
|||||||
@@ -139,7 +139,7 @@
|
|||||||
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
||||||
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
|
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}不能为空' }]
|
validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||||
},
|
},
|
||||||
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
||||||
|
|||||||
@@ -160,7 +160,7 @@
|
|||||||
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
||||||
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
|
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}不能为空' }]
|
validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||||
},
|
},
|
||||||
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
||||||
|
|||||||
@@ -160,7 +160,7 @@
|
|||||||
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
||||||
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
|
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}不能为空' }]
|
validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||||
},
|
},
|
||||||
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
||||||
|
|||||||
@@ -231,7 +231,7 @@
|
|||||||
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
||||||
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
|
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}不能为空' }]
|
validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||||
},
|
},
|
||||||
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
||||||
|
|||||||
@@ -257,7 +257,7 @@
|
|||||||
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
||||||
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
|
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}不能为空' }]
|
validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||||
},
|
},
|
||||||
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
||||||
|
|||||||
@@ -227,7 +227,7 @@
|
|||||||
loading: false,
|
loading: false,
|
||||||
dataSource: [],
|
dataSource: [],
|
||||||
columns: [
|
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}不能为空' }]
|
validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||||
},
|
},
|
||||||
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
||||||
|
|||||||
@@ -219,7 +219,7 @@
|
|||||||
{ title: '仓库名称', key: 'depotId', width: '10%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
{ title: '仓库名称', key: 'depotId', width: '10%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
||||||
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
|
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}不能为空' }]
|
validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||||
},
|
},
|
||||||
{ title: '名称', key: 'name', width: '10%', type: FormTypes.normal },
|
{ title: '名称', key: 'name', width: '10%', type: FormTypes.normal },
|
||||||
|
|||||||
@@ -231,7 +231,7 @@
|
|||||||
{ title: '仓库名称', key: 'depotId', width: '10%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
{ title: '仓库名称', key: 'depotId', width: '10%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
||||||
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
|
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}不能为空' }]
|
validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||||
},
|
},
|
||||||
{ title: '名称', key: 'name', width: '10%', type: FormTypes.normal },
|
{ title: '名称', key: 'name', width: '10%', type: FormTypes.normal },
|
||||||
|
|||||||
@@ -236,7 +236,7 @@
|
|||||||
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
||||||
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
|
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}不能为空' }]
|
validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||||
},
|
},
|
||||||
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
||||||
|
|||||||
@@ -220,7 +220,7 @@
|
|||||||
loading: false,
|
loading: false,
|
||||||
dataSource: [],
|
dataSource: [],
|
||||||
columns: [
|
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}不能为空' }]
|
validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||||
},
|
},
|
||||||
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
||||||
|
|||||||
@@ -273,7 +273,7 @@
|
|||||||
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
|
||||||
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
|
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}不能为空' }]
|
validateRules: [{ required: true, message: '${title}不能为空' }]
|
||||||
},
|
},
|
||||||
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
{ title: '名称', key: 'name', width: '8%', type: FormTypes.normal },
|
||||||
|
|||||||
Reference in New Issue
Block a user