import { useState } from 'react'; import { Plus, Search, Edit2, Trash2, Database, Table, Filter, Shield } from 'lucide-react'; import { Card, CardContent } from '@/components/ui/card'; import { dataPermissions } from '@/lib/mock'; export default function DataPermissionPage() { const [search, setSearch] = useState(''); const filtered = dataPermissions.filter(p => !search || p.user.includes(search) || p.instance.includes(search) || p.database.includes(search) ); return (

数据权限

配置用户对数据库、表、字段的访问权限,支持行级权限控制

{[ { label: '权限规则数', value: dataPermissions.length, icon: Shield, color: 'text-blue-400', bg: 'bg-blue-400/10' }, { label: '受控用户', value: new Set(dataPermissions.map(p => p.user)).size, icon: Database, color: 'text-purple-400', bg: 'bg-purple-400/10' }, { label: '受控实例', value: new Set(dataPermissions.map(p => p.instance)).size, icon: Table, color: 'text-green-400', bg: 'bg-green-400/10' }, { label: '行级过滤规则', value: dataPermissions.filter(p => p.rowFilter).length, icon: Filter, color: 'text-orange-400', bg: 'bg-orange-400/10' }, ].map((s, i) => (
{s.value}
{s.label}
))}
setSearch(e.target.value)} />
{filtered.map(p => ( ))}
用户 实例 数据库 表 字段权限 行级过滤 操作权限 操作
{p.user} {p.instance} {p.database} {p.table} {p.columns === '*' ? ( 全部字段 ) : (
{p.columns.split(',').map(c => ( {c} ))}
)}
{p.rowFilter ? ( {p.rowFilter} ) : ( - )}
{p.operations.map(op => ( {op} ))}
); }