Refactor employee management

This commit is contained in:
Frudrax Cheng
2026-05-28 10:05:56 +08:00
parent 8b930ff44d
commit b9bc8f5419
11 changed files with 285 additions and 1051 deletions
+16 -1
View File
@@ -21,6 +21,8 @@ No test or lint commands are currently configured. When adding tests, use Vitest
This is a React 19 + TypeScript frontend for the Zhejiang Beifan Trace Management Platform (溯源管理平台). It provides:
- Public query interface for serial number verification
- Admin dashboard for QR code generation and company management
- Employee management with automatic employee serial generation
- Aftersales work-order management for admins and technicians
- User authentication and profile management
**Tech Stack**: React 19, TypeScript, Vite 7, Ant Design 6, React Router v7, Axios
@@ -90,7 +92,8 @@ src/
- `dashboardApi` - Dashboard statistics
- `employeeSerialApi` - Employee serial management
- `aftersalesApi` - Aftersales work orders (admin + public)
- `usersApi` - User management (admin only); also exposes `assignable` for technician/admin picker
- `employeesApi` - Employee management (admin only): create/list/update/delete/reset password
- `usersApi` - Assignable technician/admin picker via `assignable`
- Auth token automatically added via axios interceptor
- All API calls return typed responses based on `src/types/index.ts`
@@ -103,6 +106,18 @@ src/
- Public routes (no auth): `/login`, `/query`, `/aftersales/:serialNumber`
- `PublicQuery` auto-redirects scanned `zjbf-sh-*` serials to `/aftersales/:serialNumber`
- Shared public-page chrome (logo + 备案 footer) lives in `components/PublicLayout.tsx`
- `/admin/employee-serials` is the employee management page despite the legacy route name.
- Technicians should only see/use the aftersales module; admins see all admin menu items.
### Roles and Employee Management
- `UserRole` is limited to `admin` / `technician` / `employee`.
- `admin`: full backend access.
- `technician`: work-order module access only.
- `employee`: no backend login access.
- Employee creation fields are name, phone, employee number, position, and role.
- Password field is shown and required only for `admin` and `technician`.
- Employee creation uses `employeesApi.create`, and the backend automatically creates the employee serial; do not implement a separate "create then assign code" primary flow.
- Employee rows should display generated `employeeSerials` from the employee list response.
### Aftersales Conventions
- Aftersales serial format is `zjbf-sh-YYMMDDNN` (daily sequence), e.g. `zjbf-sh-26052801`.