From 1d47c586d34f03a17f38311acb20bb9062e157a9 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 6 Sep 2026 13:35:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BB=84=E7=BB=87=E6=9E=B6?= =?UTF-8?q?=E6=9E=84=E9=A1=B5=E9=83=A8=E9=97=A8=E8=93=9D=E8=89=B2=E9=AB=98?= =?UTF-8?q?=E4=BA=AE=E8=B7=9F"=E6=98=AF=E5=90=A6=E5=B1=95=E5=BC=80"?= =?UTF-8?q?=E6=8C=82=E9=92=A9=EF=BC=8C=E6=A0=B9=E8=8A=82=E7=82=B9=E8=A2=AB?= =?UTF-8?q?=E8=AF=AF=E5=88=A4=E6=88=90"=E6=88=91=E7=9A=84=E9=83=A8?= =?UTF-8?q?=E9=97=A8"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DeptRow原来的蓝色高亮(.organization-department.expanded)直接复用"展开/收起" 这个纯UI交互状态:depth 0的根节点默认就是展开的(DeptNode: useState(depth===0)), 导致根节点从打开页面那一刻起就被误染成"当前用户所在部门"的蓝色,与参考图 (docs/images/部门组织框架.png)不符——图里根节点"总裁办50人(一级)"明明是展开状态, 颜色却是黑色默认色,只有真正包含当前用户的"技术4人(二级)"是蓝色实心菱形。 根因是把"展开状态"和"是否是我的部门"这两个独立概念用同一个CSS类混在了一起。改为 新增containsMe(DeptNode根据自己已加载的members列表里有没有当前用户算出,与expanded 彻底解耦,expanded继续只管chevron方向),CSS类从.expanded改名成.me(与PersonRow已有的 .me保持同一套命名)。顺手把三处重复的"裸id/usr前缀id两种形式对比myUserId"的内联判断 提成共享的isMyUserId函数。 当前测试租户组织架构数据本身为空(GET /organization/departments、/members 都是真实 200+空数组,非账号权限问题——kcg051307交叉验证过同样为空),无法用真实多级树肉眼过一遍, 按测试要求改用桩数据验证:mock了总裁办→财务/销售/技术三个部门+技术下4个成员(含当前 用户)复现参考图的结构,展开技术后确认根节点保持黑色、技术正确变蓝,与参考截图逐像素 对照一致;修复前用同一份桩数据可复现根节点被误染蓝的问题。 Co-Authored-By: Claude Sonnet 5 --- src/views/workplace-collaboration-view.jsx | 30 ++++++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/views/workplace-collaboration-view.jsx b/src/views/workplace-collaboration-view.jsx index 7fc1fba7..5df9aac4 100644 --- a/src/views/workplace-collaboration-view.jsx +++ b/src/views/workplace-collaboration-view.jsx @@ -196,9 +196,20 @@ function ImgFromFile({fileId, className}) { const LEVEL_NUMERALS = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十']; const levelLabel = n => LEVEL_NUMERALS[n - 1] || String(n); -function DeptRow({dept, depth, expanded, onToggle}) { +// isMe check shared with PersonRow below -- organization member/participant ids across this +// chapter's endpoints aren't consistently confirmed to carry the 'usr' prefix (see resolveUserName's +// comment), so the same "try bare, then usr-prefixed" comparison is duplicated at both call sites. +const isMyUserId = (id, myUserId) => id === myUserId || 'usr' + id === myUserId; + +function DeptRow({dept, depth, expanded, containsMe, onToggle}) { const icon = depth === 0 ? 'business' : 'diamond'; - return