Jelajahi Sumber

🐛 fix(silver-talent): 修复银龄人才管理页面API调用和数据展示问题

- 修复表格渲染函数参数类型定义缺失问题
- 修正API调用路径格式,使用`:${selectedTalent.id}`替代直接拼接ID
- 添加param参数传递人才ID,确保API请求正确路由
- 调整统计数据字段名,将total改为totalCount、certified改为certifiedCount、pending改为pendingCount、notCertified改为unCertifiedCount,与后端数据保持一致
- 修正silverTalentsAdminClient基础URL配置,移除多余的/api/v1前缀以匹配路由结构
yourname 7 bulan lalu
induk
melakukan
f0aca0a878
2 mengubah file dengan 15 tambahan dan 9 penghapusan
  1. 14 8
      src/client/admin/pages/SilverTalents.tsx
  2. 1 1
      src/client/api.ts

+ 14 - 8
src/client/admin/pages/SilverTalents.tsx

@@ -184,7 +184,7 @@ export const SilverTalentsPage: React.FC = () => {
       key: 'action',
       width: 200,
       fixed: 'right' as const,
-      render: (_, record: SilverTalent) => (
+      render: (_: any, record: SilverTalent) => (
         <Space>
           <Button
             type="link"
@@ -309,8 +309,11 @@ export const SilverTalentsPage: React.FC = () => {
     if (!selectedTalent) return;
     
     try {
-      const response = await silverTalentsAdminClient[selectedTalent.id.toString()].$put({
-        json: values
+      const response = await silverTalentsAdminClient[`:${selectedTalent.id}`]['$put']({
+        json: values,
+        param: {
+          id: selectedTalent.id.toString()
+        }
       });
 
       if (response.status === 200) {
@@ -328,10 +331,13 @@ export const SilverTalentsPage: React.FC = () => {
     if (!selectedTalent) return;
     
     try {
-      const response = await silverTalentsAdminClient[selectedTalent.id.toString()].certification.$put({
+      const response = await silverTalentsAdminClient[`:${selectedTalent.id}`].certification['$put']({
         json: {
           certificationStatus: values.certificationStatus,
           certificationInfo: values.certificationInfo || ''
+        },
+        param: {
+          id: selectedTalent.id.toString()
         }
       });
 
@@ -353,7 +359,7 @@ export const SilverTalentsPage: React.FC = () => {
           <Card>
             <Statistic
               title="总人才数"
-              value={stats?.total || 0}
+              value={stats?.totalCount || 0}
               prefix={<TeamOutlined />}
             />
           </Card>
@@ -362,7 +368,7 @@ export const SilverTalentsPage: React.FC = () => {
           <Card>
             <Statistic
               title="已认证"
-              value={stats?.certified || 0}
+              value={stats?.certifiedCount || 0}
               prefix={<CheckCircleOutlined style={{ color: '#52c41a' }} />}
             />
           </Card>
@@ -371,7 +377,7 @@ export const SilverTalentsPage: React.FC = () => {
           <Card>
             <Statistic
               title="认证中"
-              value={stats?.pending || 0}
+              value={stats?.pendingCount || 0}
               prefix={<BarChartOutlined style={{ color: '#1890ff' }} />}
             />
           </Card>
@@ -380,7 +386,7 @@ export const SilverTalentsPage: React.FC = () => {
           <Card>
             <Statistic
               title="未认证"
-              value={stats?.notCertified || 0}
+              value={stats?.unCertifiedCount || 0}
               prefix={<CloseCircleOutlined style={{ color: '#ff4d4f' }} />}
             />
           </Card>

+ 1 - 1
src/client/api.ts

@@ -128,6 +128,6 @@ export const silverTalentsClient = hc<SilverTalentsRoutes>('/', {
 
 
 // 银龄库管理客户端
-export const silverTalentsAdminClient = hc<SilverTalentsAdminRoutes>('/api/v1', {
+export const silverTalentsAdminClient = hc<SilverTalentsAdminRoutes>('/', {
   fetch: axiosFetch,
 }).api.v1['admin']['silver-talents']