Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VDJVpPiGiWjJP1yVvvGhzQ
This commit is contained in:
@@ -1,3 +1,24 @@
|
||||
// HR 的主管掛在組織單位上(集團/公司/部/組),一個人可能同時是多個單位的主管,
|
||||
// 也可能是「次要」主管。兩者都算管理職。
|
||||
export function supervisorIndex(organizations) {
|
||||
const index = new Map();
|
||||
for (const unit of Array.isArray(organizations) ? organizations : []) {
|
||||
for (const supervisor of Array.isArray(unit?.supervisors) ? unit.supervisors : []) {
|
||||
const number = supervisor?.EmployeeNumber;
|
||||
if (!number) continue;
|
||||
const entry = index.get(String(number)) || [];
|
||||
entry.push({
|
||||
deptCode: unit.deptCode,
|
||||
deptName: unit.deptName,
|
||||
levelName: unit.levelName,
|
||||
secondary: supervisor.HierachyRelationshipName === '次要',
|
||||
});
|
||||
index.set(String(number), entry);
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
// Classify only units explicitly marked as a department or group in HR's tree.
|
||||
export function splitOrganization(employee, organizations) {
|
||||
const byCode = new Map(organizations.map(unit => [unit.deptCode, unit]));
|
||||
|
||||
Reference in New Issue
Block a user