1. 管理员管理模块拆分

2. 图片上传自动压缩(大于850kb)
3. 省市区选择组件重构,支持搜索
This commit is contained in:
李琦
2026-05-27 09:34:08 +08:00
parent 68fd7b0045
commit 402da17e3d
56 changed files with 4188 additions and 13664 deletions

View File

@@ -0,0 +1,40 @@
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;
}