|
|
@@ -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>
|