diff --git a/backend/src/routes/portal.routes.ts b/backend/src/routes/portal.routes.ts index f9b0bcd..8a45f10 100644 --- a/backend/src/routes/portal.routes.ts +++ b/backend/src/routes/portal.routes.ts @@ -922,6 +922,9 @@ router.get('/profile', portalAuth, async (req: any, res, next) => { education: emp.education || '', city: emp.city || '', birthDate, + employeeNo: emp.employeeNo || '', + femaleWorkerType: emp.femaleWorkerType || '', + specialDeduction: emp.specialDeduction ?? 0, }, }) } catch (err) { next(err) } @@ -937,6 +940,7 @@ router.put('/profile', portalAuth, async (req: any, res, next) => { const { emergencyContact, emergencyPhone, address, bankAccount, bankName, education, city, + specialDeduction, } = req.body // 构建更新数据(仅允许员工自行编辑的字段) @@ -951,6 +955,10 @@ router.put('/profile', portalAuth, async (req: any, res, next) => { if (bankAccount !== undefined && bankAccount) { updateData.bankAccount = encrypt(bankAccount) } + // 专项附加扣除(子女教育、赡养老人等,员工自行填报) + if (specialDeduction !== undefined) { + updateData.specialDeduction = Number(specialDeduction) || 0 + } await prisma.employee.update({ where: { id: employeeId }, data: updateData }) diff --git a/frontend/src/pages/portal/MyProfile.tsx b/frontend/src/pages/portal/MyProfile.tsx index 3aba523..0ce2fb1 100644 --- a/frontend/src/pages/portal/MyProfile.tsx +++ b/frontend/src/pages/portal/MyProfile.tsx @@ -5,7 +5,7 @@ */ import { useState, useEffect } from 'react' import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query' -import { User, Phone, IdCard, MapPin, Banknote, GraduationCap, AlertCircle, Check, Save } from 'lucide-react' +import { User, Phone, IdCard, MapPin, Banknote, GraduationCap, AlertCircle, Check, Save, Briefcase, Calendar } from 'lucide-react' import { portalApi } from '../../lib/api-services' import Card from '../../components/ui/Card' import Button from '../../components/ui/Button' @@ -23,6 +23,7 @@ export default function MyProfile() { bankName: '', education: '', city: '', + specialDeduction: 0, }) const { data: profile, isLoading } = useQuery({ @@ -40,6 +41,7 @@ export default function MyProfile() { bankName: profile.bankName || '', education: profile.education || '', city: profile.city || '', + specialDeduction: profile.specialDeduction ?? 0, }) } }, [profile]) @@ -75,13 +77,15 @@ export default function MyProfile() { const readOnlyFields = [ { label: '姓名', value: profile.name, icon: User }, + { label: '工号', value: profile.employeeNo || '未填写', icon: Briefcase }, { label: '性别', value: profile.gender === '男' ? '男' : profile.gender === '女' ? '女' : '未填写', icon: User }, + { label: '出生日期', value: profile.birthDate || '未填写', icon: Calendar }, { label: '手机号', value: profile.phone || '未填写', icon: Phone }, { label: '证件号码', value: profile.idCardNo || '未填写', icon: IdCard }, - { label: '部门', value: profile.department || '未填写', icon: User }, - { label: '岗位', value: profile.position || '未填写', icon: User }, - { label: '入职日期', value: profile.hireDate || '未填写', icon: User }, - { label: '出生日期', value: profile.birthDate || '未填写', icon: User }, + { label: '部门', value: profile.department || '未填写', icon: Briefcase }, + { label: '岗位', value: profile.position || '未填写', icon: Briefcase }, + ...(profile.gender === '女' ? [{ label: '女性岗位类型', value: profile.femaleWorkerType === 'CADRE' ? '干部/管理岗' : profile.femaleWorkerType === 'WORKER' ? '工人/操作岗' : '未填写', icon: User }] : []), + { label: '入职日期', value: profile.hireDate || '未填写', icon: Calendar }, ] const educationOptions = ['博士', '硕士', '本科', '大专', '高中', '其他'] @@ -207,6 +211,16 @@ export default function MyProfile() { disabled={!editing} /> +
+ + setForm({ ...form, specialDeduction: Number(e.target.value) || 0 })} + placeholder="子女教育、赡养老人等,0表示无" + disabled={!editing} + /> +
{editing && (