From 7b873cf576e234325469a77568915d74dad16984 Mon Sep 17 00:00:00 2001 From: wangyufei <2267742828@qq.com> Date: Mon, 22 Jul 2024 15:43:16 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=A4=8D=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../productionplan/productionMain/index.vue | 7 +++++++ .../productionplan/productionMainAssemble/index.vue | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/src/views/wms/productionManage/productionplan/productionMain/index.vue b/src/views/wms/productionManage/productionplan/productionMain/index.vue index c53a2a76f..e44583cff 100644 --- a/src/views/wms/productionManage/productionplan/productionMain/index.vue +++ b/src/views/wms/productionManage/productionplan/productionMain/index.vue @@ -120,6 +120,13 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => // }) if(formField=='itemCode'){ // 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=>{ if(tableData.value.find(item1=>item1['id'] == item['id'])) return const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item})) diff --git a/src/views/wms/productionManage/productionplan/productionMainAssemble/index.vue b/src/views/wms/productionManage/productionplan/productionMainAssemble/index.vue index 7e2c041af..c27dcfade 100644 --- a/src/views/wms/productionManage/productionplan/productionMainAssemble/index.vue +++ b/src/views/wms/productionManage/productionplan/productionMainAssemble/index.vue @@ -118,6 +118,13 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => // console.log(err); // }) 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=>{ const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item})) newRow[formField] = item[searchField]