Files
his/BUG_522_ANALYSIS.md

33 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Bug #522 分析报告
## Bug 描述
[住院护士站-三测单] 体征录入点击保存后缺乏执行反馈且窗口异常自动关闭
## 涉及文件
- 前端: `openhis-ui-vue3/src/views/inpatientNurse/tprChart/components/addTprDialog.vue`
- API: `openhis-ui-vue3/src/views/inpatientNurse/tprChart/components/api.js`
- 父组件: `openhis-ui-vue3/src/views/inpatientNurse/tprChart/index.vue`
## 根因分析
### 问题1弹窗异常自动关闭 — 根因
`addTprDialog.vue` 模板中,保存按钮使用了 `:disabled="buttonDisabled"`第50行和第108行**`buttonDisabled` 变量在整个 script setup 中从未声明**。
在 Vue 3 `<script setup>` + Composition API 中,模板引用的变量必须在 script 中声明。未声明的变量会触发 `ReferenceError`,导致组件渲染失败或运行时异常。这个错误会破坏组件的响应式系统,使得 `dialogVisible` 的响应式绑定失效,从而导致弹窗在保存操作后异常关闭。
### 问题2缺乏保存成功反馈 — 连带结果
虽然 `confirmCharge()` 函数在第1087行已有 `proxy.$modal.msgSuccess('保存成功')` 的调用,但由于 `buttonDisabled` 未声明引发的异常导致代码执行路径被破坏success 回调中的提示逻辑可能未能正常执行。
## 修复方案
1. **在 `addTprDialog.vue` 的 script setup 中新增 `buttonDisabled` ref 声明**,初始值为 `false`
2. **在保存操作中添加 loading 状态**点击保存后将按钮禁用API 返回后恢复,防止重复提交的同时也保证了响应式状态的一致性
## 验收标准
- [ ] 点击保存后弹窗保持开启状态
- [ ] 保存成功后弹出"保存成功"提示
- [ ] 左侧体征历史记录列表自动刷新
- [ ] 录入区域表单被清空,方便继续录入下一条