11
Some checks failed
Node CI / build (14.x, macOS-latest) (push) Has been cancelled
Node CI / build (14.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (14.x, windows-latest) (push) Has been cancelled
Node CI / build (16.x, macOS-latest) (push) Has been cancelled
Node CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node CI / build (16.x, windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
coverage CI / build (push) Has been cancelled
Node pnpm CI / build (16.x, macOS-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Node pnpm CI / build (16.x, windows-latest) (push) Has been cancelled

This commit is contained in:
francis-fh
2026-06-04 17:15:41 +08:00
parent 197e80826e
commit 971e2b8be5
3 changed files with 36 additions and 21 deletions

View File

@@ -60,5 +60,18 @@ export function findTreeLabelById(
return '';
}
/** 所属行业:数字 id 走行业树,已是文案则直接展示 */
export function resolveIndustryLabel(
tree: any[] | undefined,
value?: string | number | null,
): string {
const str = value == null ? '' : String(value).trim();
if (!str) return '';
if (/^\d+$/.test(str)) {
return findTreeLabelById(tree, str) || str;
}
return str;
}
/** @deprecated 使用 findTreeLabelById */
export const findIndustryLabelInTree = findTreeLabelById;