feat: restrict permission roles
This commit is contained in:
+12
-2
@@ -4,6 +4,16 @@ import { UserOutlined, LockOutlined, SafetyOutlined, KeyOutlined, ExclamationCir
|
||||
import { authApi } from '@/services/api';
|
||||
import type { User } from '@/types';
|
||||
|
||||
const ROLE_LABEL: Record<string, string> = {
|
||||
admin: '管理员',
|
||||
technician: '技术员(旧)',
|
||||
employee: '员工',
|
||||
software_engineer: '软件工程师',
|
||||
hardware_engineer: '硬件工程师',
|
||||
business_manager: '商务经理',
|
||||
project_manager: '项目经理',
|
||||
};
|
||||
|
||||
function ProfilePage() {
|
||||
const [profileForm] = Form.useForm();
|
||||
const [passwordForm] = Form.useForm();
|
||||
@@ -87,7 +97,7 @@ function ProfilePage() {
|
||||
<Descriptions.Item label="用户名">{user.username}</Descriptions.Item>
|
||||
<Descriptions.Item label="姓名">{user.name}</Descriptions.Item>
|
||||
<Descriptions.Item label="邮箱">{user.email || '-'}</Descriptions.Item>
|
||||
<Descriptions.Item label="角色">{user.role}</Descriptions.Item>
|
||||
<Descriptions.Item label="角色">{ROLE_LABEL[user.role] || user.role}</Descriptions.Item>
|
||||
<Descriptions.Item label="创建时间">
|
||||
{new Date(user.createdAt).toLocaleString('zh-CN')}
|
||||
</Descriptions.Item>
|
||||
@@ -270,4 +280,4 @@ function ProfilePage() {
|
||||
);
|
||||
}
|
||||
|
||||
export default ProfilePage;
|
||||
export default ProfilePage;
|
||||
|
||||
Reference in New Issue
Block a user