import React from 'react'; import { Row, Col, Input, Select, Form } from 'antd'; import { RootState, useAppDispatch } from '@/states/store'; import { updateField, updateDropdown, AnimalBaseInfoState, } from '@/states/patient/DiagnosticReport/animalBaseInfoSlice'; import { useSelector } from 'react-redux'; import { useEffect } from 'react'; import { Task, TaskAnimal } from '@/domain/work'; const { Option } = Select; export const AnimalBaseInfo: React.FC = () => { const data = useSelector((s: RootState) => s.animalBaseInfo); const dispatch = useAppDispatch(); const selectedIds = useSelector( (s: RootState) => s.workSelection.selectedIds ); const workEntities = useSelector((s: RootState) => s.workEntities.data); console.log(`【诊断报告】:选中的study id :${selectedIds[0]}`); const selectedStudy: Task | TaskAnimal | null = selectedIds.length > 0 ? (workEntities.find((t) => t.StudyID === selectedIds[0]) ?? null) : null; useEffect(() => { console.log( `【诊断报告】:selectedStudy是空吗?${selectedStudy === null} ${selectedStudy}` ); if (selectedStudy) { const selectedStudyAnimal = selectedStudy as TaskAnimal; dispatch( updateField({ key: 'patientName', value: selectedStudyAnimal.PatientName, }) ); dispatch( updateField({ key: 'sex', value: selectedStudyAnimal.PatientSex }) ); dispatch( updateField({ key: 'age', value: selectedStudyAnimal.PatientAge }) ); dispatch( updateField({ key: 'ownerName', value: selectedStudyAnimal.owner_name }) ); // dispatch( // updateField({ key: 'inspectionNumber', value: selectedStudyAnimal.ins }) // ); // dispatch( // updateField({ key: 'inspectionMethod', value: selectedStudy.InspectionMethod }) // ); // dispatch( // updateField({ key: 'radiologist', value: selectedStudy.Radiologist }) // ); // dispatch( // updateField({ key: 'reviewPhysician', value: selectedStudy.ReviewPhysician }) // ); } }, [selectedIds]); // eslint-disable-next-line @typescript-eslint/no-explicit-any const onChange = (key: keyof AnimalBaseInfoState, val: any) => { dispatch(updateField({ key, value: val })); }; // eslint-disable-next-line @typescript-eslint/no-explicit-any const onDropdownChange = (key: keyof AnimalBaseInfoState, val: any) => { dispatch(updateDropdown({ key, value: val })); }; return (
); };