|
|
@ -92,9 +92,11 @@ |
|
|
|
:updateTypeEdiltSubList="true" |
|
|
|
@tableSelectionDelete="tableSelectionDelete" |
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
|
@clearSearchInput="clearSearchInput" |
|
|
|
@submitForm="submitForm" |
|
|
|
@onEnter="onEnter" |
|
|
|
@onChange="onChangeForm" |
|
|
|
@inputNumberChange="inputNumberChange" |
|
|
|
> |
|
|
|
|
|
|
|
<template #hahaha> |
|
|
@ -367,6 +369,21 @@ const searchTableSuccess1 = (formField, searchField, val, type, row) => { |
|
|
|
formRef.value.formRef.setValues(setV) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const clearSearchInput = (formField) => { |
|
|
|
if(formField == 'supplierCode'){ |
|
|
|
formRef.value.formRef.setValues({ |
|
|
|
hahaha:'', |
|
|
|
hehehe:'', |
|
|
|
poNumber:'', |
|
|
|
receiptNumber:'', |
|
|
|
asnNumber:'', |
|
|
|
}) |
|
|
|
tableData.value = [] |
|
|
|
}else if(formField == 'locationCode'){ |
|
|
|
tableData.value = [] |
|
|
|
} |
|
|
|
} |
|
|
|
// 查询页面返回 |
|
|
|
const searchTableSuccess = async (formField, searchField, val, formRef, type, row) => { |
|
|
|
console.log('searchTableSuccess', formField, searchField, val, formRef, type, row) |
|
|
@ -381,32 +398,37 @@ const searchTableSuccess = async (formField, searchField, val, formRef, type, ro |
|
|
|
if(formField=='supplierCode'){ |
|
|
|
setV['supplierName'] = val[0]['shortName'] |
|
|
|
tableData.value = [] |
|
|
|
}else if(formField == 'locationCode' ){ |
|
|
|
// 退货库位 获取明细列表 |
|
|
|
let subList = await PurchasereturnRequestDetailApi.queryBalancePurchaseReceiptSpareReturn({ |
|
|
|
supplierCode:formRef.formModel.supplierCode,//供应商代码 |
|
|
|
poNumber:formRef.formModel.poNumber,// |
|
|
|
receiptNumber:formRef.formModel.receiptNumber,//采购收货记录单号 |
|
|
|
fromLocationCode:val[0][searchField]//库位代码 |
|
|
|
}) |
|
|
|
|
|
|
|
console.log('subList',subList) |
|
|
|
if(subList&&subList.length>0){ |
|
|
|
tableData.value = subList |
|
|
|
tableData.value.forEach((item,index)=>({ |
|
|
|
'id':index |
|
|
|
})) |
|
|
|
}else{ |
|
|
|
tableData.value = [] |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
formRef.setValues(setV) |
|
|
|
if(formField == 'locationCode' ){ |
|
|
|
// 退货库位 获取明细列表 |
|
|
|
getTableData() |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
const getTableData = async ()=>{ |
|
|
|
let formModel = formRef.value.formRef.formModel |
|
|
|
console.log('formRef',formRef.value) |
|
|
|
console.log('formModel',formModel) |
|
|
|
|
|
|
|
let subList = await PurchasereturnRequestDetailApi.queryBalancePurchaseReceiptSpareReturn({ |
|
|
|
supplierCode:formModel.supplierCode,//供应商代码 |
|
|
|
poNumber:formModel.poNumber,// |
|
|
|
receiptNumber:formModel.receiptNumber,//采购收货记录单号 |
|
|
|
fromLocationCode:formModel.locationCode//库位代码 |
|
|
|
}) |
|
|
|
console.log('subList',subList) |
|
|
|
if(subList&&subList.length>0){ |
|
|
|
tableData.value = subList |
|
|
|
tableData.value.forEach((item,index)=>({ |
|
|
|
'id':index |
|
|
|
})) |
|
|
|
}else{ |
|
|
|
tableData.value = [] |
|
|
|
} |
|
|
|
} |
|
|
|
// 查询页面返回——详情 |
|
|
|
const searchTableSuccessDetail = (formField, searchField, val, formRef) => { |
|
|
|
nextTick(() => { |
|
|
@ -823,6 +845,16 @@ const tableSelectionDelete = (selection) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//为true表示子表数据中存在数量为0的数据 |
|
|
|
const inputNumberChange = (field, val,row, index) => { |
|
|
|
console.log('inputNumberChange',formRef.value.formRef) |
|
|
|
if(field=='qty'){ |
|
|
|
if(row['balanceQty']!=null&&row['qty']>row['balanceQty']){ |
|
|
|
message.error(`物料${row['itemCode']}退货数量不能大于库存余额`) |
|
|
|
} |
|
|
|
} |
|
|
|
console.log('inputNumberChange',field, val,row, index) |
|
|
|
} |
|
|
|
// 主子数据 提交 |
|
|
|
const submitForm = async (formType, submitData) => { |
|
|
|
let data = { ...submitData } |
|
|
@ -834,15 +866,12 @@ const submitForm = async (formType, submitData) => { |
|
|
|
item['poNumber'] = data['poNumber'] |
|
|
|
}) |
|
|
|
console.log('submitForm', tableData.value) |
|
|
|
// if(tableData.value.find(item=>Number(item.returnedQty)>Number(item.receiptQty))){ |
|
|
|
// message.warning("退货数量不能大于收获数量") |
|
|
|
// return; |
|
|
|
// } |
|
|
|
if (tableData.value.find((item) => Number(item.qty) > Number(item.inventoryBalance))) { |
|
|
|
message.warning('退货数量不能大于库存余额') |
|
|
|
let errorItemCode = tableData.value.find((item) => Number(item.qty) > Number(item.balanceQty)) |
|
|
|
if (errorItemCode) { |
|
|
|
message.error(`物料${errorItemCode['itemCode']}退货数量不能大于库存余额`) |
|
|
|
return |
|
|
|
} |
|
|
|
data.subList = tableData.value // 拼接子表数据参数 |
|
|
|
data.subList = tableData.value.filter(item=>Number(item['qty'])>0) // 拼接子表数据参数 |
|
|
|
formRef.value.formLoading = true |
|
|
|
try { |
|
|
|
if (formType === 'create') { |
|
|
|