diff --git a/frontend/src/pages/Termination.tsx b/frontend/src/pages/Termination.tsx index b6ba9b3..52ef3ac 100644 --- a/frontend/src/pages/Termination.tsx +++ b/frontend/src/pages/Termination.tsx @@ -294,6 +294,53 @@ export default function Termination() { }) } + // 模拟计算:只计算并暂存,不实际保存解聘记录 + const handleSimulate = () => { + if (!costResult || !selectedEmployee) return + setSavedItems((prev) => { + if (prev.some((item) => item.employeeId === employeeId)) { + return prev.map((item) => + item.employeeId === employeeId + ? { + employeeId, + name: selectedEmployee.name, + department: selectedEmployee.department, + reason, + reasonLabel, + terminationDate, + severancePay: costResult.severancePay, + noticePay: costResult.noticePay, + doublePay: costResult.doublePay, + grandTotal: costResult.grandTotal, + years: costResult.years, + remainingMonths: costResult.remainingMonths, + compMonths: costResult.compMonths, + } + : item + ) + } + return [ + ...prev, + { + employeeId, + name: selectedEmployee.name, + department: selectedEmployee.department, + reason, + reasonLabel, + terminationDate, + severancePay: costResult.severancePay, + noticePay: costResult.noticePay, + doublePay: costResult.doublePay, + grandTotal: costResult.grandTotal, + years: costResult.years, + remainingMonths: costResult.remainingMonths, + compMonths: costResult.compMonths, + }, + ] + }) + handleReset() + } + // 保存成功后暂存到右侧列表 useEffect(() => { if (saveMutation.isSuccess && costResult && selectedEmployee) { @@ -816,9 +863,14 @@ export default function Termination() { 下一步 ) : ( - +
+ + +
)} )}