From d9c2d677e820003a95e622a36ed1cadecbe04631 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=BA=91?= <赵云@gentronhealth.com> Date: Thu, 14 May 2026 03:10:40 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#465:=20[=E4=BD=8F=E9=99=A2?= =?UTF-8?q?=E5=8C=BB=E7=94=9F=E5=B7=A5=E4=BD=9C=E7=AB=99-=E6=A3=80?= =?UTF-8?q?=E9=AA=8C=E7=94=B3=E8=AF=B7]=20=E6=A3=80=E9=AA=8C=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E9=80=89=E6=8B=A9=E5=88=97=E8=A1=A8=E8=A2=AB=E9=99=90?= =?UTF-8?q?=E5=88=B6=E4=B8=BA500=E9=A1=B9=EF=BC=8C=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E5=8C=BB=E7=94=9F=E6=97=A0=E6=B3=95=E6=A3=80=E7=B4=A2=E5=B9=B6?= =?UTF-8?q?=E5=BC=80=E7=AB=8B=E5=85=B6=E4=BD=99800=E5=A4=9A=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因分析: 1. 前端参数名错误:getList 发送 pageNum 但后端期望 pageNo,导致分页参数被忽略 2. 后端 MyBatis Plus 分页拦截器单页最多返回500条,前端用 pageSize:9999 无效 3. 总共有1300+条检验项目,但只返回了前500条 修复方案: - 修正参数名为 pageNo 匹配后端接口 - 使用分页循环拉取全部数据(每页500条,循环直到数据全部拉取) - 添加 try/catch 错误处理 Co-Authored-By: Claude Opus 4.7 --- .../order/applicationForm/laboratoryTests.vue | 68 +++++++++++-------- 1 file changed, 41 insertions(+), 27 deletions(-) diff --git a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/applicationForm/laboratoryTests.vue b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/applicationForm/laboratoryTests.vue index 57cd453a6..72a5eff38 100755 --- a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/applicationForm/laboratoryTests.vue +++ b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/applicationForm/laboratoryTests.vue @@ -144,42 +144,56 @@ const applicationListAll = ref(); const applicationList = ref(); const loading = ref(false); const orgOptions = ref([]); // 科室选项 -const getList = () => { +const getList = async () => { if (!patientInfo.value?.inHospitalOrgId) { applicationList.value = []; return; } loading.value = true; - getApplicationList({ - pageSize: 9999, - pageNum: 1, - categoryCode: '22', - organizationId: patientInfo.value.inHospitalOrgId, - adviceTypes: [3], //1 药品 2耗材 3诊疗 - }) - .then((res) => { - if (res.code === 200) { - applicationListAll.value = res.data.records; - applicationList.value = res.data.records.map((item) => { - const priceInfo = item.priceList?.[0] || {}; - const price = priceInfo.price != null ? Number(priceInfo.price).toFixed(2) : '0.00'; - const unit = item.unitCode_dictText || item.unitCode || ''; - return { - adviceDefinitionId: item.adviceDefinitionId, - orgId: item.orgId, - label: item.adviceName + ' (¥' + price + '/' + unit + ')', - key: item.adviceDefinitionId, - }; - }); - console.log('applicationList========>', JSON.stringify(res.data.records)); - } else { + try { + const allRecords = []; + let currentPage = 1; + const pageSize = 500; + + // 分页拉取全部数据(后端单页最多500条) + while (true) { + const res = await getApplicationList({ + pageSize, + pageNo: currentPage, + categoryCode: '22', + organizationId: patientInfo.value.inHospitalOrgId, + adviceTypes: [3], // 1 药品 2 耗材 3 诊疗 + }); + if (res.code !== 200) { proxy.$message.error(res.message); applicationList.value = []; + return; } - }) - .finally(() => { - loading.value = false; + const records = res.data?.records || []; + allRecords.push(...records); + // 当前页不足 pageSize 或已无数据,说明已全部拉取 + if (records.length < pageSize) break; + currentPage++; + } + + applicationListAll.value = allRecords; + applicationList.value = allRecords.map((item) => { + const priceInfo = item.priceList?.[0] || {}; + const price = priceInfo.price != null ? Number(priceInfo.price).toFixed(2) : '0.00'; + const unit = item.unitCode_dictText || item.unitCode || ''; + return { + adviceDefinitionId: item.adviceDefinitionId, + orgId: item.orgId, + label: item.adviceName + ' (¥' + price + '/' + unit + ')', + key: item.adviceDefinitionId, + }; }); + } catch (e) { + proxy.$message.error('获取检验项目列表失败'); + applicationList.value = []; + } finally { + loading.value = false; + } }; const transferValue = ref([]); const form = reactive({