import { useState, useEffect } from 'react' import { toast } from 'sonner' import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query' import { Building2, Users, CreditCard, Plus, Bell, Download, Upload, FileSpreadsheet, Clock, CheckCircle, AlertCircle, ClipboardList } from 'lucide-react' import api from '../lib/api' import { useAuthStore } from '../store/authStore' import Card from '../components/ui/Card' import Button from '../components/ui/Button' import { Input, Label, Select } from '../components/ui/Input' import Modal from '../components/ui/Modal' import { surveyPages, totalFeatures } from '../data/surveyData' export default function Settings() { const queryClient = useQueryClient() const [activeSection, setActiveSection] = useState<'org' | 'users' | 'plan' | 'notifications' | 'import' | 'export'>('org') const { data: orgData } = useQuery({ queryKey: ['org-settings'], queryFn: async () => { const res = await api.get('/settings/org') as any return res.data }, }) const { data: usersData } = useQuery({ queryKey: ['users'], queryFn: async () => { const res = await api.get('/settings/users') as any return res.data }, }) const updateOrgMutation = useMutation({ mutationFn: (data: any) => api.put('/settings/org', data), onSuccess: () => queryClient.invalidateQueries({ queryKey: ['org-settings'] }), }) const sections = [ { key: 'org' as const, label: '企业信息', icon: Building2 }, { key: 'users' as const, label: '用户管理', icon: Users }, { key: 'plan' as const, label: '套餐', icon: CreditCard }, { key: 'notifications' as const, label: '通知设置', icon: Bell }, { key: 'import' as const, label: '数据导入', icon: FileSpreadsheet }, { key: 'export' as const, label: '数据导出', icon: Download }, ] return (

系统设置

配置企业资料、用户权限、套餐与通知偏好

{sections.map((s) => { const Icon = s.icon return ( ) })}
{activeSection === 'org' && ( updateOrgMutation.mutate(data)} saving={updateOrgMutation.isPending} /> )} {activeSection === 'users' && } {activeSection === 'plan' && } {activeSection === 'notifications' && } {activeSection === 'import' && } {activeSection === 'export' && (

数据导出

)}
) } function OrgSettings({ orgData, onSave, saving }: { orgData: any; onSave: (data: any) => void; saving: boolean }) { const [form, setForm] = useState({ name: '', contactName: '', contactPhone: '', payrollFrequency: 1, retirementReminderEnabled: false, }) useEffect(() => { if (orgData) { setForm({ name: orgData.name || '', contactName: orgData.contactName || '', contactPhone: orgData.contactPhone || '', payrollFrequency: orgData.payrollFrequency || 1, retirementReminderEnabled: orgData.retirementReminderEnabled || false, }) } }, [orgData]) return (

企业信息

setForm({ ...form, name: e.target.value })} placeholder="企业名称" />
setForm({ ...form, contactName: e.target.value })} placeholder="联系人姓名" />
setForm({ ...form, contactPhone: e.target.value })} placeholder="联系电话" />

设置每月发薪批次数,系统将按此数量管理发薪批次

{ setForm({ ...form, retirementReminderEnabled: v }); onSave({ ...form, retirementReminderEnabled: v }) }} />
) } function RetirementSection({ enabled, onToggle }: { enabled: boolean; onToggle: (v: boolean) => void }) { const queryClient = useQueryClient() const [confirming, setConfirming] = useState(false) const { data: policyData, isLoading } = useQuery({ queryKey: ['retirement-policy'], queryFn: async () => { const res = await api.get('/settings/retirement-policy') as any return res.data }, enabled, }) const confirmMutation = useMutation({ mutationFn: (id: string) => api.post(`/settings/retirement-policy/${id}/confirm`), onSuccess: () => { toast.success('退休政策已确认生效') setConfirming(false) queryClient.invalidateQueries({ queryKey: ['retirement-policy'] }) }, onError: () => toast.error('确认失败'), }) const confirmed = policyData?.confirmed const pending = policyData?.pending const renderPolicyRules = () => (
改革规则(基准退休年龄 → 目标退休年龄)
男性职工
60岁 → 63岁
每4个月延1个月
女性干部
55岁 → 58岁
每4个月延1个月
女性工人
50岁 → 55岁
每2个月延1个月

个人退休年龄根据出生年月逐人计算,达到基准退休年龄的时间点不同,延迟月数也不同。

) return (

退休提醒

{enabled && (
{pending && ( )}
)}
{enabled && (
{/* 当前生效政策 */} {confirmed && (
当前生效政策(v{confirmed.version}) 确认于 {new Date(confirmed.confirmedAt).toLocaleDateString('zh-CN')}
{renderPolicyRules()}
)} {/* 待确认政策 */} {pending && (
检测到新政策版本(v{pending.version}),请确认后生效
{renderPolicyRules()}
)} {/* 无政策 */} {!confirmed && !pending && !isLoading && (

暂无退休政策数据,系统将自动获取最新政策

)} {isLoading &&

加载中...

}
)}
) } function UserSettings({ usersData }: { usersData: any }) { const queryClient = useQueryClient() const [showAddModal, setShowAddModal] = useState(false) const [editingUser, setEditingUser] = useState(null) const users = usersData || [] const updateMutation = useMutation({ mutationFn: ({ id, data }: { id: string; data: any }) => api.put(`/settings/users/${id}`, data), onSuccess: () => queryClient.invalidateQueries({ queryKey: ['users'] }), }) const toggleDisableMutation = useMutation({ mutationFn: (id: string) => api.patch(`/settings/users/${id}/toggle-disable`), onSuccess: () => queryClient.invalidateQueries({ queryKey: ['users'] }), }) return (

用户管理

{users.map((u: any) => ( ))}
姓名 手机号 角色 状态 最近登录 操作
{u.name} {u.phone} {u.role === 'ADMIN' ? '管理员' : u.role === 'HR' ? 'HR' : '查看者'} {u.disabled ? '已禁用' : '正常'} {u.lastLoginAt ? new Date(u.lastLoginAt).toLocaleString('zh-CN', { month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' }) : '—'}
setShowAddModal(false)} /> setEditingUser(null)} onSave={(data) => { updateMutation.mutate({ id: editingUser.id, data }); setEditingUser(null) }} />
) } function EditUserModal({ user, onClose, onSave }: { user: any; onClose: () => void; onSave: (data: any) => void }) { const [form, setForm] = useState({ name: '', phone: '', role: 'HR' }) const [loading, setLoading] = useState(false) const [error, setError] = useState('') useEffect(() => { if (user) { setForm({ name: user.name || '', phone: user.phone || '', role: user.role || 'HR' }) setError('') } }, [user]) const handleSubmit = async () => { setLoading(true) setError('') try { onSave(form) } catch (err: any) { setError(err.response?.data?.error?.message || '保存失败') } finally { setLoading(false) } } if (!user) return null return (
{error &&
{error}
}
setForm({ ...form, name: e.target.value })} />
setForm({ ...form, phone: e.target.value })} maxLength={11} />
) } function AddUserModal({ open, onClose }: { open: boolean; onClose: () => void }) { const [form, setForm] = useState({ name: '', phone: '', password: '', role: 'HR' }) const [loading, setLoading] = useState(false) const [error, setError] = useState('') const handleSubmit = async () => { setLoading(true) setError('') try { await api.post('/settings/users', form) onClose() } catch (err: any) { setError(err.response?.data?.error?.message || '添加失败') } finally { setLoading(false) } } return (
{error &&
{error}
}
setForm({ ...form, name: e.target.value })} />
setForm({ ...form, phone: e.target.value })} maxLength={11} />
setForm({ ...form, password: e.target.value })} />
) } function ExportSettings() { const [format, setFormat] = useState<'json' | 'excel'>('json') const [mask, setMask] = useState(false) const [gzip, setGzip] = useState(true) const [exporting, setExporting] = useState(false) const [selectedModules, setSelectedModules] = useState>({ employees: true, contracts: true, terminations: true, payrollBatches: true, payslips: true, socialRecords: true, housingRecords: true, riskItems: true, }) const moduleLabels: Record = { employees: '员工信息', contracts: '劳动合同', terminations: '离职记录', payrollBatches: '发薪批次', payslips: '工资条', socialRecords: '社保记录', housingRecords: '公积金记录', riskItems: '风险项', } const handleExport = async () => { setExporting(true) try { const token = useAuthStore.getState().accessToken const modules = Object.keys(selectedModules).filter(k => selectedModules[k]).join(',') const params = new URLSearchParams({ format, mask: String(mask), modules }) if (format === 'json' && !gzip) params.set('gzip', 'false') const res = await fetch(`/api/v1/export/all?${params}`, { headers: token ? { Authorization: `Bearer ${token}` } : {}, }) const blob = await res.blob() const url = URL.createObjectURL(blob) const a = document.createElement('a') a.href = url const ext = format === 'excel' ? 'xlsx' : (gzip ? 'json.gz' : 'json') a.download = `export-${new Date().toISOString().slice(0, 10)}.${ext}` a.click() URL.revokeObjectURL(url) } catch { toast.error('导出失败') } } return (

选择需要导出的数据模块和格式

{Object.keys(moduleLabels).map(key => ( ))}
{format === 'json' && ( )}
{/* 问卷结果分析导出 */}

问卷结果分析导出

将功能调查问卷的填写结果导出为 Markdown 文档,包含每项功能的评分、有用性和备注

) } /** 导出问卷结果为 Markdown 文档 */ function handleSurveyExport() { try { const raw = localStorage.getItem('survey-results') if (!raw) { toast.info('暂无已提交的问卷结果,请先在功能调查问卷中提交') return } const data = JSON.parse(raw) const items: Array<{ featureId: string; score: number; useful: string; remark: string }> = data.items || [] if (items.length === 0) { toast.info('问卷结果为空') return } const scoreMap = new Map(items.map(i => [i.featureId, i])) const usefulLabels: Record = { yes: '有用', no: '无用', maybe: '待定', '': '' } const submittedAt = data.submittedAt ? new Date(data.submittedAt).toLocaleString('zh-CN') : '' let md = `# 功能调查问卷结果分析\n\n` md += `> **导出时间:** ${new Date().toLocaleString('zh-CN')}\n` if (submittedAt) md += `> **提交时间:** ${submittedAt}\n` md += `> **总功能数:** ${totalFeatures}\n` md += `> **已评功能数:** ${items.length}\n\n` const rated = items.filter(i => i.score > 0) const avgScore = rated.length > 0 ? (rated.reduce((s, i) => s + i.score, 0) / rated.length).toFixed(2) : '0' const usefulCount = items.filter(i => i.useful === 'yes').length const notUsefulCount = items.filter(i => i.useful === 'no').length const maybeCount = items.filter(i => i.useful === 'maybe').length md += `## 统计概览\n\n` md += `| 指标 | 数值 |\n|------|------|\n` md += `| 已评功能数 | ${items.length} / ${totalFeatures} |\n` md += `| 平均评分 | ${avgScore} / 5 |\n` md += `| 标记有用 | ${usefulCount} |\n` md += `| 标记无用 | ${notUsefulCount} |\n` md += `| 标记待定 | ${maybeCount} |\n\n` md += `## 评分分布\n\n` for (let s = 5; s >= 1; s--) { const count = rated.filter(i => i.score === s).length const pct = rated.length > 0 ? ((count / rated.length) * 100).toFixed(1) : '0' md += `- **${s}星**:${count} 项(${pct}%)\n` } md += `\n` md += `## 详细评分\n\n` for (const page of surveyPages) { const pageItems = page.features.filter(f => scoreMap.has(f.id)) if (pageItems.length === 0) continue md += `### ${page.id}. ${page.name}\n\n` md += `> 📍 ${page.menu}` if (page.tab) md += ` | Tab: ${page.tab}` md += `\n\n` md += `| # | 功能 | 评分 | 有用性 | 备注 |\n` md += `|---|------|:----:|:------:|------|\n` for (const f of pageItems) { const s = scoreMap.get(f.id)! const stars = '★'.repeat(s.score) + '☆'.repeat(5 - s.score) md += `| ${f.id} | ${f.name} | ${stars} (${s.score}) | ${usefulLabels[s.useful] || ''} | ${s.remark || ''} |\n` } md += `\n` } md += `## 低分功能(≤2分)\n\n` const lowScore = rated.filter(i => i.score <= 2).sort((a, b) => a.score - b.score) if (lowScore.length > 0) { md += `| # | 功能 | 评分 | 备注 |\n|---|------|:----:|------|\n` for (const item of lowScore) { const feat = surveyPages.flatMap(p => p.features).find(f => f.id === item.featureId) md += `| ${item.featureId} | ${feat?.name || item.featureId} | ${item.score} | ${item.remark || ''} |\n` } } else { md += `无低分功能\n` } md += `\n` md += `## 高分功能(≥4分)\n\n` const highScore = rated.filter(i => i.score >= 4).sort((a, b) => b.score - a.score) if (highScore.length > 0) { md += `| # | 功能 | 评分 | 备注 |\n|---|------|:----:|------|\n` for (const item of highScore) { const feat = surveyPages.flatMap(p => p.features).find(f => f.id === item.featureId) md += `| ${item.featureId} | ${feat?.name || item.featureId} | ${item.score} | ${item.remark || ''} |\n` } } else { md += `无高分功能\n` } md += `\n---\n*由企业用工专家系统自动生成*\n` const blob = new Blob([md], { type: 'text/markdown;charset=utf-8' }) const url = URL.createObjectURL(blob) const a = document.createElement('a') a.href = url a.download = `survey-results-${new Date().toISOString().slice(0, 10)}.md` a.click() URL.revokeObjectURL(url) toast.success('问卷结果已导出为 Markdown 文档') } catch { toast.error('导出问卷结果失败') } } function PlanSettings({ orgData }: { orgData: any }) { const queryClient = useQueryClient() const plan = orgData?.plan || 'FREE' const { data: usageData } = useQuery({ queryKey: ['usage'], queryFn: async () => { const res = await api.get('/settings/usage') as any return res.data }, }) const planMutation = useMutation({ mutationFn: (newPlan: string) => api.put('/settings/plan', { plan: newPlan }), onSuccess: () => { queryClient.invalidateQueries({ queryKey: ['org'] }) queryClient.invalidateQueries({ queryKey: ['usage'] }) }, }) const plans = [ { key: 'FREE', label: '免费版', price: '¥0/月', features: ['10人以内', '基础风险检测', '10次AI问答/月'] }, { key: 'PRO', label: '专业版', price: '¥299/月', features: ['100人以内', '全功能风险检测', '100次AI问答/月', '合同审查'] }, { key: 'ENTERPRISE', label: '企业版', price: '联系客服', features: ['无限人数', '无限AI问答', '专属客服', 'API接入'] }, ] return (
{usageData && (

当前用量

员工数
{usageData.employeeCount}/{usageData.maxEmployees}
AI 对话
{usageData.aiConversations}
合同数
{usageData.contracts}
)}
{plans.map((p) => (
{p.label}
{p.price}
{p.features.map((f, i) => (
{f}
))}
{plan === p.key ? (
当前套餐
) : ( )}
))}
) } function NotificationSettings() { const queryClient = useQueryClient() const [form, setForm] = useState({}) const [checkResult, setCheckResult] = useState('') const { data: setting } = useQuery({ queryKey: ['notification-settings'], queryFn: async () => { const res = await api.get('/notifications/settings') as any return res.data }, }) const { data: logsData } = useQuery({ queryKey: ['notification-logs'], queryFn: async () => { const res = await api.get('/notifications/logs', { params: { pageSize: 10 } }) as any return res.data }, }) useEffect(() => { if (setting) setForm(setting) }, [setting]) const updateMutation = useMutation({ mutationFn: (data: any) => api.put('/notifications/settings', data), onSuccess: () => queryClient.invalidateQueries({ queryKey: ['notification-settings'] }), }) const checkMutation = useMutation({ mutationFn: () => api.post('/notifications/check-contracts') as any, onSuccess: (res: any) => { setCheckResult(`检查完成:发现 ${res.data.checked} 个即将到期的合同,已发送 ${res.data.notified} 条通知`) queryClient.invalidateQueries({ queryKey: ['notification-logs'] }) }, }) const testWechatMutation = useMutation({ mutationFn: () => api.post('/notifications/test', { channel: 'wechat' }) as any, onSuccess: (res: any) => { toast.success(res.success ? res.data.message : (res.error?.message || '测试失败')) }, }) const testEmailMutation = useMutation({ mutationFn: () => api.post('/notifications/test', { channel: 'email' }) as any, onSuccess: (res: any) => { toast.success(res.success ? res.data.message : (res.error?.message || '测试失败')) }, }) const logs = logsData?.items || [] return (

通知设置

setForm({ ...form, expiryDays: Number(e.target.value) })} />
月度事务提醒
设置每月截止日,到期后自动生成待办提醒
setForm({ ...form, payrollDay: Number(e.target.value) })} />
setForm({ ...form, socialInsDay: Number(e.target.value) })} />
setForm({ ...form, housingFundDay: Number(e.target.value) })} />
setForm({ ...form, taxDay: Number(e.target.value) })} />
setForm({ ...form, wechatWebhook: e.target.value || null })} placeholder="https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=..." />
{form.emailNotify && (
setForm({ ...form, email: e.target.value || null })} placeholder="hr@example.com" />
)}

合同到期检查

{checkResult && (
{checkResult}
)} {logs.length > 0 ? (
{logs.map((log: any) => (
{log.title}
{log.content}
{new Date(log.createdAt).toLocaleString('zh-CN')}
))}
) : (
暂无通知记录
)}
) } export function ImportSettings() { const [importType, setImportType] = useState<'init' | 'monthly'>('init') return (
{importType === 'init' ? : }
) } function InitImport() { const queryClient = useQueryClient() const [file, setFile] = useState(null) const [result, setResult] = useState(null) const [uploading, setUploading] = useState(false) const [error, setError] = useState('') const [preview, setPreview] = useState(null) const [previewing, setPreviewing] = useState(false) const [previewTab, setPreviewTab] = useState('employees') const handlePreview = async () => { if (!file) return setPreviewing(true) setError('') setPreview(null) try { const token = useAuthStore.getState().accessToken const formData = new FormData() formData.append('file', file) const res = await fetch('/api/v1/import/excel/preview', { method: 'POST', headers: token ? { Authorization: `Bearer ${token}` } : {}, body: formData, }) const data = await res.json() if (!data.success) { setError(data.error?.message || '预览失败') } else { setPreview(data.data) } } catch (e: any) { setError(e?.message || '预览失败') } finally { setPreviewing(false) } } const handleExportErrors = async () => { if (!preview?.errors?.length) return try { const token = useAuthStore.getState().accessToken const res = await fetch('/api/v1/import/excel/error-log', { method: 'POST', headers: { 'Content-Type': 'application/json', ...(token ? { Authorization: `Bearer ${token}` } : {}), }, body: JSON.stringify({ errors: preview.errors }), }) const blob = await res.blob() const url = URL.createObjectURL(blob) const a = document.createElement('a') a.href = url a.download = `import-errors-${Date.now()}.xlsx` a.click() URL.revokeObjectURL(url) } catch { toast.error('导出错误日志失败') } } const handleUpload = async () => { if (!file) return setUploading(true) setError('') setResult(null) try { const token = useAuthStore.getState().accessToken const formData = new FormData() formData.append('file', file) const res = await fetch('/api/v1/import/excel', { method: 'POST', headers: token ? { Authorization: `Bearer ${token}` } : {}, body: formData, }) const data = await res.json() if (!data.success) { setError(data.error?.message || '导入失败') } else { setResult(data.data) queryClient.invalidateQueries({ queryKey: ['roster'] }) queryClient.invalidateQueries({ queryKey: ['dashboard'] }) } } catch (e: any) { setError(e?.message || '上传失败') } finally { setUploading(false) } } const handleDownloadTemplate = async () => { try { const token = useAuthStore.getState().accessToken const baseURL = import.meta.env.DEV ? 'http://localhost:3000/api/v1' : '/api/v1' const res = await fetch(`${baseURL}/import/template`, { headers: token ? { Authorization: `Bearer ${token}` } : {}, }) const blob = await res.blob() const url = URL.createObjectURL(blob) const a = document.createElement('a') a.href = url a.download = '员工导入模板.xlsx' a.click() URL.revokeObjectURL(url) } catch { setError('下载模板失败') } } return (

初始化数据导入

首次使用系统时,批量导入已有员工、合同、历史考勤/加班/违纪记录

{ setFile(e.target.files?.[0] || null); setResult(null); setError(''); setPreview(null) }} className="hidden" id="import-file-init" />
{error &&
{error}
} {preview && (
预览:共 {preview.summary?.totalRows || 0} 行,正常 {preview.summary?.normalRows || 0} 行,错误 {preview.summary?.errorRows || 0} 行
{preview.errors?.length > 0 && ( )}
{['employees', 'contracts', 'overtime', 'disciplinary', 'attendance'].map(tab => { const labels: any = { employees: '员工信息', contracts: '劳动合同', overtime: '加班记录', disciplinary: '违纪记录', attendance: '考勤记录' } const rows = preview[tab] || [] if (rows.length === 0) return null return ( ) })}
{(preview[previewTab] || []).map((row: any, i: number) => ( ))}
行号 姓名 状态 错误/警告
{row.rowNo} {row.name || row.idCard || '—'} {row.status === 'error' ? '错误' : row.status === 'warning' ? '警告' : '正常'} {row.errors?.join('; ') || row.warnings?.join('; ') || '—'}
)} {result && (
导入完成
员工:{result.employees} 人
合同:{result.contracts} 份
{result.overtime > 0 &&
加班记录:{result.overtime} 条
} {result.disciplinary > 0 &&
违纪记录:{result.disciplinary} 条
} {result.attendance > 0 &&
考勤记录:{result.attendance} 条
} {result.errors?.length > 0 && (
部分错误({result.errors.length}条):
{result.errors.slice(0, 10).map((e: string, i: number) => (
{e}
))} {result.errors.length > 10 &&
...还有 {result.errors.length - 10} 条
}
)}
)}
Sheet 页说明
- 员工信息:姓名、部门、性别、手机号、身份证号、入职日期、月工资、社保基数、公积金基数等
- 劳动合同:身份证号(优先匹配)、姓名(备选)、合同类型、签订日期、起止日期、试用期等
- 加班记录:身份证号(优先匹配)、姓名(备选)、日期、加班时长、加班类型
- 违纪记录:身份证号(优先匹配)、姓名(备选)、日期、违纪类型、描述、处罚
- 考勤记录:身份证号(优先匹配)、姓名(备选)、日期、考勤状态、上下班时间
各 Sheet 优先用「身份证号」精确匹配员工,未填身份证号时用「姓名」兑底(重名可能匹配错误)
) } function MonthlyImport() { const queryClient = useQueryClient() const [file, setFile] = useState(null) const [month, setMonth] = useState(new Date().toISOString().slice(0, 7)) const [result, setResult] = useState(null) const [uploading, setUploading] = useState(false) const [error, setError] = useState('') const handleUpload = async () => { if (!file) return setUploading(true) setError('') setResult(null) try { const token = useAuthStore.getState().accessToken const formData = new FormData() formData.append('file', file) formData.append('month', month) const res = await fetch('/api/v1/import/monthly', { method: 'POST', headers: token ? { Authorization: `Bearer ${token}` } : {}, body: formData, }) const data = await res.json() if (!data.success) { setError(data.error?.message || '导入失败') } else { setResult(data.data) queryClient.invalidateQueries({ queryKey: ['roster'] }) queryClient.invalidateQueries({ queryKey: ['dashboard'] }) } } catch (e: any) { setError(e?.message || '上传失败') } finally { setUploading(false) } } const handleDownloadTemplate = async () => { try { const token = useAuthStore.getState().accessToken const baseURL = import.meta.env.DEV ? 'http://localhost:3000/api/v1' : '/api/v1' const res = await fetch(`${baseURL}/import/monthly-template`, { headers: token ? { Authorization: `Bearer ${token}` } : {}, }) const blob = await res.blob() const url = URL.createObjectURL(blob) const a = document.createElement('a') a.href = url a.download = '月度增减员导入模板.xlsx' a.click() URL.revokeObjectURL(url) } catch { setError('下载模板失败') } } return (

月度数据导入

每月定期导入当月考勤、加班、薪资调整、社保/公积金增减员变动

setMonth(e.target.value)} className="!w-40" />
{ setFile(e.target.files?.[0] || null); setResult(null); setError('') }} className="hidden" id="import-file-monthly" />
{error &&
{error}
} {result && (
{result.month} 月度导入完成
{result.attendance > 0 &&
考勤记录:{result.attendance} 条
} {result.overtime > 0 &&
加班记录:{result.overtime} 条
} {result.salaryChanges > 0 &&
薪资调整:{result.salaryChanges} 人
} {result.socialInsChanges > 0 &&
社保变动:{result.socialInsChanges} 人
} {result.housingFundChanges > 0 &&
公积金变动:{result.housingFundChanges} 人
} {result.strategies && (
覆盖策略:
{Object.entries(result.strategies).map(([k, v]) => (
{k}:{v as string}
))}
)} {result.errors?.length > 0 && (
部分错误({result.errors.length}条):
{result.errors.slice(0, 10).map((e: string, i: number) => (
{e}
))} {result.errors.length > 10 &&
...还有 {result.errors.length - 10} 条
}
)}
)}
Sheet 页说明
- 考勤记录:身份证号(优先匹配)、姓名(备选)、日期、考勤状态、上下班时间(同日重复导入会覆盖)
- 加班记录:身份证号(优先匹配)、姓名(备选)、日期、加班时长、加班类型(同月重复导入会累加)
- 薪资调整:身份证号(优先匹配)、姓名(备选)、调整后月薪、生效日期、调薪原因(自动关闭旧薪资记录)
- 社保变动:身份证号(优先匹配)、姓名(备选)、变动类型(增员/调基/减员)、缴费基数
- 公积金变动:身份证号(优先匹配)、姓名(备选)、变动类型(增员/调基/减员)、缴费基数
所有 Sheet 优先用「身份证号」精确匹配员工,未填时用「姓名」兑底(重名可能匹配错误)
) }