feat: 管理看板全面改版 — 增强可读性 + 填充空白区域

后端增强:
  - DashboardStats 新增 tasks_rejected, tasks_rework, unread_notifications
  - 新增 GET /dashboard/recent-activity 最近动态端点
  - 关联 Task + Product 表返回完整动态信息

前端改版 (AdminDashboard.tsx):
  - 4 张概览卡片: 产品流转 | 任务状态 | 品质通知 | 完成率
  - 每张卡片含进度条(百分比标注) + 中文说明
  - SVG 环形图展示任务完成率
  - 最近流转动态时间线 (8条)
  - 快捷入口: 创建产品/任务管理/打印配置/扫码干活
  - 底部说明卡片解释"产品 vs 任务"的区别
  - 响应式网格填满全屏, 无空白区域
This commit is contained in:
2026-08-12 13:25:49 +08:00
parent 8e8d23010f
commit 658fc28b9b
4 changed files with 335 additions and 54 deletions

View File

@ -9,9 +9,26 @@ export interface DashboardStats {
tasks_pending: number;
tasks_in_progress: number;
tasks_completed: number;
tasks_rejected: number;
tasks_rework: number;
unread_notifications: number;
}
export interface RecentActivity {
action: string;
task_name: string;
operator: string;
product_sn: string;
time: string;
remark: string | null;
}
export async function fetchDashboardStats(): Promise<DashboardStats> {
const { data } = await api.get<DashboardStats>("/dashboard/stats");
return data;
}
export async function fetchRecentActivity(limit = 10): Promise<RecentActivity[]> {
const { data } = await api.get<RecentActivity[]>("/dashboard/recent-activity", { params: { limit } });
return data;
}