|
|
@ -28,6 +28,8 @@ |
|
|
|
<!-- 表单弹窗:添加/修改 --> |
|
|
|
<BasicForm ref="formRef" |
|
|
|
@success="getList" |
|
|
|
:isOpenSearchTable="true" |
|
|
|
:indexTableColumn="1" |
|
|
|
:rules="PurchaseMainRules" |
|
|
|
:formAllSchemas="PurchaseMain.allSchemas" |
|
|
|
:tableAllSchemas="PurchaseDetail.allSchemas" |
|
|
@ -96,25 +98,33 @@ |
|
|
|
if (type == 'tableForm') { |
|
|
|
// 明细查询页赋值 |
|
|
|
if(formField == 'itemCode'){ |
|
|
|
let subList = tableData.value |
|
|
|
let flag = false; |
|
|
|
if(subList.length > 0){ |
|
|
|
subList.forEach((item) => { |
|
|
|
if(item.itemCode == val[0]['itemCode']){ |
|
|
|
flag = true; |
|
|
|
const repeatCode = [] //重复数据 |
|
|
|
if(tableData.value.length > 0){ |
|
|
|
tableData.value.forEach((item) => { |
|
|
|
const findIndex = val.findIndex(valItem=>valItem['itemCode']==item.itemCode) |
|
|
|
if(findIndex > -1){ |
|
|
|
val.splice(findIndex,1) |
|
|
|
repeatCode.push(item.itemCode) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
if(flag){ |
|
|
|
message.warning("物料代码已经存在"); |
|
|
|
return; |
|
|
|
if(repeatCode.length>0){ |
|
|
|
message.warning(`物料代码${repeatCode.join(',')}已经存在`); |
|
|
|
} |
|
|
|
row[formField] = val[0][searchField] |
|
|
|
await ItembasicApi.getItembasicPage({ |
|
|
|
code: row['itemCode'] |
|
|
|
}).then(res => { |
|
|
|
row['uom'] = res.list[0].uom |
|
|
|
}) |
|
|
|
if(val.length>0){ |
|
|
|
val.forEach(item=>{ |
|
|
|
const newRow = {...row} |
|
|
|
newRow[formField] = item[searchField] |
|
|
|
tableData.value.push(newRow) |
|
|
|
}) |
|
|
|
const itemCodes = val.map(valItem=>valItem['itemCode']) |
|
|
|
await ItembasicApi.getItembasicPage({ |
|
|
|
code: itemCodes.join(',') |
|
|
|
}).then(res => { |
|
|
|
row['uom'] = res.list[0].uom |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
const setV = {} |
|
|
|