Fix Bug #495: 【医嘱闭环】已校对医嘱无法流转至"医嘱执行"界面,导致费用无法提交执行

医嘱执行模块 prescriptionList.vue 中 try-catch 被注释掉,导致数据处理
异常时静默失败且 loading 状态无法重置,页面显示空数据无报错。
- 恢复 try-catch 错误处理,捕获 res.data.records 空值及数据处理异常
- 添加 .catch() 处理 API 接口级别失败,重置 loading 并清空列表
- 修复无患者时 loading 状态未重置的问题

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
赵云
2026-05-11 00:02:03 +08:00
parent 65d5b08d73
commit 025963dcae

View File

@@ -283,9 +283,10 @@ function handleGetPrescription() {
exeStatus: props.exeStatus, exeStatus: props.exeStatus,
requestStatus: props.requestStatus, requestStatus: props.requestStatus,
}).then((res) => { }).then((res) => {
// try { try {
const records = res?.data?.records || [];
// 根据encounterId分组 // 根据encounterId分组
const groupedPrescriptions = res.data.records.reduce((groups, prescription) => { const groupedPrescriptions = records.reduce((groups, prescription) => {
// 获取当前医嘱全部执行频次 // 获取当前医嘱全部执行频次
let rate; let rate;
let times; let times;
@@ -430,19 +431,26 @@ function handleGetPrescription() {
// 将分组结果转换为数组形式 // 将分组结果转换为数组形式
prescriptionList.value = Object.values(groupedPrescriptions); prescriptionList.value = Object.values(groupedPrescriptions);
loading.value = false;
// 默认选中全部行 // 默认选中全部行
nextTick(() => { nextTick(() => {
defaultSelectAllRows(); defaultSelectAllRows();
}); });
// } catch { } catch (error) {
// loading.value = false; console.error('医嘱执行-获取处方列表数据处理失败:', error);
// } prescriptionList.value = [];
} finally {
loading.value = false;
}
}).catch((error) => {
console.error('医嘱执行-获取处方列表接口失败:', error);
prescriptionList.value = [];
loading.value = false;
}); });
chooseAll.value = false; chooseAll.value = false;
} else { } else {
prescriptionList.value = []; prescriptionList.value = [];
selectedRowIds.value.clear(); selectedRowIds.value.clear();
loading.value = false;
// proxy.$message.warning('请选择患者'); // proxy.$message.warning('请选择患者');
} }
} }