From d97fd0bed112f8e1fc22394052267f967cd7a321 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E9=94=A6=E6=B6=9B?= <26050301730@qq.com> Date: Thu, 13 Nov 2025 17:16:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=87=87=E8=B4=AD=E5=85=A5?= =?UTF-8?q?=E5=BA=93=E6=97=B6=E9=80=89=E6=8B=A9=E4=B8=8D=E5=90=8C=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E6=96=B0=E5=A2=9E=E8=8D=AF=E5=93=81=E6=97=B6=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../purchaseDocument/index.vue | 56 +++++++++++++++---- 1 file changed, 45 insertions(+), 11 deletions(-) diff --git a/openhis-ui-vue3/src/views/medicationmanagement/purchaseDocument/index.vue b/openhis-ui-vue3/src/views/medicationmanagement/purchaseDocument/index.vue index 011ffc2a..c9115f97 100644 --- a/openhis-ui-vue3/src/views/medicationmanagement/purchaseDocument/index.vue +++ b/openhis-ui-vue3/src/views/medicationmanagement/purchaseDocument/index.vue @@ -769,7 +769,7 @@ watch( } else { editData.value = {}; show(); - } + } }, { immediate: true } ); @@ -1154,9 +1154,10 @@ function changeValEnd(val, index) { } } } -// 切换仓库类型获取药房/药库列表 +// 切换仓库类型获取药房/药库/耗材库列表 function handleChangeLocationType(value) { if (value == 16) { + // 药房类型 getPharmacyList().then((res) => { const list = res?.data || []; if (!list.length) { @@ -1167,16 +1168,49 @@ function handleChangeLocationType(value) { locationList.value = list; } }); - } else if (value == 17) { - getDispensaryList().then((res) => { - const list = res?.data || []; - if (!list.length) { - getDispensaryListAll().then((res2) => { - locationList.value = res2?.data || []; - }); - } else { - locationList.value = list; + } else if (value == 11) { + // 根据用户说明,标识为11的是药库 + // 直接使用getDispensaryListAll获取药库数据,而不是从药房数据中过滤 + getDispensaryListAll().then((res) => { + const pharmacies = res?.data || []; + console.log('===== 药库数据获取结果 ====='); + console.log('获取到的药库数量:', pharmacies.length); + console.log('药库列表:', pharmacies); + + // 直接使用获取到的药库数据 + locationList.value = pharmacies; + + // 如果没有找到药库,显示提示信息 + if (pharmacies.length === 0) { + console.warn('未获取到任何药库数据'); } + }).catch(error => { + console.error('获取药库列表失败:', error); + locationList.value = []; + }); + } else if (value == 17) { + // 耗材库类型 - 确保只显示中心耗材库 + console.log('选择了耗材库类型,设置中心耗材库'); + + // 只设置一个硬编码的中心耗材库,使用数字ID避免类型转换错误 + const centralSupplyWarehouse = { + id: 1, // 使用数字ID而不是字符串 + locationStoreId: 1, // 使用数字ID而不是字符串 + locationStoreName: '中心耗材库', + formEnum: '17', + storeName: '中心耗材库', + name: '中心耗材库' + }; + + // 直接设置locationList只包含中心耗材库 + locationList.value = [centralSupplyWarehouse]; + console.log('已设置仅包含中心耗材库的列表'); + + // 可选:如果需要在后台记录日志,可以保留获取数据的逻辑但不覆盖显示 + getPharmacyListAll().then((res) => { + console.log('后台获取仓库数据(仅供参考,不影响显示):', res?.data?.length || 0); + }).catch(error => { + console.error('后台获取仓库数据失败(不影响显示):', error); }); } }