import Card from "../../components/ui/Card" import { UserX, DollarSign, Building2 } from "lucide-react" import { fmt, terminateReasonMap } from "./shared" import { CityHistoryTab } from "./PayslipSocialInfo" /** 变更历史Tab:分组显示各类变更记录 */ export default function ChangeHistoryTab({ profile }: { profile: any }) { const salaryChanges = profile.salaryChanges || [] const departmentRecords = profile.departmentRecords || [] const socialInsRecords = profile.socialInsRecords || [] const housingFundRecords = profile.housingFundRecords || [] const terminations = profile.terminations || [] const changeTypeMap: Record = { ONBOARDING: '入职', REHIRE: '重新入职', ADJUST: '调基', TERMINATION: '离职/解聘', SALARY_CHANGE: '调薪', TRANSFER: '调部门', CITY_CHANGE: '城市变更' } const changeTypeColor: Record = { ONBOARDING: 'bg-green-50 text-safe', REHIRE: 'bg-blue-50 text-blue-600', ADJUST: 'bg-amber-50 text-amber-600', TERMINATION: 'bg-red-50 text-danger', SALARY_CHANGE: 'bg-indigo-50 text-indigo-600', TRANSFER: 'bg-purple-50 text-purple-600', CITY_CHANGE: 'bg-cyan-50 text-cyan-600' } const totalChanges = salaryChanges.length + departmentRecords.length + socialInsRecords.length + housingFundRecords.length + terminations.length if (totalChanges === 0) { return
暂无变更记录
} return (
{/* 薪资变更 */} {salaryChanges.length > 0 && (

薪资变更历史({salaryChanges.length}条)

{salaryChanges.map((r: any, idx: number) => ( ))}
生效日期 原薪资 新薪资 变动额 类型 原因 失效年月
{new Date(r.effectiveDate).toLocaleDateString('zh-CN')} ¥{fmt(r.oldSalary)} ¥{fmt(r.newSalary)} {r.newSalary >= r.oldSalary ? '+' : ''}¥{fmt(r.newSalary - r.oldSalary)} {changeTypeMap[r.changeType] || r.changeType} {r.reason || '-'} {r.endMonth || '至今'}
)} {/* 部门变更 */} {departmentRecords.length > 0 && (

部门变更历史({departmentRecords.length}条)

{departmentRecords.map((r: any, idx: number) => ( ))}
生效年月 原部门 新部门 类型 原因 失效年月
{r.effectiveMonth} {r.oldDepartment || '无'} {r.newDepartment} {changeTypeMap[r.changeType] || r.changeType} {r.reason || '-'} {r.endMonth || '至今'}
)} {/* 参保城市变更(社保+公积金合并) */} {(socialInsRecords.length > 0 || housingFundRecords.length > 0) && ( )} {/* 离职/解聘记录 */} {terminations.length > 0 && (

离职/解聘记录({terminations.length}条)

{terminations.map((r: any, idx: number) => ( ))}
离职日期 离职类型 原因 备注 创建时间
{new Date(r.terminationDate).toLocaleDateString('zh-CN')} {terminateReasonMap[r.terminationType] || r.terminationType} {r.reason || '-'} {r.remark || '-'} {new Date(r.createdAt).toLocaleString('zh-CN')}
)}
) }