调整结构
This commit is contained in:
24
frontend/src/constants/user.ts
Normal file
24
frontend/src/constants/user.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
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' ? '活跃' : '未激活'
|
||||
}
|
||||
Reference in New Issue
Block a user