|
|
@@ -140,6 +140,32 @@ const TalentDetail: React.FC<TalentDetailProps> = () => {
|
|
|
enabled: isLoggedIn && talentId > 0
|
|
|
})
|
|
|
|
|
|
+ // 获取完整工作历史 - 用于时间线展示
|
|
|
+ const { data: workHistoryFull, isLoading: workHistoryLoading } = useQuery({
|
|
|
+ queryKey: ['workHistoryFull', talentId],
|
|
|
+ queryFn: async () => {
|
|
|
+ if (!talentId) throw new Error('无效的人才ID')
|
|
|
+ // 使用企业专用工作历史API:/api/v1/yongren/disability-person/{id}/work-history
|
|
|
+ const response = await enterpriseDisabilityClient[':id']['work-history'].$get({
|
|
|
+ param: { id: talentId.toString() }
|
|
|
+ })
|
|
|
+ if (response.status !== 200) {
|
|
|
+ // 可能没有工作信息,返回空数组
|
|
|
+ return [] as WorkHistoryItem[]
|
|
|
+ }
|
|
|
+ const data = await response.json() as WorkHistoryResponse
|
|
|
+ // 企业专用工作历史API返回的是工作历史列表
|
|
|
+ const workHistory = data?.工作历史 || []
|
|
|
+ // 按入职日期降序排序(最新的在前)
|
|
|
+ return workHistory.sort((a, b) => {
|
|
|
+ const dateA = a.入职日期 ? new Date(a.入职日期).getTime() : 0
|
|
|
+ const dateB = b.入职日期 ? new Date(b.入职日期).getTime() : 0
|
|
|
+ return dateB - dateA
|
|
|
+ })
|
|
|
+ },
|
|
|
+ enabled: isLoggedIn && talentId > 0
|
|
|
+ })
|
|
|
+
|
|
|
// 获取薪资信息 - 使用企业专用薪资历史API
|
|
|
const { data: salaryInfo, isLoading: salaryLoading } = useQuery({
|
|
|
queryKey: ['salaryInfo', talentId],
|
|
|
@@ -236,7 +262,7 @@ const TalentDetail: React.FC<TalentDetailProps> = () => {
|
|
|
})
|
|
|
}, [])
|
|
|
|
|
|
- const isLoading = talentLoading || workLoading || salaryLoading || filesLoading || historyLoading
|
|
|
+ const isLoading = talentLoading || workLoading || salaryLoading || filesLoading || historyLoading || workHistoryLoading
|
|
|
const hasError = talentError
|
|
|
|
|
|
// 获取头像颜色
|