|
|
|
@ -10,6 +10,7 @@ |
|
|
|
<!-- 行合并表格 - 托盘和明细一目了然 --> |
|
|
|
<div style="height: 350px"> |
|
|
|
<el-table |
|
|
|
:key="'packing-table-' + boxQtyColumnMode" |
|
|
|
:data="flattenedTableData" |
|
|
|
:max-height="350" |
|
|
|
border |
|
|
|
@ -56,6 +57,11 @@ |
|
|
|
<span class="box-weight-text">{{ scope.row.net_weight || '-' }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column v-if="isMhmBu" :key="'box_qty_after_net'" label="箱数" prop="box_qty" min-width="100" align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span class="detail-text">{{ scope.row.box_qty || '-' }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
|
|
|
|
<!-- 明细信息列(不合并) --> |
|
|
|
<el-table-column label="PN" prop="pn" min-width="120" align="left"> |
|
|
|
@ -73,7 +79,7 @@ |
|
|
|
<span class="detail-text">{{ scope.row.qty_per_box || '-' }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="箱数" prop="box_qty" min-width="100" align="center"> |
|
|
|
<el-table-column v-if="!isMhmBu" :key="'box_qty_after_qty_per_box'" label="箱数" prop="box_qty" min-width="100" align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span class="detail-text">{{ scope.row.box_qty || '-' }}</span> |
|
|
|
</template> |
|
|
|
@ -128,6 +134,14 @@ export default { |
|
|
|
computed: { |
|
|
|
currentTotalGrossWeight() { |
|
|
|
return this.totalGrossWeight; |
|
|
|
}, |
|
|
|
isMhmBu() { |
|
|
|
const buNo = this.currentRow && this.currentRow.buNo ? String(this.currentRow.buNo).trim() : ''; |
|
|
|
const buName = this.currentRow && this.currentRow.buName ? String(this.currentRow.buName).trim() : ''; |
|
|
|
return buNo === '04-MHM' || buName === '04-MHM'; |
|
|
|
}, |
|
|
|
boxQtyColumnMode() { |
|
|
|
return this.isMhmBu ? 'mhm' : 'default'; |
|
|
|
} |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
@ -240,8 +254,8 @@ export default { |
|
|
|
notifyDetailItemNo: detail.notifyDetailItemNo, |
|
|
|
pn: detail.pn, |
|
|
|
qty: detail.qty, |
|
|
|
box_qty: detail.boxQty, |
|
|
|
qty_per_box: detail.boxQty && detail.boxQty > 0 ? (detail.qty / detail.boxQty).toFixed(2) : '-' |
|
|
|
box_qty: this.isMhmBu ? (box.box_qty || box.boxQty || '') : detail.boxQty, |
|
|
|
qty_per_box: detail.rolls |
|
|
|
}); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
@ -321,8 +335,10 @@ export default { |
|
|
|
return { rowspan: 1, colspan: 1 }; |
|
|
|
} |
|
|
|
|
|
|
|
const columnProp = column.property; |
|
|
|
|
|
|
|
// 托盘级别合并(托号、托数、总体积) |
|
|
|
if (columnIndex >= 0 && columnIndex <= 2) { |
|
|
|
if (columnProp === 'pallet_no' || columnProp === 'pallet_qty' || columnProp === 'volume') { |
|
|
|
if (row._isFirstRowOfPallet) { |
|
|
|
return { rowspan: row._palletRowSpan, colspan: 1 }; |
|
|
|
} else { |
|
|
|
@ -330,8 +346,12 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 箱级别合并(毛重、净重) |
|
|
|
if (columnIndex >= 3 && columnIndex <= 4) { |
|
|
|
// 箱级别合并(毛重、净重;天线04-MHM时箱数也按箱合并) |
|
|
|
const shouldMergeByBox = |
|
|
|
columnProp === 'gross_weight' || |
|
|
|
columnProp === 'net_weight' || |
|
|
|
(this.isMhmBu && columnProp === 'box_qty'); |
|
|
|
if (shouldMergeByBox) { |
|
|
|
if (row._isFirstRowOfBox) { |
|
|
|
return { rowspan: row._boxRowSpan, colspan: 1 }; |
|
|
|
} else { |
|
|
|
@ -363,7 +383,7 @@ export default { |
|
|
|
if (column.property === 'pallet_no' || column.property === 'pallet_qty' || column.property === 'volume') { |
|
|
|
this.hoveredPalletKey = row._palletKey; |
|
|
|
this.hoveredBoxKey = null; |
|
|
|
} else if (column.property === 'gross_weight' || column.property === 'net_weight') { |
|
|
|
} else if (column.property === 'gross_weight' || column.property === 'net_weight' || (this.isMhmBu && column.property === 'box_qty')) { |
|
|
|
this.hoveredBoxKey = row._boxKey; |
|
|
|
this.hoveredPalletKey = null; |
|
|
|
} |
|
|
|
@ -375,22 +395,24 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
getHeaderClassName({ column, columnIndex }) { |
|
|
|
if (columnIndex >= 0 && columnIndex <= 2) { |
|
|
|
const columnProp = column.property; |
|
|
|
if (columnProp === 'pallet_no' || columnProp === 'pallet_qty' || columnProp === 'volume') { |
|
|
|
return 'pallet-header'; |
|
|
|
} else if (columnIndex >= 3 && columnIndex <= 4) { |
|
|
|
} else if (columnProp === 'gross_weight' || columnProp === 'net_weight' || (this.isMhmBu && columnProp === 'box_qty')) { |
|
|
|
return 'box-header'; |
|
|
|
} else if (columnIndex >= 5 && columnIndex <= 8) { |
|
|
|
} else if (columnProp === 'pn' || columnProp === 'qty' || columnProp === 'qty_per_box' || (!this.isMhmBu && columnProp === 'box_qty')) { |
|
|
|
return 'detail-header'; |
|
|
|
} |
|
|
|
return ''; |
|
|
|
}, |
|
|
|
|
|
|
|
getCellClassName({ row, column, rowIndex, columnIndex }) { |
|
|
|
if (columnIndex >= 0 && columnIndex <= 2) { |
|
|
|
const columnProp = column.property; |
|
|
|
if (columnProp === 'pallet_no' || columnProp === 'pallet_qty' || columnProp === 'volume') { |
|
|
|
return 'pallet-cell'; |
|
|
|
} else if (columnIndex >= 3 && columnIndex <= 4) { |
|
|
|
} else if (columnProp === 'gross_weight' || columnProp === 'net_weight' || (this.isMhmBu && columnProp === 'box_qty')) { |
|
|
|
return 'box-cell'; |
|
|
|
} else if (columnIndex >= 5 && columnIndex <= 8) { |
|
|
|
} else if (columnProp === 'pn' || columnProp === 'qty' || columnProp === 'qty_per_box' || (!this.isMhmBu && columnProp === 'box_qty')) { |
|
|
|
return 'detail-cell'; |
|
|
|
} |
|
|
|
return ''; |
|
|
|
@ -455,7 +477,17 @@ export default { |
|
|
|
}, 0); |
|
|
|
sums[index] = sum > 0 ? sum.toLocaleString() : ''; |
|
|
|
} else if (column.property === 'box_qty') { |
|
|
|
// 箱数需要根据明细累加,如果没有明细,则根据箱级别累加 |
|
|
|
// 天线04-MHM:箱数使用箱表box_qty,且按箱级别汇总 |
|
|
|
if (this.isMhmBu) { |
|
|
|
const boxFirstRows = data.filter(item => item._isFirstRowOfBox); |
|
|
|
const sum = boxFirstRows.reduce((prev, curr) => { |
|
|
|
const value = Number(curr.box_qty); |
|
|
|
return !isNaN(value) ? prev + value : prev; |
|
|
|
}, 0); |
|
|
|
sums[index] = sum; |
|
|
|
return; |
|
|
|
} |
|
|
|
// 其他BU:保持原逻辑(按明细累加;无明细时取箱级别) |
|
|
|
let sum = 0; |
|
|
|
const boxFirstRows = data.filter(item => item._isFirstRowOfBox); |
|
|
|
boxFirstRows.forEach(boxRow => { |
|
|
|
|