feat(钢卷物料): 实现选中数据导出功能并优化标签显示
添加findItemWithBom工具函数用于统一获取物品名称 修改OuterTagPreview组件使用itemName替代productName 重构导出功能支持选中数据导出,并优化Excel生成逻辑
This commit is contained in:
@@ -94,6 +94,36 @@ const actions = {
|
||||
}
|
||||
};
|
||||
|
||||
export function findItemWithBom(itemType, itemId) {
|
||||
if (!itemType || !itemId) {
|
||||
return null;
|
||||
}
|
||||
console.log('itemType', itemType, 'itemId', itemId)
|
||||
let map = {}
|
||||
if (itemType === 'product') {
|
||||
map = state.productMap;
|
||||
} else if (itemType === 'raw_material') {
|
||||
map = state.rawMaterialMap;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
console.log('map', map)
|
||||
const item = map[itemId];
|
||||
const bomId = item.bomId
|
||||
if (!item) {
|
||||
return null;
|
||||
}
|
||||
console.log('bomId', bomId, item)
|
||||
const bomItems = state.bomMap[bomId];
|
||||
|
||||
return {
|
||||
...item,
|
||||
boms: bomItems || [],
|
||||
itemName: itemType === 'product' ? item.productName : item.rawMaterialName,
|
||||
itemType,
|
||||
};
|
||||
}
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
|
||||
Reference in New Issue
Block a user