|
|
|
|
@ -93,31 +93,31 @@ export default { |
|
|
|
|
handleSelectionChange(selection, parentRow) { |
|
|
|
|
console.log('666666', selection, parentRow) |
|
|
|
|
const maxAllowed = parentRow.applicationQuantity - parentRow.outboundQuantity; |
|
|
|
|
if(selection.length>(parentRow.applicationQuantity-parentRow.outboundQuantity)){ |
|
|
|
|
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, |
|
|
|
|
department:parentRow.department, |
|
|
|
|
departmentName:parentRow.departmentName, |
|
|
|
|
ldDemandEndId: parentRow.ldDemandEndId, |
|
|
|
|
outboundQuantity: parentRow.outboundQuantity, |
|
|
|
|
})); |
|
|
|
|
this.selectedRows = this.selectedRows.filter( |
|
|
|
|
item => item.parentMaterialId !== parentRow.materialId |
|
|
|
|
); |
|
|
|
|
this.selectedRows.push(...selectionWithParent); |
|
|
|
|
// 获取最后一个被选中的行(通常是 selection 数组的最后一项) |
|
|
|
|
const lastSelected = selection[selection.length - 1]; |
|
|
|
|
// if(selection.length>(parentRow.applicationQuantity-parentRow.outboundQuantity)){ |
|
|
|
|
// 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, |
|
|
|
|
// department:parentRow.department, |
|
|
|
|
// departmentName:parentRow.departmentName, |
|
|
|
|
// ldDemandEndId: parentRow.ldDemandEndId, |
|
|
|
|
// outboundQuantity: parentRow.outboundQuantity, |
|
|
|
|
// })); |
|
|
|
|
// this.selectedRows = this.selectedRows.filter( |
|
|
|
|
// item => item.parentMaterialId !== parentRow.materialId |
|
|
|
|
// ); |
|
|
|
|
// this.selectedRows.push(...selectionWithParent); |
|
|
|
|
// // 获取最后一个被选中的行(通常是 selection 数组的最后一项) |
|
|
|
|
// const lastSelected = selection[selection.length - 1]; |
|
|
|
|
|
|
|
|
|
// 手动取消该行在 UI 上的勾选 |
|
|
|
|
this.$refs.innerTable.toggleRowSelection(lastSelected, false); |
|
|
|
|
return |
|
|
|
|
// // 手动取消该行在 UI 上的勾选 |
|
|
|
|
// this.$refs.innerTable.toggleRowSelection(lastSelected, false); |
|
|
|
|
// return |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
// } |
|
|
|
|
// 为勾选的数据补充父行关联信息 |
|
|
|
|
const selectionWithParent = selection.map(item => ({ |
|
|
|
|
...item, |
|
|
|
|
|