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({