From 385bf8fa811e223fb72b86f96e8201821c129c36 Mon Sep 17 00:00:00 2001 From: xianyi Date: Thu, 25 Dec 2025 10:55:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=8A=A5=E5=91=8A=E5=AF=84?= =?UTF-8?q?=E9=80=81=E5=9C=B0=E5=9D=80=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/types.ts | 2 +- src/components/exam/ExamDeliveryPanel.tsx | 171 +++++++++++++++++++++- 2 files changed, 166 insertions(+), 7 deletions(-) diff --git a/src/api/types.ts b/src/api/types.ts index 4517c5a..9d818f1 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -862,7 +862,7 @@ export type ReportSendQRcodeResponse = CommonActionResult { @@ -8,6 +8,51 @@ export const ExamDeliveryPanel = ({ client }: { client: ExamClient }) => { const [qrcodeUrl, setQrcodeUrl] = useState(null); const [qrcodeLoading, setQrcodeLoading] = useState(false); + // 表单字段 + const [addressContact, setAddressContact] = useState(''); + const [addressMobile, setAddressMobile] = useState(''); + const [provinceName, setProvinceName] = useState(''); + const [cityName, setCityName] = useState(''); + const [countryName, setCountryName] = useState(''); + const [addressContent, setAddressContent] = useState(''); + const [saveLoading, setSaveLoading] = useState(false); + const [saveMessage, setSaveMessage] = useState(null); + const [infoLoading, setInfoLoading] = useState(false); + + // 获取报告寄送地址信息并自动填入表单 + useEffect(() => { + if (!client.id) return; + + setInfoLoading(true); + const appointmentId = Number(client.id); + if (!appointmentId) { + setInfoLoading(false); + return; + } + + getReportSendInfo({ physical_exam_id: appointmentId }) + .then((res) => { + if (res.Status === 200 && res.Data) { + const data = res.Data; + if (data.address_contact) { + setAddressContact(data.address_contact); + } + if (data.address_mobile) { + setAddressMobile(data.address_mobile); + } + if (data.address_content) { + setAddressContent(data.address_content); + } + } + }) + .catch((err) => { + console.error('获取报告寄送地址失败', err); + }) + .finally(() => { + setInfoLoading(false); + }); + }, [client.id]); + useEffect(() => { if (viewMode === 'image' && !qrcodeUrl && !qrcodeLoading) { setQrcodeLoading(true); @@ -59,15 +104,57 @@ export const ExamDeliveryPanel = ({ client }: { client: ExamClient }) => {
收件人姓名 - + setAddressContact(e.target.value)} + />
联系电话 - + setAddressMobile(e.target.value)} + /> +
+
+ 省份 + setProvinceName(e.target.value)} + /> +
+
+ 城市 + setCityName(e.target.value)} + /> +
+
+ 区县 + setCountryName(e.target.value)} + />
- 寄送地址 - + 详细地址 + setAddressContent(e.target.value)} + />
@@ -77,11 +164,83 @@ export const ExamDeliveryPanel = ({ client }: { client: ExamClient }) => { placeholder='如需多份报告、加急寄送等,请在此备注' />
+ {saveMessage && ( +
+ {saveMessage} +
+ )}
当前客户:{client.name}(体检号:{client.id})
- +
) : (