|
|
|
@ -57,6 +57,18 @@ |
|
|
|
<span class="box-weight-text">{{ scope.row.net_weight || '-' }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column v-if="isMhmBu" :key="'box_no_after_net'" label="箱号" prop="box_no" min-width="120" align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span class="detail-text">{{ scope.row.box_no || '-' }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column v-if="isMhmBu" :key="'volume_per_box_after_net'" label="体积/箱" prop="volume_per_box" min-width="120" align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span class="detail-text"> |
|
|
|
{{ scope.row.volume_per_box !== null && scope.row.volume_per_box !== undefined && scope.row.volume_per_box !== '' ? Number(scope.row.volume_per_box).toFixed(2) : '-' }} |
|
|
|
</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> |
|
|
|
@ -220,10 +232,41 @@ export default { |
|
|
|
detailsMap.get(boxItemNo).push(detail); |
|
|
|
}); |
|
|
|
|
|
|
|
// 兜底:部分历史数据可能没有托盘头,但存在箱和明细,按箱的seq_no自动分组展示 |
|
|
|
let palletSource = pallets || []; |
|
|
|
if (palletSource.length === 0 && boxes.length > 0) { |
|
|
|
const derivedPalletMap = new Map(); |
|
|
|
boxes.forEach(box => { |
|
|
|
const seqNo = String(box.seq_no || box.seqNo || ''); |
|
|
|
if (!seqNo) { |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!derivedPalletMap.has(seqNo)) { |
|
|
|
derivedPalletMap.set(seqNo, { |
|
|
|
seqNo: seqNo, |
|
|
|
palletNo: seqNo, |
|
|
|
palletQty: '', |
|
|
|
volume: null |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
palletSource = Array.from(derivedPalletMap.values()).sort((a, b) => { |
|
|
|
const seqA = Number(a.seqNo); |
|
|
|
const seqB = Number(b.seqNo); |
|
|
|
if (!isNaN(seqA) && !isNaN(seqB)) { |
|
|
|
return seqA - seqB; |
|
|
|
} |
|
|
|
return String(a.seqNo).localeCompare(String(b.seqNo)); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
const flattenedData = []; |
|
|
|
|
|
|
|
pallets.forEach(pallet => { |
|
|
|
const palletSeqNo = String(pallet.seqNo); |
|
|
|
palletSource.forEach(pallet => { |
|
|
|
const palletSeqNo = String(pallet.seqNo || pallet.seq_no || ''); |
|
|
|
if (!palletSeqNo) { |
|
|
|
return; |
|
|
|
} |
|
|
|
const palletBoxes = boxesMap.get(palletSeqNo) || []; |
|
|
|
|
|
|
|
let palletRowSpan = 0; |
|
|
|
@ -243,9 +286,11 @@ export default { |
|
|
|
_isFirstRowOfPallet: boxIdx === 0 && detailIdx === 0, |
|
|
|
_isFirstRowOfBox: detailIdx === 0, |
|
|
|
_boxRowSpan: detailIdx === 0 ? boxDetails.length : 0, |
|
|
|
pallet_no: pallet.palletNo, |
|
|
|
pallet_qty: pallet.palletQty, |
|
|
|
pallet_no: pallet.palletNo || pallet.pallet_no || palletSeqNo, |
|
|
|
pallet_qty: pallet.palletQty || pallet.pallet_qty || '', |
|
|
|
volume: pallet.volume, |
|
|
|
box_no: box.item_no || box.itemNo, |
|
|
|
volume_per_box: box.volume, |
|
|
|
gross_weight: box.gross_weight || box.grossWeight, |
|
|
|
net_weight: box.net_weight || box.netWeight, |
|
|
|
_hasDetail: true, |
|
|
|
@ -266,9 +311,11 @@ export default { |
|
|
|
_isFirstRowOfPallet: boxIdx === 0, |
|
|
|
_isFirstRowOfBox: true, |
|
|
|
_boxRowSpan: 1, |
|
|
|
pallet_no: pallet.palletNo, |
|
|
|
pallet_qty: pallet.palletQty, |
|
|
|
pallet_no: pallet.palletNo || pallet.pallet_no || palletSeqNo, |
|
|
|
pallet_qty: pallet.palletQty || pallet.pallet_qty || '', |
|
|
|
volume: pallet.volume, |
|
|
|
box_no: box.item_no || box.itemNo, |
|
|
|
volume_per_box: box.volume, |
|
|
|
gross_weight: box.gross_weight || box.grossWeight, |
|
|
|
net_weight: box.net_weight || box.netWeight, |
|
|
|
_hasDetail: false, |
|
|
|
@ -288,9 +335,11 @@ export default { |
|
|
|
_isFirstRowOfPallet: true, |
|
|
|
_isFirstRowOfBox: true, |
|
|
|
_boxRowSpan: 1, |
|
|
|
pallet_no: pallet.palletNo, |
|
|
|
pallet_qty: pallet.palletQty, |
|
|
|
pallet_no: pallet.palletNo || pallet.pallet_no || palletSeqNo, |
|
|
|
pallet_qty: pallet.palletQty || pallet.pallet_qty || '', |
|
|
|
volume: pallet.volume, |
|
|
|
box_no: '', |
|
|
|
volume_per_box: '', |
|
|
|
gross_weight: '', |
|
|
|
net_weight: '', |
|
|
|
_hasDetail: false, |
|
|
|
@ -350,6 +399,8 @@ export default { |
|
|
|
const shouldMergeByBox = |
|
|
|
columnProp === 'gross_weight' || |
|
|
|
columnProp === 'net_weight' || |
|
|
|
(this.isMhmBu && columnProp === 'box_no') || |
|
|
|
(this.isMhmBu && columnProp === 'volume_per_box') || |
|
|
|
(this.isMhmBu && columnProp === 'box_qty'); |
|
|
|
if (shouldMergeByBox) { |
|
|
|
if (row._isFirstRowOfBox) { |
|
|
|
@ -383,7 +434,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' || (this.isMhmBu && column.property === 'box_qty')) { |
|
|
|
} else if (column.property === 'gross_weight' || column.property === 'net_weight' || (this.isMhmBu && column.property === 'box_no') || (this.isMhmBu && column.property === 'volume_per_box') || (this.isMhmBu && column.property === 'box_qty')) { |
|
|
|
this.hoveredBoxKey = row._boxKey; |
|
|
|
this.hoveredPalletKey = null; |
|
|
|
} |
|
|
|
@ -398,7 +449,7 @@ export default { |
|
|
|
const columnProp = column.property; |
|
|
|
if (columnProp === 'pallet_no' || columnProp === 'pallet_qty' || columnProp === 'volume') { |
|
|
|
return 'pallet-header'; |
|
|
|
} else if (columnProp === 'gross_weight' || columnProp === 'net_weight' || (this.isMhmBu && columnProp === 'box_qty')) { |
|
|
|
} else if (columnProp === 'gross_weight' || columnProp === 'net_weight' || (this.isMhmBu && columnProp === 'box_no') || (this.isMhmBu && columnProp === 'volume_per_box') || (this.isMhmBu && columnProp === 'box_qty')) { |
|
|
|
return 'box-header'; |
|
|
|
} else if (columnProp === 'pn' || columnProp === 'qty' || columnProp === 'qty_per_box' || (!this.isMhmBu && columnProp === 'box_qty')) { |
|
|
|
return 'detail-header'; |
|
|
|
@ -410,7 +461,7 @@ export default { |
|
|
|
const columnProp = column.property; |
|
|
|
if (columnProp === 'pallet_no' || columnProp === 'pallet_qty' || columnProp === 'volume') { |
|
|
|
return 'pallet-cell'; |
|
|
|
} else if (columnProp === 'gross_weight' || columnProp === 'net_weight' || (this.isMhmBu && columnProp === 'box_qty')) { |
|
|
|
} else if (columnProp === 'gross_weight' || columnProp === 'net_weight' || (this.isMhmBu && columnProp === 'box_no') || (this.isMhmBu && columnProp === 'volume_per_box') || (this.isMhmBu && columnProp === 'box_qty')) { |
|
|
|
return 'box-cell'; |
|
|
|
} else if (columnProp === 'pn' || columnProp === 'qty' || columnProp === 'qty_per_box' || (!this.isMhmBu && columnProp === 'box_qty')) { |
|
|
|
return 'detail-cell'; |
|
|
|
|