From 4aa014de0de822e2bbe835dba3ccdca3a9a57e95 Mon Sep 17 00:00:00 2001 From: iven Date: Fri, 1 May 2026 21:22:28 +0800 Subject: [PATCH] =?UTF-8?q?feat(web):=20Home.tsx=20=E9=9B=86=E6=88=90?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=E5=B7=A5=E4=BD=9C=E5=8F=B0=20=E2=80=94=20?= =?UTF-8?q?=E5=8C=BB=E7=94=9F=E8=A1=8C=E5=8A=A8=E6=94=B6=E4=BB=B6=E7=AE=B1?= =?UTF-8?q?=20+=20=E4=B8=BB=E4=BB=BB=E5=9B=A2=E9=98=9F=E6=A6=82=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 医生/护士角色:待办任务行替换为行动收件箱(TodoList) + AI 概览面板 - 主任角色:在最近动态下方新增 TeamOverviewPanel 团队概览 - 所有角色:点击待办项可打开 ActionDetailDrawer 查看详情和操作 - admin/operator 角色保持原有待办任务+最近动态布局 --- apps/web/src/pages/Home.tsx | 178 +++++++++++++++++++++++------------- 1 file changed, 112 insertions(+), 66 deletions(-) diff --git a/apps/web/src/pages/Home.tsx b/apps/web/src/pages/Home.tsx index da6f621..adf33d0 100644 --- a/apps/web/src/pages/Home.tsx +++ b/apps/web/src/pages/Home.tsx @@ -30,6 +30,11 @@ import { listPendingTasks, type TaskInfo } from '../api/workflowTasks'; import { pointsApi, type PersonalStats } from '../api/health/points'; import { useStatsData } from './health/StatisticsDashboard/useStatsData'; import { useCountUp } from '../hooks/useCountUp'; +import TodoList from './health/components/workbench/TodoList'; +import AiInsightPanel from './health/components/workbench/AiInsightPanel'; +import TeamOverviewPanel from './health/components/workbench/TeamOverviewPanel'; +import ActionDetailDrawer from './health/components/workbench/ActionDetailDrawer'; +import type { ActionItem } from '../api/health/actionInbox'; // --- Shared utilities --- @@ -172,6 +177,8 @@ export default function Home() { const [pendingTasks, setPendingTasks] = useState([]); const [recentActivities, setRecentActivities] = useState([]); const [activitiesLoading, setActivitiesLoading] = useState(true); + const [drawerItem, setDrawerItem] = useState(null); + const [drawerOpen, setDrawerOpen] = useState(false); const statsData = useStatsData(); const loading = personalLoading || statsData.loading; @@ -262,75 +269,94 @@ export default function Home() { {/* 待办任务 + 最近活动 */} - -
-
- - 待办任务 - - {pendingTasks.length} 项待处理 - -
-
- {pendingTasks.length === 0 ? ( - - ) : ( - pendingTasks.map((task) => ( -
handleNavigate('/workflow')} - role="button" - tabIndex={0} - onKeyDown={(e) => { if (e.key === 'Enter') handleNavigate('/workflow'); }} - > -
-
-
{task.node_name || task.definition_name || '流程任务'}
-
- {task.definition_name || '工作流'} - {task.status === 'pending' ? '待处理' : task.status} + {(role === 'doctor' || role === 'nurse') ? ( + <> + +
+
+ + 行动收件箱 +
+ { setDrawerItem(item); setDrawerOpen(true); }} /> +
+ + + + + + ) : ( + <> + +
+
+ + 待办任务 + + {pendingTasks.length} 项待处理 + +
+
+ {pendingTasks.length === 0 ? ( + + ) : ( + pendingTasks.map((task) => ( +
handleNavigate('/workflow')} + role="button" + tabIndex={0} + onKeyDown={(e) => { if (e.key === 'Enter') handleNavigate('/workflow'); }} + > +
+
+
{task.node_name || task.definition_name || '流程任务'}
+
+ {task.definition_name || '工作流'} + {task.status === 'pending' ? '待处理' : task.status} +
+
+ 一般 +
-
- 一般 - -
- )) - )} -
-
- + )) + )} +
+
+ - -
-
- - 最近动态 -
-
- {activitiesLoading ? ( -
- ) : recentActivities.length === 0 ? ( - - ) : ( - recentActivities.map((log) => ( -
-
- {RESOURCE_ICONS[log.resource_type] || } -
-
-
- {formatActionLabel(log.action)}了{formatResourceLabel(log.resource_type)} + +
+
+ + 最近动态 +
+
+ {activitiesLoading ? ( +
+ ) : recentActivities.length === 0 ? ( + + ) : ( + recentActivities.map((log) => ( +
+
+ {RESOURCE_ICONS[log.resource_type] || } +
+
+
+ {formatActionLabel(log.action)}了{formatResourceLabel(log.resource_type)} +
+
{formatTimeAgo(log.created_at)}
+
-
{formatTimeAgo(log.created_at)}
-
-
- )) - )} -
-
- + )) + )} +
+
+ + + )} {/* 快捷入口 */} @@ -361,6 +387,26 @@ export default function Home() {
+ + {/* 主任团队概览 */} + {role === 'admin' && ( + + + + + + )} + + {/* 行动详情抽屉 */} + { setDrawerOpen(false); setDrawerItem(null); }} + onActionComplete={() => { + setDrawerOpen(false); + setDrawerItem(null); + }} + />
); }