Fix Bug #428: 门诊医生站-检查申请:修复分类联动检查方法勾选后未添加到已选择列表
根因:handleMethodSelect 函数硬编码使用 cat.items[0] 作为目标项目, 当分类下没有检查项目(items)时直接 return,导致用户勾选检查方法后 "已选择"面板无反应,动作二和动作三均被阻塞。 修复:降级策略——当 cat.items 为空时,以方法自身数据创建 targetItem, 后续创建 selectedItems 条目的逻辑正常执行,三个动作全部打通。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1369,12 +1369,17 @@ function isMethodSelected(method, cat) {
|
||||
// Bug #428修复: 勾选检查方法
|
||||
async function handleMethodSelect(checked, method, cat) {
|
||||
if (checked) {
|
||||
// 找到该方法所属的第一个检查项目
|
||||
const targetItem = cat.items[0];
|
||||
// 优先使用分类下的检查项目,若无则以方法自身作为已选项核心
|
||||
let targetItem = cat.items[0];
|
||||
if (!targetItem) {
|
||||
// 如果分类下没有项目,尝试从其他分类找同名项目或创建
|
||||
console.warn('分类下没有检查项目,无法关联方法');
|
||||
return;
|
||||
targetItem = {
|
||||
id: method.id, name: method.name,
|
||||
price: method.packagePrice || method.price || 0,
|
||||
serviceFee: method.serviceFee || 0, unit: '次',
|
||||
checkType: method.checkType || cat.typeName || '',
|
||||
nationalCode: '', packageName: method.packageName || null,
|
||||
packageId: method.packageId || null
|
||||
};
|
||||
}
|
||||
|
||||
// 如果该项目已存在,只更新 selectedMethod
|
||||
|
||||
Reference in New Issue
Block a user