|
|
@@ -11,54 +11,8 @@ export interface TalentDetailProps {
|
|
|
// 组件属性定义(目前为空)
|
|
|
}
|
|
|
|
|
|
-// 类型定义 - 匹配企业专用人才详情API的CompanyPersonDetailSchema
|
|
|
-interface TalentDetailData {
|
|
|
- personId: number
|
|
|
- name: string
|
|
|
- gender: string
|
|
|
- idCard: string
|
|
|
- disabilityType: string
|
|
|
- disabilityLevel: string
|
|
|
- birthDate?: string
|
|
|
- phone?: string
|
|
|
- jobStatus: string
|
|
|
- bankCards: Array<{
|
|
|
- cardId: number
|
|
|
- bankName: string
|
|
|
- cardNumber: string
|
|
|
- isDefault: boolean
|
|
|
- }>
|
|
|
- photos: Array<{
|
|
|
- fileId: number
|
|
|
- fileName: string
|
|
|
- fileUrl: string
|
|
|
- }>
|
|
|
- // 兼容字段
|
|
|
- id?: number // 兼容旧代码,映射personId
|
|
|
- status?: string // 兼容旧代码,映射jobStatus
|
|
|
- age?: number // 根据birthDate计算
|
|
|
- idAddress?: string // 可能来自其他API
|
|
|
- province?: string // 可能来自其他API
|
|
|
- city?: string // 可能来自其他API
|
|
|
- joinDate?: string // 可能来自工作信息API
|
|
|
- salary?: number // 可能来自薪资信息API
|
|
|
- companyId?: number // 可能来自其他API
|
|
|
- disabilityId?: string // 可能来自其他API
|
|
|
- specificDisability?: string // 可能来自其他API
|
|
|
- [key: string]: any
|
|
|
-}
|
|
|
|
|
|
-interface WorkInfoData {
|
|
|
- id: number
|
|
|
- orderId?: number
|
|
|
- position?: string
|
|
|
- department?: string
|
|
|
- startDate?: string
|
|
|
- endDate?: string
|
|
|
- status?: string
|
|
|
- companyId?: number
|
|
|
- [key: string]: any
|
|
|
-}
|
|
|
+
|
|
|
|
|
|
interface SalaryData {
|
|
|
id: number
|
|
|
@@ -138,7 +92,7 @@ const TalentDetail: React.FC<TalentDetailProps> = () => {
|
|
|
if (response.status !== 200) {
|
|
|
throw new Error('获取人才详情失败')
|
|
|
}
|
|
|
- const data = await response.json() as TalentDetailData
|
|
|
+ const data = await response.json()
|
|
|
// 添加兼容字段映射
|
|
|
return {
|
|
|
...data,
|
|
|
@@ -162,13 +116,13 @@ const TalentDetail: React.FC<TalentDetailProps> = () => {
|
|
|
})
|
|
|
if (response.status !== 200) {
|
|
|
// 可能没有工作信息,返回空对象
|
|
|
- return {} as WorkInfoData
|
|
|
+ return {}
|
|
|
}
|
|
|
const data = await response.json() as WorkHistoryResponse
|
|
|
// 企业专用工作历史API返回的是工作历史列表,取最新的一条作为当前工作信息
|
|
|
const workHistory = data?.工作历史 || []
|
|
|
if (workHistory.length === 0) {
|
|
|
- return {} as WorkInfoData
|
|
|
+ return {}
|
|
|
}
|
|
|
// 取最新的一条工作记录(按入职日期降序)
|
|
|
const latestWork = workHistory[0]
|
|
|
@@ -181,7 +135,7 @@ const TalentDetail: React.FC<TalentDetailProps> = () => {
|
|
|
endDate: latestWork.离职日期 || undefined,
|
|
|
status: latestWork.工作状态,
|
|
|
companyId: undefined // 企业专用API没有公司ID字段
|
|
|
- } as WorkInfoData
|
|
|
+ }
|
|
|
},
|
|
|
enabled: isLoggedIn && talentId > 0
|
|
|
})
|