From e044e04cfd96cd3a34974fb2535bb7c91f53f007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=80=E5=BD=A7?= <荀彧@gentronhealth.com> Date: Thu, 14 May 2026 02:18:15 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#470:=20=E4=BD=8F=E9=99=A2=E5=8C=BB?= =?UTF-8?q?=E7=94=9F=E5=B7=A5=E4=BD=9C=E7=AB=99-=E6=89=8B=E6=9C=AF?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E5=8D=95=E5=8A=A0=E8=BD=BD=E6=89=8B=E6=9C=AF?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=80=97=E6=97=B6=E8=BF=87=E9=95=BF=EF=BC=8C?= =?UTF-8?q?=E5=BD=B1=E5=93=8D=E5=8C=BB=E7=94=9F=E5=BC=80=E5=8D=95=E6=95=88?= =?UTF-8?q?=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加模块级缓存(surgeryRecordsCache + surgeryMappedCache),首次打开弹窗请求API后 缓存数据,后续打开直接复用,避免重复请求500条手术项目列表导致加载缓慢。 Co-Authored-By: Claude Opus 4.7 --- .../components/order/applicationForm/surgery.vue | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/applicationForm/surgery.vue b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/applicationForm/surgery.vue index 49b6cc68f..23eec9b48 100755 --- a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/applicationForm/surgery.vue +++ b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/applicationForm/surgery.vue @@ -86,6 +86,9 @@ import {getApplicationList, saveSurgery} from './api'; import {ElMessage} from 'element-plus'; const { proxy } = getCurrentInstance(); +// 模块级缓存:避免每次打开弹窗都重新请求手术项目列表 +let surgeryRecordsCache = null; // 原始 API 记录 +let surgeryMappedCache = null; // 映射后的 el-transfer 数据 // 递归查找树形科室节点 const findTreeItem = (list, id) => { if (!list || list.length === 0) return null; @@ -110,6 +113,12 @@ const getList = () => { applicationList.value = []; return; } + // 命中缓存时直接使用,避免重复请求导致加载缓慢 + if (surgeryMappedCache && surgeryMappedCache.length > 0) { + applicationList.value = surgeryMappedCache; + applicationListAll.value = surgeryRecordsCache; + return; + } loading.value = true; getApplicationList({ pageSize: 500, @@ -132,6 +141,9 @@ const getList = () => { key: item.adviceDefinitionId, }; }); + // 写入模块缓存,后续打开弹窗直接复用 + surgeryRecordsCache = res.data.records; + surgeryMappedCache = applicationList.value; } else { console.warn('获取手术项目列表失败:', res.message); applicationList.value = [];