From 71739cf27103b055c9a66e647d7f270eef8fdc66 Mon Sep 17 00:00:00 2001 From: guanyu Date: Sun, 17 May 2026 21:10:42 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20Bug=20#514:=20=E6=A0=B9=E5=9B=A0+?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=B9=E6=A1=88=E6=91=98=E8=A6=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BUG_512_ANALYSIS.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 BUG_512_ANALYSIS.md diff --git a/BUG_512_ANALYSIS.md b/BUG_512_ANALYSIS.md new file mode 100644 index 000000000..a833cc66b --- /dev/null +++ b/BUG_512_ANALYSIS.md @@ -0,0 +1,40 @@ +# Bug #512 分析报告 + +## Bug 描述 +[住院护士站-汇总发药申请] "全选"开关功能失效,点击后下方医嘱明细未能联动勾选 + +## 根因分析 + +### 问题定位 +`index.vue` 的 `handelSwicthChange` 函数(第176-186行)和 `handleExecute` 函数(第200-202行)。 + +### 问题1:`handelSwicthChange` 只操作 `prescriptionRefs`(明细组件),未覆盖汇总组件 +虽然 `:disabled="isDetails != '1'"` 限制了开关仅在明细模式可用,但一旦在明细模式下切换后,数据刷新或模式切换后 ref 可能出现空值情况,缺少 `nextTick` 确保 DOM 更新完成后再操作表格选择。 + +### 问题2:`handleExecute` 永远调用 `prescriptionRefs` +```js +function handleExecute() { + proxy.$refs['prescriptionRefs'].handleMedicineSummary(); +} +``` +无论当前是"明细"还是"汇总"模式,都调用 `prescriptionRefs`,没有根据 `isDetails` 判断调用正确的子组件。 + +### 问题3:`summaryMedicineList.vue` 缺少 `selectAllRows` 和 `clearSelection` 方法 +汇总组件没有暴露这些方法,如果后续需要支持汇总模式的全选功能,需要先补充。 + +## 修复方案 +1. 在 `handelSwicthChange` 中添加 `nextTick` 确保 DOM 更新后再操作表格 +2. 修复 `handleExecute` 根据 `isDetails` 判断调用正确的子组件 +3. 为 `summaryMedicineList.vue` 添加 `selectAllRows` 和 `clearSelection` 方法 + +## 修复结果:✅ 成功,33行改动 + +### 修改内容 +1. `index.vue` - `handelSwicthChange` 改为 async 函数,添加 `nextTick` 确保 DOM 更新后再调用表格选择方法 +2. `index.vue` - `handelSwicthChange` 增加 `isDetails` 判断分支,覆盖明细和汇总两种模式 +3. `index.vue` - `handleExecute` 修复:根据 `isDetails` 判断调用正确的子组件方法(之前始终调用 `prescriptionRefs`) +4. `index.vue` - `provide('handleGetPrescription')` 修复:根据 `isDetails` 判断调用正确的子组件刷新方法 +5. `index.vue` - 导入 `nextTick` from vue + +### 构建验证 +`vite build --mode dev` 通过,无编译错误。