From 3969754fa4893ce603d9c788322f98bcbd490066 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?walkdoggo=2Eyeh=5F=E8=91=89=E5=82=B3=E8=80=80?= Date: Tue, 17 Nov 2026 04:09:22 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=8B=B1=E6=96=87=E5=90=8D=E5=8F=AA?= =?UTF-8?q?=E5=9B=9E=E5=82=B3=E6=AC=8A=E9=99=90=E7=AF=84=E5=9C=8D=E5=85=A7?= =?UTF-8?q?=E7=9A=84=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01VDJVpPiGiWjJP1yVvvGhzQ --- english-names.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/english-names.js b/english-names.js index 18a4635..f060408 100644 --- a/english-names.js +++ b/english-names.js @@ -38,3 +38,15 @@ export function englishNameMap(people, store) { } return names; } + +// 只回傳這個人看得到的人:最高管理者、全公司檢視看全部;部主管看自己部門;組主管看自己的組。 +export function visiblePeople(people, permission) { + if (!permission || permission.denied) return []; + if (permission.admin || permission.company) return people || []; + const depts = new Set(permission.depts || []); + const groups = new Set(permission.groups || []); + return (people || []).filter(p => { + const dept = String(p?.dept || '').trim(); + return depts.has(dept) || groups.has(`${dept}|${p?.group || '未分組'}`); + }); +}