feat: 个人资料补充工号、女性岗位类型、专项附加扣除字段
- 后端 GET /profile 返回 employeeNo/femaleWorkerType/specialDeduction - 后端 PUT /profile 支持更新 specialDeduction(员工自行填报) - 前端只读区补充:工号、女性岗位类型(仅女性显示) - 前端可编辑区补充:专项附加扣除(元/月)
This commit is contained in:
@@ -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<any>({
|
||||
@@ -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}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<Label>专项附加扣除(元/月)</Label>
|
||||
<Input
|
||||
type="number"
|
||||
value={form.specialDeduction}
|
||||
onChange={(e) => setForm({ ...form, specialDeduction: Number(e.target.value) || 0 })}
|
||||
placeholder="子女教育、赡养老人等,0表示无"
|
||||
disabled={!editing}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{editing && (
|
||||
|
||||
Reference in New Issue
Block a user