Bläddra i källkod

fix(011.003): 修复人才列表页字段映射错误

- 修复人才列表页字段映射:personId、jobStatus、latestJoinDate
- 添加TypeScript接口匹配企业专用API Schema
- 移除不存在的age和salary字段引用
- 修复头像颜色和点击跳转使用正确的personId字段

🤖 Generated with [Claude Code](https://claude.com/claude-code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
yourname 1 månad sedan
förälder
incheckning
6831f750db
1 ändrade filer med 42 tillägg och 10 borttagningar
  1. 42 10
      mini/src/pages/yongren/talent/list/index.tsx

+ 42 - 10
mini/src/pages/yongren/talent/list/index.tsx

@@ -9,7 +9,39 @@ import { useAuth } from '@/utils/auth'
 import { useRequireAuth } from '@/hooks/useRequireAuth'
 import './index.css'
 
+// 企业专用人才列表项类型 - 匹配CompanyPersonListItemSchema
+interface CompanyPersonListItem {
+  personId: number
+  name: string
+  gender: string
+  idCard: string
+  disabilityType: string
+  disabilityLevel: string
+  phone: string | null
+  jobStatus: string
+  latestJoinDate: string | null
+  orderName: string | null
+}
 
+// 企业专用人才列表API响应类型 - 匹配CompanyPersonListResponseSchema
+interface CompanyPersonListResponse {
+  data: CompanyPersonListItem[]
+  pagination: {
+    page: number
+    limit: number
+    total: number
+    totalPages: number
+  }
+}
+
+// useQuery返回的数据结构
+interface TalentListData {
+  data: CompanyPersonListItem[]
+  total: number
+  page: number
+  limit: number
+  totalPages: number
+}
 
 const YongrenTalentListPage: React.FC = () => {
   const { user: _user } = useAuth()
@@ -52,7 +84,7 @@ const YongrenTalentListPage: React.FC = () => {
       if (response.status !== 200) {
         throw new Error('获取人才列表失败')
       }
-      const result = await response.json() as any
+      const result = await response.json() as CompanyPersonListResponse
       // API返回结构:{ data: [...], pagination: { total, page, limit, totalPages } }
       const data = result?.data || []
       const pagination = result?.pagination || { total: 0, page: 1, limit: 20, totalPages: 0 }
@@ -239,11 +271,11 @@ const YongrenTalentListPage: React.FC = () => {
               <View className="space-y-3">
                 {talentList.data.map((talent) => (
                   <View
-                    key={talent.id}
+                    key={talent.personId}
                     className="card bg-white p-4 flex items-center cursor-pointer active:bg-gray-50"
-                    onClick={() => handleTalentClick(talent.id)}
+                    onClick={() => handleTalentClick(talent.personId)}
                   >
-                    <View className={`name-avatar ${getAvatarColor(talent.id)} w-10 h-10 rounded-full flex items-center justify-center`}>
+                    <View className={`name-avatar ${getAvatarColor(talent.personId)} w-10 h-10 rounded-full flex items-center justify-center`}>
                       <Text className="text-white font-semibold">
                         {talent.name.charAt(0)}
                       </Text>
@@ -253,22 +285,22 @@ const YongrenTalentListPage: React.FC = () => {
                         <View>
                           <Text className="font-semibold text-gray-800">{talent.name}</Text>
                           <Text className="text-xs text-gray-500">
-                            {talent.disabilityType || '未指定'} · {talent.disabilityLevel || '未分级'} · {talent.gender} · {talent.age || '未知'}
+                            {talent.disabilityType || '未指定'} · {talent.disabilityLevel || '未分级'} · {talent.gender} · 未知岁
                           </Text>
                         </View>
                         <Text className={`text-xs px-2 py-1 rounded-full ${
-                          talent.status === '在职'
+                          talent.jobStatus === '在职'
                             ? 'bg-green-100 text-green-800'
-                            : talent.status === '待入职'
+                            : talent.jobStatus === '待入职'
                             ? 'bg-yellow-100 text-yellow-800'
                             : 'bg-gray-100 text-gray-800'
                         }`}>
-                          {talent.status}
+                          {talent.jobStatus}
                         </Text>
                       </View>
                       <View className="mt-2 flex justify-between text-xs text-gray-500">
-                        <Text>入职: {talent.joinDate || '未入职'}</Text>
-                        <Text>薪资: ¥{talent.salary ? talent.salary.toLocaleString() : '0'}</Text>
+                        <Text>入职: {talent.latestJoinDate ? new Date(talent.latestJoinDate).toLocaleDateString() : '未入职'}</Text>
+                        <Text>薪资: 待定</Text>
                       </View>
                     </View>
                   </View>