import React, { useState } from 'react'; import { Table, Card, Button, Modal, Form, Input, Select, Space, message, Popconfirm, Tag, Tree } from 'antd'; import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons'; const { Option } = Select; const PermissionManagement = () => { const [form] = Form.useForm(); const [modalVisible, setModalVisible] = useState(false); const [editingRecord, setEditingRecord] = useState(null); const [loading, setLoading] = useState(false); const [roles] = useState([ { id: 1, roleName: '超级管理员', roleCode: 'SUPER_ADMIN', description: '拥有系统所有权限', permissions: ['积分管理', '活动管理', '志愿者管理', '统计分析', '系统设置'], status: '启用', createTime: '2024-01-01 00:00:00', }, { id: 2, roleName: '活动管理员', roleCode: 'ACTIVITY_ADMIN', description: '负责活动管理和志愿者管理', permissions: ['活动管理', '志愿者管理', '统计分析'], status: '启用', createTime: '2024-01-05 10:00:00', }, { id: 3, roleName: '普通操作员', roleCode: 'OPERATOR', description: '基础操作权限', permissions: ['志愿者管理', '统计分析'], status: '启用', createTime: '2024-01-10 14:30:00', }, ]); // 权限树数据 const permissionTreeData = [ { title: '积分管理', key: 'points', children: [ { title: '积分类型设置', key: 'points:types' }, { title: '项目分值配置', key: 'points:projects' }, { title: '申报规则管理', key: 'points:rules' }, ], }, { title: '活动管理', key: 'activity', children: [ { title: '活动发布', key: 'activity:create' }, { title: '活动列表', key: 'activity:list' }, { title: '报名管理', key: 'activity:registration' }, ], }, { title: '志愿者管理', key: 'volunteer', children: [ { title: '志愿者列表', key: 'volunteer:list' }, { title: '积分查询', key: 'volunteer:points' }, { title: '志愿者详情', key: 'volunteer:detail' }, ], }, { title: '统计分析', key: 'statistics', children: [ { title: '数据概览', key: 'statistics:overview' }, { title: '趋势分析', key: 'statistics:trends' }, { title: '报表中心', key: 'statistics:reports' }, ], }, { title: '系统设置', key: 'system', children: [ { title: '用户管理', key: 'system:users' }, { title: '权限配置', key: 'system:permissions' }, { title: '系统参数', key: 'system:settings' }, ], }, ]; const columns = [ { title: '角色名称', dataIndex: 'roleName', key: 'roleName', }, { title: '角色代码', dataIndex: 'roleCode', key: 'roleCode', }, { title: '描述', dataIndex: 'description', key: 'description', ellipsis: true, }, { title: '权限', dataIndex: 'permissions', key: 'permissions', render: (permissions) => (
管理系统角色和权限配置