refactor(产品/原材料): 重构产品及原材料信息展示与存储方式
移除BOM相关依赖,将材质、表面处理等属性直接存储在实体中 优化信息展示格式,统一使用方括号表示规格 调整表单字段,简化查询条件
This commit is contained in:
@@ -151,38 +151,34 @@ export default {
|
||||
},
|
||||
getLabel(item) {
|
||||
// 原材料名称[规格](参数),如果有则写,没有则省略
|
||||
if (!item.specification) {
|
||||
return `${item.rawMaterialName}(${this.getSku(item)})`
|
||||
|
||||
// 如果有sku拼接(sku), 有规格则拼接[规格], 否则只拼接原材料名称
|
||||
const sku = this.getSku(item);
|
||||
let str = item.rawMaterialName;
|
||||
if (item.specification) {
|
||||
str += `[${item.specification}]`
|
||||
}
|
||||
return `${item.rawMaterialName}[${item.specification}](${this.getSku(item)})`
|
||||
|
||||
if (sku) {
|
||||
str += `(${sku})`
|
||||
}
|
||||
return str;
|
||||
},
|
||||
getSku(item) {
|
||||
const boms = item.bomItems;
|
||||
if (!boms || boms.length === 0) {
|
||||
return '暂无参数信息';
|
||||
}
|
||||
// 查找attrKey为'规格'的attrvalue
|
||||
const specification = boms.find(p => p.attrKey === '规格');
|
||||
|
||||
// 查找attrKey为'厂家'的attrvalue
|
||||
const factory = boms.find(p => p.attrKey === '厂家');
|
||||
|
||||
// 查找attrKey为'材质'的attrvalue
|
||||
const material = boms.find(p => p.attrKey === '材质');
|
||||
|
||||
console.log(boms, item, '查找bomItems');
|
||||
// 组合sku:
|
||||
// 查询item的材质(material),表面处理(surfaceTreatmentDesc),厂家(manufacturer),锌层(zincLayer),如果有则添加到sku字符串中
|
||||
let sku = '';
|
||||
if (specification) {
|
||||
sku += '规格:' + specification.attrValue + ';';
|
||||
if (item.material) {
|
||||
sku += '材质:' + item.material + ';';
|
||||
}
|
||||
if (factory) {
|
||||
sku += '厂家:' + factory.attrValue + ';';
|
||||
if (item.surfaceTreatmentDesc) {
|
||||
sku += '表面处理:' + item.surfaceTreatmentDesc + ';';
|
||||
}
|
||||
if (material) {
|
||||
sku += '材质:' + material.attrValue;
|
||||
if (item.manufacturer) {
|
||||
sku += '厂家:' + item.manufacturer + ';';
|
||||
}
|
||||
if (item.zincLayer) {
|
||||
sku += '锌层:' + item.zincLayer + ';';
|
||||
}
|
||||
console.log(sku, '组合sku');
|
||||
return sku;
|
||||
},
|
||||
add() {
|
||||
|
||||
Reference in New Issue
Block a user