From 88b0fcdc7d2573dfda7ffe09f8dbe0bb635e3771 Mon Sep 17 00:00:00 2001 From: freedakgmail Date: Mon, 17 Aug 2026 19:09:28 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=B8=AA=E4=BA=BA=E8=B5=84=E6=96=99?= =?UTF-8?q?=E8=A1=A5=E5=85=85=E5=B7=A5=E5=8F=B7=E3=80=81=E5=A5=B3=E6=80=A7?= =?UTF-8?q?=E5=B2=97=E4=BD=8D=E7=B1=BB=E5=9E=8B=E3=80=81=E4=B8=93=E9=A1=B9?= =?UTF-8?q?=E9=99=84=E5=8A=A0=E6=89=A3=E9=99=A4=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 后端 GET /profile 返回 employeeNo/femaleWorkerType/specialDeduction - 后端 PUT /profile 支持更新 specialDeduction(员工自行填报) - 前端只读区补充:工号、女性岗位类型(仅女性显示) - 前端可编辑区补充:专项附加扣除(元/月) --- backend/src/routes/portal.routes.ts | 8 ++++++++ frontend/src/pages/portal/MyProfile.tsx | 24 +++++++++++++++++++----- 2 files changed, 27 insertions(+), 5 deletions(-) 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 && (