diff --git a/src/apis/people.ts b/src/apis/people.ts index 3b9363c..d4a9e73 100644 --- a/src/apis/people.ts +++ b/src/apis/people.ts @@ -15,7 +15,7 @@ import type { * @param people 人员信息对象 * @returns Promise */ -export async function createPeople(people: Record): Promise { +export async function createPeople(people: People): Promise { const requestData: PostPeopleRequest = { people }; console.log('创建人员请求数据:', requestData); return post(API_ENDPOINTS.PEOPLES, requestData); @@ -115,7 +115,7 @@ export async function deletePeople(peopleId: string): Promise { * @returns Promise */ export async function createPeoplesBatch( - peopleList: Record[] + peopleList: People[] ): Promise { const promises = peopleList.map(people => createPeople(people)); return Promise.all(promises); diff --git a/src/apis/types.ts b/src/apis/types.ts index 55b740f..1b581c2 100644 --- a/src/apis/types.ts +++ b/src/apis/types.ts @@ -45,12 +45,13 @@ export interface GetPeoplesParams { export interface People { id?: string; name?: string; + contact?: string; gender?: string; age?: number; height?: number; marital_status?: string; - contact?: string; [key: string]: any; + cover?: string; } // 分页响应类型 diff --git a/src/components/PeopleForm.tsx b/src/components/PeopleForm.tsx index b0a4425..02e0051 100644 --- a/src/components/PeopleForm.tsx +++ b/src/components/PeopleForm.tsx @@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'; import { Form, Input, Select, InputNumber, Button, message, Row, Col } from 'antd'; import './PeopleForm.css'; import KeyValueList from './KeyValueList.tsx' -import { createPeople } from '../apis'; +import { createPeople, type People } from '../apis'; const { TextArea } = Input; @@ -24,6 +24,7 @@ const PeopleForm: React.FC = ({ initialData }) => { if (initialData.name) formData.name = initialData.name; if (initialData.contact) formData.contact = initialData.contact; + if (initialData.cover) formData.cover = initialData.cover; if (initialData.gender) formData.gender = initialData.gender; if (initialData.age) formData.age = initialData.age; if (initialData.height) formData.height = initialData.height; @@ -43,15 +44,16 @@ const PeopleForm: React.FC = ({ initialData }) => { setLoading(true); try { - const peopleData = { + const peopleData: People = { name: values.name, + contact: values.contact || undefined, gender: values.gender, age: values.age, height: values.height || undefined, marital_status: values.marital_status || undefined, introduction: values.introduction || {}, match_requirement: values.match_requirement || undefined, - contact: values.contact || undefined, + cover: values.cover || undefined, }; console.log('提交人员数据:', peopleData); @@ -105,6 +107,14 @@ const PeopleForm: React.FC = ({ initialData }) => { + + + + + + + +