handleSend() 方法 - 触发切换到发送面板historyPanelSwitchSlice.ts - 面板切换状态管理
switchToSendPanel action - 切换到发送面板switchToOperationPanel action - 切换回操作面板
pacsNodeSlice.ts - PACS节点状态管理(需要创建)
pacsNodes state - 存储PACS节点列表loading state - 加载状态error state - 错误信息selectedNodeIds state - 选中的节点ID列表fetchPacsNodesThunk - 异步获取节点的thunktoggleNodeSelection action - 切换节点选中状态selectAllNodes action - 全选节点deselectAllNodes action - 取消全选getPacsNodeList() - 获取PACS节点列表(已存在)PacsNode - 节点数据结构PacsNodeListResponse - API响应结构src/states/output/pacsNodeSlice.ts - PACS节点状态管理slicesrc/pages/output/SendPanel.tsx - 改造为动态加载PACS节点列表src/states/store.ts - 注册新的pacsNode reducer用户 ActionPanel historyPanelSwitchSlice SendPanel pacsNodeSlice API
│ │ │ │ │ │
│─点击发送按钮─────>│ │ │ │ │
│ │ │ │ │ │
│ │─dispatch(switchToSendPanel)─>│ │ │ │
│ │ │ │ │ │
│ │ │─更新currentPanel─>│ │ │
│ │ │ 为'SendPanel' │ │ │
│ │ │ │ │ │
│ │ │ │─组件挂载────────>│ │
│ │ │ │ useEffect │ │
│ │ │ │ │ │
│ │ │ │ │─dispatch(fetchPacsNodesThunk)─>│
│ │ │ │ │ │
│ │ │ │ │ │─调用getPacsNodeList()
│ │ │ │ │ │
│ │ │ │ │<─返回节点列表───│
│ │ │ │ │ │
│ │ │ │<─更新nodes状态───│ │
│ │ │ │ loading=false │ │
│ │ │ │ │ │
│<─────显示节点列表────────────────────────────────────────────────│ │ │
│ │ │ │ │ │
│─选择节点─────────────────────────────────────────────────────>│ │ │
│ │ │ │ │ │
│ │ │ │─dispatch(toggleNodeSelection)─────>│ │
│ │ │ │ │ │
│ │ │ │<─更新selectedNodeIds───────────────│ │
│ │ │ │ │ │
│<─────更新UI(复选框选中状态)────────────────────────────────────│ │ │
│ │ │ │ │ │
│─点击发送图像按钮──────────────────────────────────────────────>│ │ │
│ │ │ │ │ │
│ │ │ │─调用发送API────────────────────────>│
│ │ │ │ (传入selectedNodeIds) │
│ │ │ │ │ │
│<─────显示发送结果────────────────────────────────────────────────│<─────────────────────────────────────│
│ │ │ │ │ │
用户操作 → dispatch(switchToSendPanel) → 面板切换 → SendPanel挂载
→ dispatch(fetchPacsNodesThunk) → 调用getPacsNodeList() API
→ 更新Redux state (pacsNodes, loading, error) → 组件重新渲染 → 显示节点列表
用户点击复选框 → dispatch(toggleNodeSelection(nodeId))
→ 更新selectedNodeIds数组 → 组件重新渲染 → 更新复选框状态
用户点击发送按钮 → 验证是否选中节点 → 调用发送API(selectedNodeIds, imageData)
→ 显示发送进度/结果 → 成功后可选返回操作面板
// pacsNodeSlice state
interface PacsNodeState {
nodes: PacsNode[]; // PACS节点列表
loading: boolean; // 加载状态
error: string | null; // 错误信息
selectedNodeIds: number[]; // 选中的节点ID列表
}
// PacsNode (已存在于pacsNodeActions.ts)
interface PacsNode {
id: number;
name: string;
type: string;
address: string;
port: number;
aet: string;
aec: string;
is_enabled: boolean;
is_default: boolean;
params?: Record<string, any>;
}
interface PacsNodeListResponse {
code: string;
description: string;
solution: string;
data: {
'@type': string;
scp: PacsNode[];
};
}
handleSend() 方法switchToSendPanel() actioncurrentPanel 为 'SendPanel'fetchPacsNodesThunk()getPacsNodeList() APItoggleNodeSelection(nodeId) action2025-01-10