Просмотр исходного кода

fix(mini): 修复人才详情工作信息卡片字段映射问题

- 入职日期:使用 workInfo.startDate 替代 talentDetail.joinDate
- 所属订单:优先选择"在职"状态的工作记录
- 岗位类型:正确处理为"未指定"(企业专用API无此字段)

Co-Authored-By: Claude <noreply@anthropic.com>
yourname 1 неделя назад
Родитель
Сommit
0bc3aa57cf

+ 10 - 10
mini-ui-packages/yongren-talent-management-ui/src/pages/TalentDetail/TalentDetail.tsx

@@ -69,21 +69,21 @@ const TalentDetail: React.FC<TalentDetailProps> = () => {
         return {}
       }
       const data = await response.json()
-      // 企业专用工作历史API返回的是工作历史列表,取最新的一条作为当前工作信息
+      // 企业专用工作历史API返回的是工作历史列表
       const workHistory = data?.工作历史 || []
       if (workHistory.length === 0) {
         return {}
       }
-      // 取最新的一条工作记录(按入职日期降序)
-      const latestWork = workHistory[0]
+      // 优先选择工作状态为"在职"的记录,如果没有则取最新的一条
+      const currentWork = workHistory.find((item: WorkHistoryItem) => item.工作状态 === '在职') || workHistory[0]
       return {
-        id: latestWork.订单ID || talentId,
-        orderId: latestWork.订单ID,
-        position: latestWork.订单名称 || undefined,
+        id: currentWork.订单ID || talentId,
+        orderId: currentWork.订单ID,
+        position: undefined, // 企业专用API没有岗位类型字段
         department: undefined, // 企业专用API没有部门字段
-        startDate: latestWork.入职日期 || undefined,
-        endDate: latestWork.离职日期 || undefined,
-        status: latestWork.工作状态,
+        startDate: currentWork.入职日期 || undefined,
+        endDate: currentWork.离职日期 || undefined,
+        status: currentWork.工作状态,
         companyId: undefined // 企业专用API没有公司ID字段
       }
     },
@@ -376,7 +376,7 @@ const TalentDetail: React.FC<TalentDetailProps> = () => {
                   <View className="space-y-3 text-sm">
                     <View className="flex justify-between">
                       <Text className="text-gray-500">入职日期</Text>
-                      <Text className="text-gray-800">{formatDate(talentDetail.joinDate)}</Text>
+                      <Text className="text-gray-800">{formatDate(workInfo?.startDate)}</Text>
                     </View>
                     <View className="flex justify-between">
                       <Text className="text-gray-500">工作状态</Text>