Files
KCGL/inventory-web/src/utils/warehouseCompany.ts

23 lines
803 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 公司 → 允许选择的库位顶层前缀(白名单)
*
* - 匹配到公司:顶层库位只显示 name 以这些前缀开头的节点(其子级随顶层隐藏不可达)
* - 未配置的公司 / 空数组:显示全部库位
*
* 如需调整规则(新增公司/改前缀),只需改这张表,无需改动组件。
*/
export const COMPANY_WAREHOUSE_PREFIXES: Record<string, string[]> = {
// IRIS 仅显示 Y 开头(Y1~Y8)
IRIS: ['Y'],
// LICA 隐藏 Y,显示 C / L 开头
LICA: ['C', 'L'],
}
/**
* 根据公司名取允许的库位顶层前缀(未配置返回空数组 = 不过滤)
*/
export function getAllowedLocPrefixes(companyName?: string | null): string[] {
if (!companyName) return []
return COMPANY_WAREHOUSE_PREFIXES[companyName] || []
}