org-scope.ts
5.39 KB
-
feat(auth): org 树改递归结构 —— 层级无限(支持多级区域) · 07a32a03
之前 OrgTree 是写死的 3 层形状 { groupId, brands:{clinics[]} },塞不进区域层。 改成递归 OrgNode(children 无限嵌套):集团→多级区域→品牌→诊所→…均可。 expand 逻辑不变 —— 过滤永远只落 sourceUnits/clinicIds 两维,中间层只是分组, 展开任意节点 = 走子树收集这两类叶子属性。 - OrgNode 递归类型 + buildTree(通用) ;buildOrgTree(3 层糖)签名/tree.groupId 不变 - sourceUnit 命名空间**向下继承**:scope 到单诊所时带上祖先品牌, 否则 sourceUnits 退化成空(不限品牌)= 越权看全品牌患者(测试抓出,已修) - 扁平索引按 id **聚合**(数组),同一品牌跨多个区域时全收,不被 Map 覆盖丢诊所 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>luoqi committed