feat: 添加开始时间列并优化发货单打印功能

- 在coil面板的do.vue中添加开始时间列
- 新增widthEdit.vue组件用于宽度编辑
- 修改MaterialTag.vue中的标签显示为厂家名称
- 合并发货单打印功能,添加吨数统计显示
This commit is contained in:
砂糖
2026-03-17 17:07:49 +08:00
parent b6387a53d8
commit 3c9f82add4
4 changed files with 35 additions and 65 deletions

View File

@@ -71,9 +71,9 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-view"
@click.stop="handlePrint(scope.row)">打印发货单</el-button>
@click.stop="handlePrint(scope.row, 0)">打印发货单</el-button>
<el-button size="mini" type="text" icon="el-icon-view"
@click.stop="handlePrintSimple(scope.row)">简单打印</el-button>
@click.stop="handlePrint(scope.row, 1)">简单打印</el-button>
<el-button size="mini" type="text" icon="el-icon-copy"
@click.stop="handleCopy(scope.row)">复制新增</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" :disabled="scope.row.status === 1"
@@ -446,9 +446,9 @@ export default {
}, `deliveryWaybill_${new Date().getTime()}.xlsx`)
},
/** 打印发货单 */
handlePrint(row) {
handlePrint(row, printType) {
this.loading = true;
this.printType = 0;
this.printType = printType || 0;
// 获取发货单明细
listDeliveryWaybillDetail({
waybillId: row.waybillId,
@@ -480,7 +480,7 @@ export default {
const actualWahouseNames = [...new Set(response.rows.filter(item => Boolean(item.actualWarehouseName)).map(item => item.actualWarehouseName.slice(0, 3)))].join(';');
this.currentWaybill = {
...row,
pickupLocation: actualWahouseNames || '',
pickupLocation: (actualWahouseNames || '') + ';共' + this.currentWaybillDetails.length + '卷,合计' + this.currentWaybillDetails.reduce((acc, item) => acc + parseFloat(item.weight), 0).toFixed(3) + '吨',
};
this.currentWaybillDetails = this.currentWaybillDetails.map(item => {
const actualWarehouseName = response.rows.find(detail => detail.coilId === item.coilId)?.actualWarehouseName || '';
@@ -503,64 +503,6 @@ export default {
this.loading = false;
});
},
/** 打印发货单 */
handlePrintSimple(row) {
this.loading = true;
this.printType = 1;
// 获取发货单明细
listDeliveryWaybillDetail({
waybillId: row.waybillId,
pageNum: 1,
pageSize: 1000 // 获取所有明细
}).then(response => {
// 处理字段映射确保与wayBill组件使用的字段名一致
this.currentWaybillDetails = response.rows.map(item => ({
coilId: item.coilId,
productName: item.productName,
edgeType: item.edgeType,
packageType: item.packaging, // 映射packaging到packageType
settlementType: item.settlementType,
rawMaterialFactory: item.rawMaterialFactory,
coilNumber: item.coilNo, // 映射coilNo到coilNumber
specification: item.specification,
material: item.material,
quantity: item.quantity,
weight: item.weight,
unitPrice: item.unitPrice || '',
// 单价为空时,显示为空字符串
remark: item.remark
}));
const coils = this.currentWaybillDetails.map(item => item.coilId).join(',');
if (coils) {
listCoilByIds(coils).then(response => {
// 取前三位, 然后去抽后用;连接
// 设置当前发货单
const actualWahouseNames = [...new Set(response.rows.filter(item => Boolean(item.actualWarehouseName)).map(item => item.actualWarehouseName.slice(0, 3)))].join(';');
this.currentWaybill = {
...row,
pickupLocation: actualWahouseNames || '',
};
this.currentWaybillDetails = this.currentWaybillDetails.map(item => {
const actualWarehouseName = response.rows.find(detail => detail.coilId === item.coilId)?.actualWarehouseName || '';
return {
...item,
actualWarehouseName: actualWarehouseName,
};
});
});
}
this.currentWaybill = {
...row,
};
this.printDialogVisible = true;
this.loading = false;
}).catch(error => {
console.error('获取发货单明细失败:', error);
this.$modal.msgError('获取发货单明细失败');
this.loading = false;
});
}
}
};
</script>