export type AdminFormType = | 'basic' | 'address' | 'supplier' | 'deliveryWarehouse' | 'clinic' | 'doctor' | 'pharmacist'; export interface AdminRoleMeta { id: number; title: string; slug: string; formType: AdminFormType; } /** 与后端 RoleEnum 一致 */ export const ADMIN_ROLE_LIST: AdminRoleMeta[] = [ { id: 1, title: '超级管理员', slug: 'super', formType: 'basic' }, { id: 2, title: '系统管理员', slug: 'platform', formType: 'basic' }, { id: 12, title: '总部财务', slug: 'headquarters-finance', formType: 'basic' }, { id: 3, title: '省级管理员', slug: 'province', formType: 'address' }, { id: 4, title: '市级管理员', slug: 'city', formType: 'address' }, { id: 5, title: '区级管理员', slug: 'district', formType: 'address' }, { id: 6, title: '业务员', slug: 'salesperson', formType: 'address' }, { id: 7, title: '供应商', slug: 'supplier', formType: 'supplier' }, { id: 8, title: '诊所管理员', slug: 'clinic', formType: 'clinic' }, { id: 9, title: '诊所员工', slug: 'clinic-staff', formType: 'clinic' }, { id: 10, title: '医生', slug: 'doctor', formType: 'doctor' }, { id: 11, title: '药师', slug: 'pharmacist', formType: 'pharmacist' }, { id: 14, title: '诊所推广员', slug: 'clinic-salesperson', formType: 'clinic' }, { id: 15, title: '订单管理员', slug: 'order', formType: 'basic' }, { id: 16, title: '配送仓库管理员', slug: 'delivery-warehouse', formType: 'deliveryWarehouse' }, ]; export const ROLE_CITY_MANAGER = 4; export const ROLE_SALESPERSON = 6; export function getRoleMeta(roleId: number): AdminRoleMeta { const meta = ADMIN_ROLE_LIST.find((r) => r.id === roleId); if (!meta) { throw new Error(`Unknown admin role id: ${roleId}`); } return meta; }