fix: 组织架构树分支层点击可选中查看成员(评审发现的行为回归)

This commit is contained in:
chenpei 2026-08-14 17:28:40 +08:00
parent ab2d24b95c
commit 1a2b9b0c52

View File

@ -282,22 +282,33 @@ export default function OrgPage() {
<div key={node.id}>
<button
type="button"
onClick={() => (hasChildren ? toggleExpand(node.id) : selectNode(node))}
onClick={() => selectNode(node)}
className={`w-full flex items-center gap-2 px-3 py-2 text-left transition-colors ${
isSelected ? 'bg-[#e3ecf5]' : 'hover:bg-[#f7f8fa]'
}`}
style={{ paddingLeft: `${12 + depth * 16}px` }}
>
{hasChildren ? (
<svg
className={`w-3 h-3 text-[#8a94a0] transition-transform ${isExpanded ? 'rotate-90' : ''}`}
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
aria-hidden="true"
<span
role="button"
tabIndex={-1}
aria-label={isExpanded ? '收起' : '展开'}
onClick={(e) => {
e.stopPropagation()
toggleExpand(node.id)
}}
className="shrink-0 cursor-pointer"
>
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2.5} d="M9 5l7 7-7 7" />
</svg>
<svg
className={`w-3 h-3 text-[#8a94a0] transition-transform ${isExpanded ? 'rotate-90' : ''}`}
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
aria-hidden="true"
>
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2.5} d="M9 5l7 7-7 7" />
</svg>
</span>
) : (
<span className="w-3 inline-block" aria-hidden="true" />
)}