From 9a4e8da0a053bb57bdb6e4f1171161112b3bada1 Mon Sep 17 00:00:00 2001 From: freedakgmail Date: Thu, 23 Jul 2026 17:11:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E8=81=98=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E5=90=8E=E6=A0=B9=E6=8D=AE=E8=A7=A3=E8=81=98=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E5=9C=A8=E8=81=8C/=E7=A6=BB=E8=81=8C?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 解聘日期<=今天:员工状态设为RESIGNED(离职) - 解聘日期>今天:员工状态保持ACTIVE(在职,未到解聘日) --- backend/src/services/termination.service.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/src/services/termination.service.ts b/backend/src/services/termination.service.ts index 9e869ab..9fda24f 100644 --- a/backend/src/services/termination.service.ts +++ b/backend/src/services/termination.service.ts @@ -157,9 +157,15 @@ export async function createTermination(orgId: string, userId: string, data: any }, }) + // 根据解聘日期判断在职/离职状态 + const termDate = new Date(data.terminationDate) + const today = new Date() + today.setHours(0, 0, 0, 0) + const isResigned = termDate <= today + await prisma.employee.update({ where: { id: data.employeeId }, - data: { status: 'RESIGNED' }, + data: { status: isResigned ? 'RESIGNED' : 'ACTIVE' }, }) await prisma.riskItem.updateMany({