From f5f9cac37e8a0f6fc9b199a1da182e7339617970 Mon Sep 17 00:00:00 2001 From: Andrei Duvakin Date: Mon, 10 Feb 2025 18:43:10 +0500 Subject: [PATCH] =?UTF-8?q?=D1=83=D0=B1=D1=80=D0=B0=D0=BB=20=D0=BE=D1=88?= =?UTF-8?q?=D0=B8=D0=B1=D0=BA=D0=B8,=20=D0=BF=D0=BE=D1=8F=D0=B2=D0=BB?= =?UTF-8?q?=D1=8F=D1=8E=D1=89=D0=B8=D0=B5=D1=81=D1=8F=20=D0=BD=D0=B0=20?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D0=B5=20=D0=BF=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D0=B5=D0=BD=D1=82=D0=BE=D0=B2=20=D0=B2=20=D0=B1?= =?UTF-8?q?=D1=80=D0=B0=D1=83=D0=B7=D0=B5=D1=80=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web-app/src/components/PatientModal.jsx | 27 ++++++++++++++++--------- web-app/src/pages/PatientsPage.jsx | 3 +-- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/web-app/src/components/PatientModal.jsx b/web-app/src/components/PatientModal.jsx index 0e6fabf..2e0dd81 100644 --- a/web-app/src/components/PatientModal.jsx +++ b/web-app/src/components/PatientModal.jsx @@ -9,15 +9,17 @@ const PatientModal = ({visible, onCancel, onSubmit, patient}) => { const [form] = Form.useForm(); useEffect(() => { - if (patient) { - form.setFieldsValue({ - ...patient, - birthday: patient.birthday ? moment(patient.birthday) : null, - }); - } else { - form.resetFields(); + if (visible) { + if (patient) { + form.setFieldsValue({ + ...patient, + birthday: patient.birthday ? moment(patient.birthday) : null, + }); + } else { + form.resetFields(); + } } - }, [patient, form]); + }, [visible, patient, form]); const handleOk = async () => { try { @@ -26,6 +28,7 @@ const PatientModal = ({visible, onCancel, onSubmit, patient}) => { values.birthday = values.birthday.format("YYYY-MM-DD"); } onSubmit(values); + form.resetFields(); } catch (errorInfo) { console.log("Validation Failed:", errorInfo); } @@ -35,13 +38,17 @@ const PatientModal = ({visible, onCancel, onSubmit, patient}) => { { + form.resetFields(); + onCancel(); + }} onOk={handleOk} okText="Сохранить" cancelText="Отмена" centered maskClosable={false} - bodyStyle={{padding: 24}} + forceRender={true} + styles={{body: {padding: 24}}} style={{top: 20}} >
diff --git a/web-app/src/pages/PatientsPage.jsx b/web-app/src/pages/PatientsPage.jsx index a1be1f1..93c9a54 100644 --- a/web-app/src/pages/PatientsPage.jsx +++ b/web-app/src/pages/PatientsPage.jsx @@ -6,7 +6,6 @@ import getAllPatients from "../api/GetAllPatients.jsx"; import PatientListCard from "../components/PatientListCard.jsx"; import PatientModal from "../components/PatientModal.jsx"; // Подключаем модальное окно -const { Search } = Input; const { Option } = Select; const PatientsPage = () => { @@ -83,7 +82,7 @@ const PatientsPage = () => {
- setSearchText(e.target.value)} style={{ width: "100%" }}