Files
tashow-manager/src/utils/constant.ts
qianpw 9363dc0d6e
Some checks failed
coverage CI / build (push) Has been cancelled
feat: 系统管理
2025-09-23 16:00:15 +08:00

23 lines
644 B
TypeScript

// 创建 value 到 label 的映射
const statusMap = (status: { label: string; value: number }[]) =>
new Map(status?.map((item) => [item.value, item.label]));
const packageMap = (status: { id: number; name: string }[]) =>
new Map(status?.map((item) => [item.id, item.name]));
// 获取 label 的函数
export const getStatusLabel = (
status: { label: string; value: number }[],
value: number,
): string => {
return statusMap(status).get(value) || '';
};
// 获取 label 的函数
export const getpackageLabel = (
status: { id: number; name: string }[],
id: number,
): string => {
return packageMap(status).get(id) || '';
};