fix: 解聘保存后根据解聘日期判断在职/离职状态

- 解聘日期<=今天:员工状态设为RESIGNED(离职)
- 解聘日期>今天:员工状态保持ACTIVE(在职,未到解聘日)
This commit is contained in:
freedakgmail
2026-07-23 17:11:57 +08:00
parent b95676cb46
commit 9a4e8da0a0
+7 -1
View File
@@ -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({