Files
training/frontend/src/constants/user.ts
2026-07-28 12:52:36 +08:00

25 lines
735 B
TypeScript

import type { Role, Status, UserForm } from '../interfaces/user/model'
export const ROLE_OPTIONS: Role[] = ['Admin', 'Manager', 'Member', 'Viewer']
export const STATUS_OPTIONS: Array<{ value: Status | ''; label: string }> = [
{ value: '', label: '全部' },
{ value: 'ACTIVE', label: '活跃' },
{ value: 'INACTIVE', label: '未激活' },
]
export const EMPTY_USER_FORM: UserForm = {
fullName: '',
email: '',
role: 'Member',
status: 'ACTIVE',
}
export function roleLabel(role: string): string {
return ({ Admin: '管理员', Manager: '经理', Member: '成员', Viewer: '只读成员' })[role] ?? role
}
export function statusLabel(status: Status): string {
return status === 'ACTIVE' ? '活跃' : '未激活'
}