Files
xk-admin/apps/web-antd/src/views/system/admin/_shared/role-meta.ts

41 lines
1.4 KiB
TypeScript
Raw Normal View History

export type AdminFormType =
| 'basic'
| 'address'
| 'supplier'
| '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: 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' },
];
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;
}