|
|
|
|
@ -92,8 +92,24 @@ export default { |
|
|
|
|
// 监听嵌套表格的勾选事件 |
|
|
|
|
handleSelectionChange(selection, parentRow) { |
|
|
|
|
console.log('666666', selection, parentRow) |
|
|
|
|
const maxAllowed = parentRow.applicationQuantity - parentRow.outboundQuantity; |
|
|
|
|
if(selection.length>(parentRow.applicationQuantity-parentRow.outboundQuantity)){ |
|
|
|
|
this.$message.error('勾选数量不能大于申请数量') |
|
|
|
|
const validSelection = selection.slice(0, maxAllowed); |
|
|
|
|
const removedItems = selection.slice(maxAllowed); |
|
|
|
|
const selectionWithParent = validSelection.map(item => ({ |
|
|
|
|
...item, |
|
|
|
|
parentMaterialId: parentRow.materialId, |
|
|
|
|
parentDepartmentName: parentRow.departmentName, |
|
|
|
|
applicationQuantity: parentRow.applicationQuantity, |
|
|
|
|
ldDemandEndId: parentRow.ldDemandEndId, |
|
|
|
|
outboundQuantity: parentRow.outboundQuantity, |
|
|
|
|
})); |
|
|
|
|
this.selectedRows = this.selectedRows.filter( |
|
|
|
|
item => item.parentMaterialId !== parentRow.materialId |
|
|
|
|
); |
|
|
|
|
this.selectedRows.push(...selectionWithParent); |
|
|
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|