feat: 风险标题天数改为月数显示

This commit is contained in:
selfrelease
2026-07-31 10:59:33 +08:00
parent 6c008387ad
commit d4cc7e5e62
2 changed files with 9 additions and 9 deletions
+5 -5
View File
@@ -165,7 +165,7 @@ export async function detectContractRisks(orgId: string) {
employeeId: emp.id,
type: 'CONTRACT',
level: 'HIGH',
title: `${emp.name}入职${days}未签合同,已视为无固定期限`,
title: `${emp.name}入职${Math.round(days / 30)}个月未签合同,已视为无固定期限`,
description: `入职日期 ${emp.hireDate.toISOString().slice(0, 10)},超过1年未签订书面合同,法律上已视为无固定期限劳动合同。`,
actionUrl: `/contracts?employee=${encodeURIComponent(emp.name)}`,
})
@@ -174,7 +174,7 @@ export async function detectContractRisks(orgId: string) {
employeeId: emp.id,
type: 'CONTRACT',
level: 'HIGH',
title: `${emp.name}入职${days}未签合同`,
title: `${emp.name}入职${Math.round(days / 30)}个月未签合同`,
description: `入职日期 ${emp.hireDate.toISOString().slice(0, 10)},超过30天未签订书面合同,需尽快补签。`,
actionUrl: `/contracts?employee=${encodeURIComponent(emp.name)}`,
})
@@ -183,7 +183,7 @@ export async function detectContractRisks(orgId: string) {
employeeId: emp.id,
type: 'CONTRACT',
level: 'LOW',
title: `${emp.name}入职${days},尚未签合同`,
title: `${emp.name}入职${Math.round(days / 30)}个月,尚未签合同`,
description: `入职日期 ${emp.hireDate.toISOString().slice(0, 10)}30天内需签订书面合同。`,
actionUrl: `/contracts?employee=${encodeURIComponent(emp.name)}`,
})
@@ -266,7 +266,7 @@ export async function detectOnboardingRisks(orgId: string) {
employeeId: emp.id,
type: 'ONBOARDING',
level: daysSinceHire > 30 ? 'HIGH' : 'MEDIUM',
title: `${emp.name}入职手续未完成${daysSinceHire > 30 ? `(已超${daysSinceHire}` : ''}`,
title: `${emp.name}入职手续未完成${daysSinceHire > 30 ? `(已超${Math.round(daysSinceHire / 30)}个月` : ''}`,
description: `入职日期 ${emp.hireDate.toISOString().slice(0, 10)},尚未签订劳动合同,请尽快完成入职手续。`,
actionUrl: `/roster?employee=${encodeURIComponent(emp.name)}`,
})
@@ -1694,7 +1694,7 @@ export async function getAnnualValueReport(orgId: string, year: number) {
// 辅助:根据风险标题归并到风险类别 key(去掉天数等动态部分)
function getRiskCategoryKey(title: string): string {
if (title.includes('未签合同') && title.includes('无固定期限')) return 'CONTRACT_UNSIGNED_OVER_YEAR'
if (title.includes('未签合同') && title.includes('')) return 'CONTRACT_UNSIGNED'
if (title.includes('未签合同') && title.includes('个月')) return 'CONTRACT_UNSIGNED'
if (title.includes('到期') && title.includes('未续签')) return 'CONTRACT_EXPIRED'
if (title.includes('即将到期')) return 'CONTRACT_EXPIRING'
if (title.includes('试用期')) return 'CONTRACT_PROBATION'