import type { PermissionNode } from '@/types'; export const permissionTreeData: PermissionNode[] = [ { id: 'workspace', label: '工作台', children: [ { id: 'dashboard', label: '运营总览(查看统计、待办、风险趋势)' }, ]}, { id: 'change', label: '数据变更', children: [ { id: 'tickets', label: '变更工单(创建、查看、审批、执行)' }, { id: 'ticket_create', label: '创建工单' }, { id: 'ticket_approve', label: '审批工单' }, { id: 'ticket_execute', label: '执行工单' }, { id: 'ticket_rollback', label: '回滚工单' }, { id: 'auto-task', label: '自动执行任务' }, ]}, { id: 'query', label: '数据查询', children: [ { id: 'queries', label: 'SQL 查询(查看日志、新建查询、导出)' }, { id: 'query_create', label: '执行查询' }, { id: 'query_export', label: '导出结果' }, { id: 'query_view_all', label: '查看全部用户查询' }, ]}, { id: 'datasource', label: '数据资产', children: [ { id: 'instances', label: '数据源实例(查看、添加、编辑、删除)' }, { id: 'mysql', label: 'MySQL 实例(查看、添加、编辑、删除)' }, { id: 'postgres', label: 'PostgreSQL 实例(查看、添加、编辑、删除)' }, { id: 'redis', label: 'Redis 实例(查看、添加、编辑、删除)' }, { id: 'mongo', label: 'MongoDB 实例(查看、添加、编辑、删除)' }, ]}, { id: 'governance', label: '审批治理', children: [ { id: 'workflow', label: '审批流程(创建、编辑流程模板)' }, { id: 'audit-rules', label: '审核规则(风险规则、禁用语句、影响行数)' }, ]}, { id: 'permission', label: '权限与组织', children: [ { id: 'users', label: '用户管理(创建、编辑、禁用)' }, { id: 'roles', label: '角色权限(创建、编辑、分配权限)' }, { id: 'instance-groups', label: '权限组管理(创建、编辑、分配)' }, ]}, { id: 'system', label: '系统治理', children: [ { id: 'audit-logs', label: '审计日志(查看操作记录)' }, { id: 'notifications', label: '通知渠道(配置 Webhook、测试)' }, { id: 'announcement', label: '公告管理' }, { id: 'settings', label: '系统设置(外观、LDAP、平台参数)' }, { id: 'config-platform', label: '全局配置(消息推送/LDAP/查询限制/工单规则)' }, ]}, ]; export const statusMap: Record = { pending: '待审批', reviewing: '审批中', approved: '已通过', rejected: '已拒绝', executing: '执行中', success: '执行成功', failed: '执行失败', rollback: '已回滚', }; export const statusColorMap: Record = { pending: 'bg-yellow-500/15 text-yellow-500', reviewing: 'bg-blue-500/15 text-blue-400', approved: 'bg-green-500/15 text-green-400', rejected: 'bg-red-500/15 text-red-400', executing: 'bg-cyan-500/15 text-cyan-400', success: 'bg-green-500/15 text-green-400', failed: 'bg-red-500/15 text-red-400', rollback: 'bg-orange-500/15 text-orange-400', }; /** * 数据库品牌色(刻意不随主题切换,是产品语义而非主题语义) * 全站唯一源:徽章淡色版 dbTypeColorMap / 实色版 dbTypeBrandColorMap */ const DB_TYPE_BADGE = { mysql: 'bg-[rgba(0,117,143,0.15)] text-[#26a69a]', postgres: 'bg-[rgba(51,103,145,0.15)] text-[#42a5f5]', redis: 'bg-[rgba(220,50,32,0.15)] text-[#ef5350]', mongo: 'bg-[rgba(71,162,72,0.15)] text-[#66bb6a]', }; export const dbTypeColorMap: Record = { ...DB_TYPE_BADGE, postgresql: DB_TYPE_BADGE.postgres, pg: DB_TYPE_BADGE.postgres, mongodb: DB_TYPE_BADGE.mongo, }; export const dbTypeBrandColorMap: Record = { mysql: 'bg-[#00758f]', postgres: 'bg-[#336791]', postgresql: 'bg-[#336791]', redis: 'bg-[#dc382d]', mongo: 'bg-[#47a248]', mongodb: 'bg-[#47a248]', };