给商品条码增加重复校验
This commit is contained in:
@@ -129,6 +129,7 @@ const checkMaterial = (params)=>getAction("/material/checkIsNameExist",params);
|
||||
const getMaterialBySelect = (params)=>getAction("/material/findBySelect",params);
|
||||
const getSerialMaterialBySelect = (params)=>getAction("/material/getMaterialEnableSerialNumberList",params);
|
||||
const getMaterialByBarCode = (params)=>getAction("/material/getMaterialByBarCode",params);
|
||||
const checkMaterialBarCode = (params)=>getAction("/materialsExtend/checkIsBarCodeExist",params);
|
||||
//序列号
|
||||
const addSerialNumber = (params)=>postAction("/serialNumber/add",params);
|
||||
const editSerialNumber = (params)=>putAction("/serialNumber/update",params);
|
||||
@@ -249,6 +250,7 @@ export {
|
||||
getMaterialBySelect,
|
||||
getSerialMaterialBySelect,
|
||||
getMaterialByBarCode,
|
||||
checkMaterialBarCode,
|
||||
addSerialNumber,
|
||||
editSerialNumber,
|
||||
checkSerialNumber,
|
||||
|
||||
@@ -148,7 +148,7 @@
|
||||
import pick from 'lodash.pick'
|
||||
import JEditableTable from '@/components/jeecg/JEditableTable'
|
||||
import { FormTypes, VALIDATE_NO_PASSED, getRefPromise, validateFormAndTables } from '@/utils/JEditableTableUtil'
|
||||
import {queryMaterialCategoryTreeList,addMaterial,editMaterial,checkMaterial} from '@/api/api'
|
||||
import {queryMaterialCategoryTreeList,checkMaterial,checkMaterialBarCode} from '@/api/api'
|
||||
import { httpAction, getAction } from '@/api/manage'
|
||||
import JDate from '@/components/jeecg/JDate'
|
||||
import Vue from 'vue'
|
||||
@@ -191,7 +191,8 @@
|
||||
title: '条码', key: 'barCode', width: '30%', type: FormTypes.input, defaultValue: '', placeholder: '请输入${title}',
|
||||
validateRules: [{ required: true, message: '${title}不能为空' },
|
||||
{ pattern: /^[1-9]\d*$/, message: '请输入零以上的正整数' },
|
||||
{ pattern: /^\d{4,13}$/, message: '4到13位数字' }]
|
||||
{ pattern: /^\d{4,13}$/, message: '4到13位数字' },
|
||||
{ handler: this.validateBarCode}]
|
||||
},
|
||||
{
|
||||
title: '单位', key: 'commodityUnit', width: '12%', type: FormTypes.input, defaultValue: '', placeholder: '请输入${title}',
|
||||
@@ -372,7 +373,6 @@
|
||||
return;
|
||||
}
|
||||
//进一步校验单位
|
||||
debugger
|
||||
let manyUnitselected = ''
|
||||
if(formData.unitId) {
|
||||
for(let i=0; i<this.unitList.length; i++) {
|
||||
@@ -453,6 +453,23 @@
|
||||
}
|
||||
});
|
||||
},
|
||||
validateBarCode(type, value, row, column, callback, target) {
|
||||
let params = {
|
||||
barCode: value,
|
||||
id: row.id.length == 20?0: row.id
|
||||
};
|
||||
checkMaterialBarCode(params).then((res)=>{
|
||||
if(res && res.code===200) {
|
||||
if(!res.data.status){
|
||||
callback(true);
|
||||
} else {
|
||||
callback(false, '该条码已经存在');
|
||||
}
|
||||
} else {
|
||||
callback(false, res.data);
|
||||
}
|
||||
});
|
||||
},
|
||||
loadTreeData(){
|
||||
let that = this;
|
||||
let params = {};
|
||||
|
||||
Reference in New Issue
Block a user