Browse Source

重复校验

hella_online_20240829
wangyufei 4 months ago
parent
commit
7b873cf576
  1. 7
      src/views/wms/productionManage/productionplan/productionMain/index.vue
  2. 7
      src/views/wms/productionManage/productionplan/productionMainAssemble/index.vue

7
src/views/wms/productionManage/productionplan/productionMain/index.vue

@ -120,6 +120,13 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) =>
// }) // })
if(formField=='itemCode'){ if(formField=='itemCode'){
// row[formField] = val[0][searchField] // row[formField] = val[0][searchField]
let itemCodes = val.filter(item=>tableData.value.find(item1=>item1['itemCode']==item['itemCode']))
if(itemCodes.length>0){
itemCodes = itemCodes.map(item=>(item.itemCode))
message.warning(`物料${itemCodes.join(',')}已经存在`)
}
val = val.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['itemCode']))
if(val.length==0) return
val.forEach(async item=>{ val.forEach(async item=>{
if(tableData.value.find(item1=>item1['id'] == item['id'])) return if(tableData.value.find(item1=>item1['id'] == item['id'])) return
const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item})) const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item}))

7
src/views/wms/productionManage/productionplan/productionMainAssemble/index.vue

@ -118,6 +118,13 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) =>
// console.log(err); // console.log(err);
// }) // })
if(formField == 'itemCode'){ if(formField == 'itemCode'){
let itemCodes = val.filter(item=>tableData.value.find(item1=>item1['itemCode']==item['itemCode']))
if(itemCodes.length>0){
itemCodes = itemCodes.map(item=>(item.itemCode))
message.warning(`物料${itemCodes.join(',')}已经存在`)
}
val = val.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['itemCode']))
if(val.length==0) return
val.forEach(async item=>{ val.forEach(async item=>{
const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item})) const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item}))
newRow[formField] = item[searchField] newRow[formField] = item[searchField]

Loading…
Cancel
Save