Fix Bug #501: 【住院护士站-医嘱执行】医嘱执行页面点击"取消执行"报错
根因分析:handleCancel 函数从 exePerformRecordList 提取 procedureId 时, 未过滤 null/空值,导致无效 procedureId 被发送到后端,引发 SQL 异常。 同时 therapyEnum 可能存在类型不一致问题。 修复内容: 1. 提取 procedureId 后增加 filter 过滤空值 2. 构建请求参数时再次过滤,确保不发无效 procedureId 3. therapyEnum 显式转为 Number 类型确保后端正确匹配过滤 4. producerIds 为空时增加用户提示 5. 增加 .catch 错误处理避免未捕获的 Promise rejection
This commit is contained in:
@@ -508,23 +508,28 @@ function handleCancel() {
|
||||
let list = getSelectRows();
|
||||
let producerIds = [];
|
||||
list.forEach((item) => {
|
||||
// 从 exePerformRecordList 直接提取 procedureId,确保取消执行时数据完整
|
||||
const procedureIds = (item.exePerformRecordList || []).map((record) => record.procedureId);
|
||||
// 从 exePerformRecordList 直接提取 procedureId,过滤空值避免后端SQL异常
|
||||
const procedureIds = (item.exePerformRecordList || [])
|
||||
.map((record) => record.procedureId)
|
||||
.filter((id) => id != null && id !== '');
|
||||
if (procedureIds.length === 0 && (!item.procedureIds || item.procedureIds.length === 0)) {
|
||||
proxy.$modal.msgError('请选择已执行的医嘱记录');
|
||||
return;
|
||||
}
|
||||
const ids = procedureIds.length > 0 ? procedureIds : item.procedureIds;
|
||||
producerIds.push(
|
||||
...ids.map((value) => {
|
||||
...ids
|
||||
.filter((value) => value != null && value !== '')
|
||||
.map((value) => {
|
||||
return {
|
||||
procedureId: value,
|
||||
therapyEnum: item.therapyEnum,
|
||||
therapyEnum: Number(item.therapyEnum),
|
||||
};
|
||||
})
|
||||
);
|
||||
});
|
||||
if (producerIds.length === 0) {
|
||||
proxy.$modal.msgError('未找到有效的执行记录,无法取消执行');
|
||||
return;
|
||||
}
|
||||
adviceCancel({ adviceExecuteDetailList: producerIds }).then((res) => {
|
||||
@@ -534,6 +539,8 @@ function handleCancel() {
|
||||
} else {
|
||||
proxy.$modal.msgError(res.msg || '取消执行失败');
|
||||
}
|
||||
}).catch(() => {
|
||||
proxy.$modal.msgError('取消执行失败,请稍后重试');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user