fix: 线下签署登记标题英文转中文+完成时间时区+签署记录角标

1. documentTitle 中 contractType 枚举值转中文
   (LABOR→劳务协议、FIXED→固定期限劳动合同等)
2. 签署日期解析改为本地时区构造(new Date(y,m-1,d,12)),
   避免 new Date('2026-08-16') 被解析为 UTC 00:00 导致
   本地 +8 显示为 08:00:00
3. 签署记录 Tab 增加数字角标显示总记录数

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
selfrelease
2026-08-16 12:26:13 +08:00
parent 72a6eab3bd
commit 5a9d440339
9 changed files with 485 additions and 3 deletions
+17 -2
View File
@@ -214,7 +214,10 @@ router.post('/sign-date', async (req: AuthRequest, res: Response, next: NextFunc
if (contract.signMethod === 'ELECTRONIC') {
return res.status(400).json({ success: false, error: { code: 'VALIDATION_ERROR', message: '电子签合同的签署日期由电签系统自动回写,不可手动修改' } })
}
const parsedDate = new Date(signDate)
// 解析日期字符串(YYYY-MM-DD),手动构造本地中午时间避免时区偏移
const dateStr = String(signDate).slice(0, 10)
const [y, m, d] = dateStr.split('-').map(Number)
const parsedDate = new Date(y, (m || 1) - 1, d || 1, 12, 0, 0, 0)
if (isNaN(parsedDate.getTime())) {
return res.status(400).json({ success: false, error: { code: 'VALIDATION_ERROR', message: '签署日期格式无效' } })
}
@@ -229,6 +232,18 @@ router.post('/sign-date', async (req: AuthRequest, res: Response, next: NextFunc
select: { id: true },
})
if (!existingRecord) {
// 合同类型枚举转中文
const CONTRACT_TYPE_LABEL: Record<string, string> = {
FIXED: '固定期限劳动合同',
UNFIXED: '无固定期限劳动合同',
UNSIGNED: '未签合同',
LABOR: '劳务协议',
INTERNSHIP: '实习协议',
DISPATCH: '劳务派遣合同',
OUTSOURCING: '外包合同',
PARTTIME: '非全日制合同',
}
const contractLabel = CONTRACT_TYPE_LABEL[contract.contractType] || '合同'
await prisma.eSignRecord.create({
data: {
orgId: req.user!.orgId,
@@ -236,7 +251,7 @@ router.post('/sign-date', async (req: AuthRequest, res: Response, next: NextFunc
employeeId: contract.employeeId,
scene: 'CONTRACT',
signMethod: 'PAPER',
documentTitle: `${contract.contractType}合同线下签署登记`,
documentTitle: `${contractLabel}线下签署登记`,
status: 'COMPLETED',
completedAt: parsedDate,
signedAt: parsedDate,