diff --git a/src/components/hr/EmployeeManagement/EmployeeForm.tsx b/src/components/hr/EmployeeManagement/EmployeeForm.tsx index 268f05e4..1aab626c 100644 --- a/src/components/hr/EmployeeManagement/EmployeeForm.tsx +++ b/src/components/hr/EmployeeManagement/EmployeeForm.tsx @@ -287,6 +287,32 @@ export function EmployeeForm({ })); }; + // 부서 선택 변경 (id와 name 모두 업데이트) + const handleDepartmentSelect = (dpId: string, departmentId: string) => { + const dept = departments.find(d => String(d.id) === departmentId); + if (dept) { + setFormData(prev => ({ + ...prev, + departmentPositions: prev.departmentPositions.map(dp => + dp.id === dpId ? { ...dp, departmentId: String(dept.id), departmentName: dept.name } : dp + ), + })); + } + }; + + // 직책 선택 변경 (id와 name 모두 업데이트) + const handlePositionSelect = (dpId: string, positionId: string) => { + const position = titles.find(t => String(t.id) === positionId); + if (position) { + setFormData(prev => ({ + ...prev, + departmentPositions: prev.departmentPositions.map(dp => + dp.id === dpId ? { ...dp, positionId: String(position.id), positionName: position.name } : dp + ), + })); + } + }; + // 저장 const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); @@ -600,13 +626,20 @@ export function EmployeeForm({ {fieldSettings.showRank && (