|
|
|
@ -2,13 +2,15 @@ |
|
|
|
<div class="packing-detail-tab"> |
|
|
|
<el-table |
|
|
|
:data="dataListBoxes" |
|
|
|
:max-height="height * 1.5" |
|
|
|
:height="height" |
|
|
|
border |
|
|
|
v-loading="dataListLoading" |
|
|
|
style="width: 100%;" |
|
|
|
:expand-row-keys="expandedBoxRows" |
|
|
|
:row-key="getBoxRowKey" |
|
|
|
@expand-change="handleBoxExpand"> |
|
|
|
@expand-change="handleBoxExpand" |
|
|
|
show-summary |
|
|
|
:summary-method="getSummaries"> |
|
|
|
<el-table-column type="expand"> |
|
|
|
<template slot-scope="props"> |
|
|
|
<!-- 加载状态 --> |
|
|
|
@ -724,6 +726,66 @@ export default { |
|
|
|
} |
|
|
|
}) |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
// 计算合计行数据 |
|
|
|
getSummaries(param) { |
|
|
|
const { columns, data } = param; |
|
|
|
const sums = []; |
|
|
|
|
|
|
|
columns.forEach((column, index) => { |
|
|
|
if (index === 0) { |
|
|
|
// 第一列(展开列)显示"合计" |
|
|
|
sums[index] = '合计'; |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
const values = data.map(item => Number(item[column.property])); |
|
|
|
|
|
|
|
// 根据列属性计算合计 |
|
|
|
if (column.property === 'box_qty') { |
|
|
|
// 箱数合计 |
|
|
|
const sum = values.reduce((prev, curr) => { |
|
|
|
const value = Number(curr); |
|
|
|
if (!isNaN(value)) { |
|
|
|
return prev + value; |
|
|
|
} else { |
|
|
|
return prev; |
|
|
|
} |
|
|
|
}, 0); |
|
|
|
sums[index] = sum; |
|
|
|
} else if (column.property === 'grossWeight') { |
|
|
|
// 毛重合计 |
|
|
|
const sum = values.reduce((prev, curr) => { |
|
|
|
const value = Number(curr); |
|
|
|
if (!isNaN(value)) { |
|
|
|
return prev + value; |
|
|
|
} else { |
|
|
|
return prev; |
|
|
|
} |
|
|
|
}, 0); |
|
|
|
sums[index] = sum.toFixed(3); |
|
|
|
} else if (column.property === 'netWeight') { |
|
|
|
// 净重合计 |
|
|
|
const sum = values.reduce((prev, curr) => { |
|
|
|
const value = Number(curr); |
|
|
|
if (!isNaN(value)) { |
|
|
|
return prev + value; |
|
|
|
} else { |
|
|
|
return prev; |
|
|
|
} |
|
|
|
}, 0); |
|
|
|
sums[index] = sum.toFixed(3); |
|
|
|
} else if (column.property === 'item_no') { |
|
|
|
// 序号列显示空 |
|
|
|
sums[index] = ''; |
|
|
|
} else { |
|
|
|
// 其他列显示空 |
|
|
|
sums[index] = ''; |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
return sums; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|