初始化项目
This commit is contained in:
103
src/pages/Roles.tsx
Normal file
103
src/pages/Roles.tsx
Normal file
@@ -0,0 +1,103 @@
|
||||
import React from 'react';
|
||||
import {
|
||||
Card,
|
||||
Row,
|
||||
Col,
|
||||
Button,
|
||||
Typography,
|
||||
Tag,
|
||||
Space,
|
||||
Divider,
|
||||
List
|
||||
} from 'antd';
|
||||
import {
|
||||
SafetyCertificateOutlined,
|
||||
LockOutlined,
|
||||
CheckCircleOutlined,
|
||||
PlusOutlined,
|
||||
TeamOutlined
|
||||
} from '@ant-design/icons';
|
||||
|
||||
const { Text, Title } = Typography;
|
||||
|
||||
export default function Roles() {
|
||||
const roles = [
|
||||
{ name: '超级管理员', key: 'admin', desc: '系统全权限,支持资源分配与权限审计', level: 'Level 1' },
|
||||
{ name: '系统操作员', key: 'operator', desc: '设备策略下发,实时指令干预及警报处理', level: 'Level 2' },
|
||||
{ name: '访客观察员', key: 'viewer', desc: '只读权限,支持实时视频预览与报表查阅', level: 'Level 3' },
|
||||
];
|
||||
|
||||
const permissions = [
|
||||
{ name: '设备控制权限', sectors: ['远程重启', '策略部署', '紧急停机'] },
|
||||
{ name: '视频管理权限', sectors: ['实时监控', '云台控制', '录像下载'] },
|
||||
{ name: '核心准入权限', sectors: ['审计日志', '成本报表', '用户配置'] },
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<Title level={5} style={{ margin: 0 }}>系统角色权限矩阵</Title>
|
||||
<Button type="primary" icon={<PlusOutlined />} style={{ borderRadius: 2 }}>
|
||||
新增角色组
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<Row gutter={16}>
|
||||
{roles.map((role) => (
|
||||
<Col span={8} key={role.key}>
|
||||
<Card
|
||||
hoverable
|
||||
style={{ borderRadius: 2 }}
|
||||
actions={[
|
||||
<Button type="link" size="small" icon={<TeamOutlined />}>管理成员</Button>
|
||||
]}
|
||||
>
|
||||
<Card.Meta
|
||||
avatar={
|
||||
<div className="w-10 h-10 bg-blue-50 text-blue-500 rounded flex items-center justify-center border border-blue-100">
|
||||
<SafetyCertificateOutlined style={{ fontSize: 20 }} />
|
||||
</div>
|
||||
}
|
||||
title={<span style={{ fontSize: 14 }}>{role.name}</span>}
|
||||
description={
|
||||
<Space direction="vertical" size={4} style={{ width: '100%' }}>
|
||||
<Text type="secondary" style={{ fontSize: 10, fontFamily: 'monospace', textTransform: 'uppercase', fontStyle: 'italic' }}>{role.level}</Text>
|
||||
<Text type="secondary" style={{ fontSize: 12, lineHeight: '1.5', height: 40, display: 'block' }}>{role.desc}</Text>
|
||||
</Space>
|
||||
}
|
||||
/>
|
||||
</Card>
|
||||
</Col>
|
||||
))}
|
||||
</Row>
|
||||
|
||||
<Card
|
||||
size="small"
|
||||
title={<Space><LockOutlined style={{ color: 'rgba(0,0,0,0.45)' }} /><Text strong style={{ fontSize: 14 }}>功能模块权限分配 (细分原子操作)</Text></Space>}
|
||||
style={{ borderRadius: 2 }}
|
||||
>
|
||||
<Row gutter={24} style={{ padding: '8px 0' }}>
|
||||
{permissions.map((p) => (
|
||||
<Col span={8} key={p.name}>
|
||||
<div className="space-y-3">
|
||||
<Text strong style={{ fontSize: 11, borderLeft: '2px solid #1890ff', paddingLeft: 8, textTransform: 'uppercase', letterSpacing: 1 }}>{p.name}</Text>
|
||||
<List
|
||||
size="small"
|
||||
dataSource={p.sectors}
|
||||
renderItem={(item) => (
|
||||
<List.Item style={{ padding: '8px 4px', border: 'none' }}>
|
||||
<div className="flex items-center justify-between w-full p-2 bg-gray-50/50 rounded-sm hover:bg-gray-50 border border-transparent hover:border-gray-200 transition-all">
|
||||
<Text type="secondary" style={{ fontSize: 12 }}>{item}</Text>
|
||||
<CheckCircleOutlined style={{ color: '#52c41a', fontSize: 12 }} />
|
||||
</div>
|
||||
</List.Item>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</Col>
|
||||
))}
|
||||
</Row>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user