From b95676cb464485ee967628c0b8396f56863e87f5 Mon Sep 17 00:00:00 2001 From: freedakgmail Date: Thu, 23 Jul 2026 17:08:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=A7=A3=E8=81=98=E8=A1=A5=E5=81=BF?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E3=80=8C=E6=A8=A1=E6=8B=9F=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E3=80=8D=E6=8C=89=E9=92=AE=20=E2=80=94=20=E5=8F=AA=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E4=B8=8D=E5=AE=9E=E9=99=85=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Step 4 费用结算增加「模拟计算」按钮 - 点击后计算补偿金并暂存到右侧列表,重置向导 - 不调用保存接口,不创建解聘记录 - 「确认保存」仍走原有流程保存到后端 --- frontend/src/pages/Termination.tsx | 58 ++++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 3 deletions(-) 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() { 下一步 ) : ( - +
+ + +
)} )}