refactor(wms): 优化钢卷操作表单的数据结构
使用对象展开运算符简化表单数据初始化与提交逻辑 添加质量状态、包装要求等新字段 移除冗余的watch和重复的仓库名称获取逻辑
This commit is contained in:
@@ -260,7 +260,11 @@ export default {
|
||||
netWeight: null,
|
||||
warehouseId: null,
|
||||
actualWarehouseId: null,
|
||||
remark: ''
|
||||
remark: '',
|
||||
qualityStatus: '',
|
||||
packagingRequirement: '',
|
||||
packingStatus: '',
|
||||
trimmingRequirement: ''
|
||||
},
|
||||
rules: {
|
||||
currentCoilNo: [
|
||||
@@ -344,9 +348,6 @@ export default {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// 不再需要watch,直接用@change事件处理
|
||||
},
|
||||
async created() {
|
||||
// 先加载库区列表
|
||||
await this.loadWarehouses();
|
||||
@@ -400,27 +401,11 @@ export default {
|
||||
|
||||
// 填充当前信息(左侧)
|
||||
this.currentInfo = {
|
||||
coilId: data.coilId,
|
||||
enterCoilNo: data.enterCoilNo || '',
|
||||
currentCoilNo: data.currentCoilNo || '',
|
||||
supplierCoilNo: data.supplierCoilNo || '',
|
||||
team: data.team || '',
|
||||
itemType: data.itemType || null,
|
||||
itemId: data.itemId || null,
|
||||
...data,
|
||||
itemName: this.getItemName(data),
|
||||
grossWeight: data.grossWeight,
|
||||
netWeight: data.netWeight,
|
||||
warehouseId: data.warehouseId,
|
||||
actualWarehouseId: data.actualWarehouseId,
|
||||
nextWarehouseName: this.getWarehouseName(data.warehouseId),
|
||||
remark: data.remark || ''
|
||||
};
|
||||
|
||||
// 重新获取库区名称(确保warehouseList已加载)
|
||||
if (data.warehouseId) {
|
||||
this.currentInfo.nextWarehouseName = this.getWarehouseName(data.warehouseId);
|
||||
}
|
||||
|
||||
// 加载对应类型的物品列表
|
||||
if (data.itemType) {
|
||||
await this.loadItemList(data.itemType);
|
||||
@@ -684,19 +669,10 @@ export default {
|
||||
|
||||
// 构造更新数据(使用标准update接口,直接更新原记录)
|
||||
const updateData = {
|
||||
...this.updateForm,
|
||||
coilId: this.currentInfo.coilId,
|
||||
enterCoilNo: this.currentInfo.enterCoilNo,
|
||||
supplierCoilNo: this.currentInfo.supplierCoilNo,
|
||||
currentCoilNo: this.updateForm.currentCoilNo,
|
||||
team: this.updateForm.team,
|
||||
materialType: this.updateForm.materialType,
|
||||
itemType: this.updateForm.itemType,
|
||||
itemId: this.updateForm.itemId,
|
||||
grossWeight: this.updateForm.grossWeight,
|
||||
netWeight: this.updateForm.netWeight,
|
||||
warehouseId: this.updateForm.warehouseId,
|
||||
actualWarehouseId: this.updateForm.actualWarehouseId,
|
||||
remark: this.updateForm.remark
|
||||
// 注意:不要传newCoils,否则会走批量更新逻辑
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user