|
|
|
@ -18,7 +18,7 @@ |
|
|
|
@expand-change="handleBoxExpand" |
|
|
|
show-summary |
|
|
|
:summary-method="getSummaries"> |
|
|
|
<el-table-column type="expand"> |
|
|
|
<el-table-column type="expand" width="70px"> |
|
|
|
<template slot-scope="props"> |
|
|
|
<!-- 加载状态 --> |
|
|
|
<div v-if="props.row.loading" class="expand-loading"> |
|
|
|
@ -109,6 +109,28 @@ |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
|
|
|
|
<!-- 托盘重量和总毛重显示(模拟表格行布局) --> |
|
|
|
<div class="weight-summary-table"> |
|
|
|
<div class="weight-row"> |
|
|
|
<div class="weight-cell cell-expand label-cell" >托盘重量</div> |
|
|
|
<div class="weight-cell cell-data "></div> |
|
|
|
<div class="weight-cell cell-data"></div> |
|
|
|
<div class="weight-cell cell-data value-cell">{{ palletWeight }}</div> |
|
|
|
<div class="weight-cell cell-data"></div> |
|
|
|
<div class="weight-cell cell-data"></div> |
|
|
|
<div class="weight-cell cell-action"></div> |
|
|
|
</div> |
|
|
|
<div class="weight-row"> |
|
|
|
<div class="weight-cell cell-expand label-cell">总毛重</div> |
|
|
|
<div class="weight-cell cell-data "></div> |
|
|
|
<div class="weight-cell cell-data"></div> |
|
|
|
<div class="weight-cell cell-data value-cell">{{ totalGrossWeight.toFixed(2) }}</div> |
|
|
|
<div class="weight-cell cell-data"></div> |
|
|
|
<div class="weight-cell cell-data"></div> |
|
|
|
<div class="weight-cell cell-action"></div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- 修改箱信息弹窗 --> |
|
|
|
<el-dialog |
|
|
|
title="修改箱信息" |
|
|
|
@ -332,7 +354,7 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { selectBoxList, searchCoDelPalletDataNew, updateBoxInfo, deleteBoxInfo, updateDetailInfo, deleteDetailInfo, batchUpdatePackingInfo } from "@/api/ecss/ecss.js" |
|
|
|
import { selectBoxList, searchCoDelPalletDataNew, updateBoxInfo, deleteBoxInfo, updateDetailInfo, deleteDetailInfo, batchUpdatePackingInfo, searchEcssCoDelPalletHeaderData } from "@/api/ecss/ecss.js" |
|
|
|
|
|
|
|
export default { |
|
|
|
name: "PackingDetailTab", |
|
|
|
@ -356,6 +378,10 @@ export default { |
|
|
|
expandedBoxRows: [], // 展开的行 |
|
|
|
dataListLoading: false, |
|
|
|
|
|
|
|
// 托盘重量相关 |
|
|
|
palletWeight: 0, // 托盘重量合计 |
|
|
|
totalGrossWeight: 0, // 总毛重(合计毛重 + 托盘重量) |
|
|
|
|
|
|
|
// 修改箱信息弹窗相关 |
|
|
|
editBoxDialogVisible: false, |
|
|
|
editBoxForm: { |
|
|
|
@ -409,7 +435,7 @@ export default { |
|
|
|
sortLv: 0, |
|
|
|
status: true, |
|
|
|
fixed: '', |
|
|
|
columnWidth: 40 |
|
|
|
columnWidth: 100 |
|
|
|
}, |
|
|
|
{ |
|
|
|
userId: this.$store.state.user.name, |
|
|
|
@ -502,7 +528,7 @@ export default { |
|
|
|
sortLv: 0, |
|
|
|
status: true, |
|
|
|
fixed: '', |
|
|
|
columnWidth: 40 |
|
|
|
columnWidth: 50 |
|
|
|
}, |
|
|
|
{ |
|
|
|
userId: this.$store.state.user.name, |
|
|
|
@ -602,6 +628,8 @@ export default { |
|
|
|
loadBoxList() { |
|
|
|
if (!this.currentRow || !this.currentRow.site) { |
|
|
|
this.dataListBoxes = []; |
|
|
|
this.palletWeight = 0; |
|
|
|
this.totalGrossWeight = 0; |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
@ -609,26 +637,54 @@ export default { |
|
|
|
this.expandedBoxRows = []; |
|
|
|
this.dataListLoading = true; |
|
|
|
|
|
|
|
// 获取ecss_CoDelBoxList数据 |
|
|
|
selectBoxList(this.currentRow).then(({data}) => { |
|
|
|
if (data && data.code == 0) { |
|
|
|
this.dataListBoxes = data.rows.map(row => ({ |
|
|
|
// 同时获取箱数据和托盘数据 |
|
|
|
Promise.all([ |
|
|
|
selectBoxList(this.currentRow), |
|
|
|
searchEcssCoDelPalletHeaderData(this.currentRow) |
|
|
|
]).then(([boxResponse, palletResponse]) => { |
|
|
|
// 处理箱数据 |
|
|
|
if (boxResponse.data && boxResponse.data.code == 0) { |
|
|
|
this.dataListBoxes = boxResponse.data.rows.map(row => ({ |
|
|
|
...row, |
|
|
|
palletDetails: [], // 初始化明细数据为空 |
|
|
|
loading: false, // 初始化加载状态 |
|
|
|
hadDetails: false // 初始化是否有明细标记 |
|
|
|
})) |
|
|
|
})); |
|
|
|
} else { |
|
|
|
this.dataListBoxes = []; |
|
|
|
} |
|
|
|
|
|
|
|
// 处理托盘数据 - 计算托盘重量合计 |
|
|
|
if (palletResponse.data && palletResponse.data.code == 0) { |
|
|
|
const palletList = palletResponse.data.rows || []; |
|
|
|
// 只统计 palletQty > 0 的托盘重量 |
|
|
|
this.palletWeight = palletList |
|
|
|
.filter(item => item.palletQty > 0) |
|
|
|
.reduce((sum, item) => sum + (Number(item.weight) || 0), 0); |
|
|
|
} else { |
|
|
|
this.palletWeight = 0; |
|
|
|
} |
|
|
|
|
|
|
|
// 计算总毛重 = 合计毛重 + 托盘重量 |
|
|
|
this.calculateTotalGrossWeight(); |
|
|
|
}).catch(error => { |
|
|
|
console.error('加载箱数据失败:', error); |
|
|
|
console.error('加载数据失败:', error); |
|
|
|
this.dataListBoxes = []; |
|
|
|
this.palletWeight = 0; |
|
|
|
this.totalGrossWeight = 0; |
|
|
|
}).finally(() => { |
|
|
|
this.dataListLoading = false; |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
// 计算总毛重 |
|
|
|
calculateTotalGrossWeight() { |
|
|
|
const boxGrossWeight = this.dataListBoxes.reduce((sum, item) => { |
|
|
|
return sum + (Number(item.grossWeight) || 0); |
|
|
|
}, 0); |
|
|
|
this.totalGrossWeight = boxGrossWeight + this.palletWeight; |
|
|
|
}, |
|
|
|
|
|
|
|
// 获取行的唯一标识 |
|
|
|
getBoxRowKey(row) { |
|
|
|
// 使用多个字段组合确保唯一性 |
|
|
|
@ -781,6 +837,7 @@ export default { |
|
|
|
deleteBoxInfo(deleteParams).then(({data}) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
this.loadBoxList() |
|
|
|
this.$emit('refresh') // 刷新父页面列表 |
|
|
|
this.$message({ |
|
|
|
message: '操作成功', |
|
|
|
type: 'success', |
|
|
|
@ -911,6 +968,7 @@ export default { |
|
|
|
if (data && data.code === 0) { |
|
|
|
this.editBoxDialogVisible = false; |
|
|
|
this.loadBoxList() |
|
|
|
this.$emit('refresh') // 刷新父页面列表 |
|
|
|
this.$message({ |
|
|
|
message: '操作成功', |
|
|
|
type: 'success', |
|
|
|
@ -953,6 +1011,7 @@ export default { |
|
|
|
if (data && data.code === 0) { |
|
|
|
this.editDetailDialogVisible = false; |
|
|
|
this.loadBoxList() |
|
|
|
this.$emit('refresh') // 刷新父页面列表 |
|
|
|
this.$message({ |
|
|
|
message: '操作成功', |
|
|
|
type: 'success', |
|
|
|
@ -990,6 +1049,7 @@ export default { |
|
|
|
deleteDetailInfo(deleteParams).then(({data}) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
this.loadBoxList() |
|
|
|
this.$emit('refresh') // 刷新父页面列表 |
|
|
|
this.$message({ |
|
|
|
message: '操作成功', |
|
|
|
type: 'success', |
|
|
|
@ -1552,6 +1612,7 @@ export default { |
|
|
|
this.$message.success(`成功保存 ${this.batchEditModifiedCount} 处修改`); |
|
|
|
this.batchEditDialogVisible = false; |
|
|
|
this.loadBoxList(); // 刷新主表格 |
|
|
|
this.$emit('refresh'); // 刷新父页面列表 |
|
|
|
} else { |
|
|
|
this.$alert(response.data.msg || '保存失败', '错误', { |
|
|
|
confirmButtonText: '确定' |
|
|
|
@ -1573,6 +1634,70 @@ export default { |
|
|
|
width: 100%; |
|
|
|
} |
|
|
|
|
|
|
|
/* 托盘重量和总毛重显示样式(模拟表格行) */ |
|
|
|
.weight-summary-table { |
|
|
|
border: 1px solid #ebeef5; |
|
|
|
border-top: none; |
|
|
|
background: #fff; |
|
|
|
} |
|
|
|
|
|
|
|
.weight-row { |
|
|
|
display: flex; |
|
|
|
border-bottom: 1px solid #ebeef5; |
|
|
|
} |
|
|
|
|
|
|
|
.weight-row:last-child { |
|
|
|
border-bottom: none; |
|
|
|
} |
|
|
|
|
|
|
|
.weight-cell { |
|
|
|
padding: 8px 10px; |
|
|
|
border-right: 1px solid #ebeef5; |
|
|
|
min-height: 23px; |
|
|
|
box-sizing: border-box; |
|
|
|
} |
|
|
|
|
|
|
|
.weight-cell:last-child { |
|
|
|
border-right: none; |
|
|
|
} |
|
|
|
|
|
|
|
/* 展开列 - 固定宽度50px */ |
|
|
|
.cell-expand { |
|
|
|
width: 70px; |
|
|
|
min-width: 50px; |
|
|
|
max-width: 70px; |
|
|
|
} |
|
|
|
|
|
|
|
/* 标签列(序号列位置) - flex分配 */ |
|
|
|
.cell-label { |
|
|
|
flex: 1; |
|
|
|
min-width: 100px; |
|
|
|
} |
|
|
|
|
|
|
|
/* 数据列(箱数、毛重、净重、总Rolls) - flex分配 */ |
|
|
|
.cell-data { |
|
|
|
flex: 1; |
|
|
|
min-width: 80px; |
|
|
|
text-align: right; |
|
|
|
} |
|
|
|
|
|
|
|
/* 操作列 - 固定宽度120px */ |
|
|
|
.cell-action { |
|
|
|
width: 120px; |
|
|
|
min-width: 120px; |
|
|
|
max-width: 120px; |
|
|
|
} |
|
|
|
|
|
|
|
.label-cell { |
|
|
|
color: #19be6b; |
|
|
|
font-weight: bold; |
|
|
|
} |
|
|
|
|
|
|
|
.value-cell { |
|
|
|
color: #19be6b; |
|
|
|
font-weight: bold; |
|
|
|
} |
|
|
|
|
|
|
|
/* 展开明细容器样式 */ |
|
|
|
.expand-detail-container { |
|
|
|
background: #fafafa; |
|
|
|
@ -1638,7 +1763,7 @@ export default { |
|
|
|
} |
|
|
|
|
|
|
|
.expand-empty-state i { |
|
|
|
font-size: 48px; |
|
|
|
font-size: 70px; |
|
|
|
color: #ddd; |
|
|
|
margin-bottom: 12px; |
|
|
|
display: block; |
|
|
|
|