feat(分条/更新): 添加复制源卷信息功能

在分条和更新页面添加复制源卷信息按钮,方便用户快速填充表单。复制时自动排除卷号等特定字段,并处理数值类型转换。同时优化了复制逻辑,确保相关字段的联动更新。
This commit is contained in:
砂糖
2026-03-21 10:40:14 +08:00
parent 0c86b80fb2
commit 1b22ec6173
2 changed files with 77 additions and 10 deletions

View File

@@ -85,9 +85,9 @@
<el-card class="form-card">
<div slot="header" class="card-header">
<span><i class="el-icon-edit-outline"></i> {{ '更新信息' }}</span>
<!-- <el-button type="text" size="mini" @click="copyFromCurrent" icon="el-icon-document-copy">
复制当前信息
</el-button> -->
<el-button type="text" size="mini" @click="copyFromCurrent" icon="el-icon-document-copy">
复制源卷信息
</el-button>
</div>
<el-form ref="updateForm" :model="updateForm" :rules="rules" label-width="80px" size="small">
@@ -820,23 +820,43 @@ export default {
// 复制当前信息到更新表单
copyFromCurrent() {
const itemType = this.currentInfo.materialType === '原料' ? 'raw_material' : 'product';
this.updateForm = {
currentCoilNo: this.currentInfo.currentCoilNo,
// 复制除了指定字段之外的其他字段
const excludeFields = ['enterCoilNo', 'currentCoilNo', 'coilId', 'createTime', 'createBy'];
// 构建要复制的字段
const copiedFields = {
team: this.currentInfo.team,
materialType: this.currentInfo.materialType,
// 不复制 itemType 和 itemId让它们由 materialType 自动决定
itemType,
itemType: this.currentInfo.itemType,
itemId: this.currentInfo.itemId,
grossWeight: parseFloat(this.currentInfo.grossWeight) || null,
netWeight: parseFloat(this.currentInfo.netWeight) || null,
warehouseId: this.currentInfo.warehouseId,
actualWarehouseId: this.currentInfo.actualWarehouseId,
length: parseFloat(this.currentInfo.length) || null,
remark: this.currentInfo.remark
actualLength: parseFloat(this.currentInfo.actualLength) || null,
actualWidth: parseFloat(this.currentInfo.actualWidth) || null,
temperGrade: this.currentInfo.temperGrade,
coatingType: this.currentInfo.coatingType,
qualityStatus: this.currentInfo.qualityStatus,
packagingRequirement: this.currentInfo.packagingRequirement,
packingStatus: this.currentInfo.packingStatus,
trimmingRequirement: this.currentInfo.trimmingRequirement,
remark: this.currentInfo.remark,
productionStartTime: this.currentInfo.productionStartTime,
productionEndTime: this.currentInfo.productionEndTime,
productionDuration: this.currentInfo.productionDuration,
formattedDuration: this.currentInfo.productionDuration ? this.formatDuration(this.currentInfo.productionDuration * 60 * 1000) : ''
};
// 合并到更新表单
this.updateForm = {
...this.updateForm,
...copiedFields
};
// materialType 会触发 watch自动设置 itemType 并加载物品列表
this.$message.success('已复制当前信息,包含' + this.currentInfo.materialType + '类型的相关信息, 请根据需要修改');
this.$message.success('已复制源卷信息,请根据需要修改');
},
// 保存更新