优化展示
This commit is contained in:
25
src/enums.js
25
src/enums.js
@@ -79,6 +79,31 @@ export const StockLogSourceType = {
|
||||
FERMENT_END: '发酵入库', // 发酵料产出,作为新原料计入库存
|
||||
};
|
||||
|
||||
/**
|
||||
* 根据库存变动来源的键或值获取其对应的中文标签。
|
||||
* @param {string} sourceTypeKeyOrValue - 库存变动来源的键 (如 "PURCHASE") 或值 (如 "采购入库")。
|
||||
* @returns {string} 对应的中文标签,如果未找到则返回 '--'。
|
||||
*/
|
||||
export function getStockLogSourceTypeLabel(sourceTypeKeyOrValue) {
|
||||
if (!sourceTypeKeyOrValue) {
|
||||
return '--';
|
||||
}
|
||||
|
||||
// 尝试直接通过键查找
|
||||
if (StockLogSourceType[sourceTypeKeyOrValue]) {
|
||||
return StockLogSourceType[sourceTypeKeyOrValue];
|
||||
}
|
||||
|
||||
// 尝试通过值反向查找
|
||||
for (const key in StockLogSourceType) {
|
||||
if (StockLogSourceType[key] === sourceTypeKeyOrValue) {
|
||||
return StockLogSourceType[key];
|
||||
}
|
||||
}
|
||||
|
||||
return '--';
|
||||
}
|
||||
|
||||
/**
|
||||
* 用药原因
|
||||
* @enum {string}
|
||||
|
||||
Reference in New Issue
Block a user