// REQ-USR-003: 左侧角色/流程树(按角色/按流程分组 + 计数;点击高亮,不取数,BR11)。 import { useState } from 'react'; import type { GroupItem } from './dashboardData'; import styles from './HomePage.module.css'; interface RoleProcessTreeProps { roleGroups: GroupItem[]; processGroups: GroupItem[]; onSelect?: (label: string) => void; } export default function RoleProcessTree({ roleGroups, processGroups, onSelect, }: RoleProcessTreeProps) { // 本地高亮态:默认高亮「所有部门」(复刻原型首项 active) const [activeLabel, setActiveLabel] = useState('所有部门'); const handleClick = (label: string) => { setActiveLabel(label); onSelect?.(label); }; const renderItem = (g: GroupItem, keyPrefix: string) => ( ); return (
按角色
{roleGroups.map((g) => renderItem(g, 'role'))}
按流程
{processGroups.map((g) => renderItem(g, 'proc'))}
); }