🐞 fix: 修复原材料无法创建BOM

This commit is contained in:
砂糖
2025-08-19 16:11:28 +08:00
parent 6eb6a74e45
commit 808d1ca513
3 changed files with 31 additions and 28 deletions

View File

@@ -114,9 +114,12 @@ export default {
try {
this.createLoading = true;
// 添加一个semi类型
const bomName = (this.type == 'product' ? '产品BOM' : (this.type == 'raw_material' ? '原材料BOM' : '半成品BOM')) + new Date().getTime();
const bomCode = (this.type == 'product' ? 'P' : (this.type == 'raw_material' ? 'R' : 'S')) + new Date().getTime();
const bomResponse = await addBom({
bomName: (this.type == 'product' ? '产品BOM' : '原材料BOM') + new Date().getTime(),
bomCode: (this.type == 'product' ? 'P' : 'R') + new Date().getTime()
bomName,
bomCode
});
this.$message.success('创建BOM成功');
@@ -133,6 +136,11 @@ export default {
rawMaterialId: this.itemId,
bomId: bomData.bomId
});
} else if (this.type == 'semi' && this.itemId) {
await updateProduct({
productId: this.itemId,
bomId: bomData.bomId
});
}
this.$store.dispatch('category/getBomMap');