Fix Bug #428: 门诊医生站-检查申请:未实现分类联动检查方法及套餐明细展示与勾选逻辑

修复三个根因问题:
1. handleCollapseChange 从 filteredCategoryList(计算属性映射副本)查找分类,
   改为从 categoryList(原始响应式数组)查找,确保 handleCategoryExpand 对
   cat.methods 的赋值能正确触发 Vue 响应式更新,分类展开后检查方法列表正常渲染
2. handleMethodSelect 跨分类检查中 cat.typeCode 与 newItem.checkType(cat.typeName)
   类型不匹配,改为统一使用 cat.typeName 比较
3. handleItemSelect 同样存在 typeCode vs typeName 不匹配问题,一并修复

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
赵云
2026-05-13 15:10:29 +08:00
parent f4c6c12ef8
commit 30f8cdbd80

View File

@@ -730,7 +730,9 @@ function handleCollapseChange(activeName) {
setTimeout(() => { isAnimating.value = false; }, 300); // 与 CSS 过渡时长一致
if (activeName) {
const cat = filteredCategoryList.value.find(c => c.typeId == activeName);
// Bug #428修复: 直接从 categoryList原始响应式数组查找分类
// 确保后续 handleCategoryExpand 对 cat.methods 的赋值能正确触发 Vue 响应式更新
const cat = categoryList.value.find(c => c.typeId == activeName);
if (cat && (!cat.methods || cat.methods.length === 0)) {
handleCategoryExpand(cat); // 异步加载,不 await
}
@@ -1149,7 +1151,8 @@ async function handleMethodSelect(checked, method, cat) {
// 如果该项目不存在,创建一个并关联方法
if (selectedItems.value.length > 0) {
const currentCategory = selectedItems.value[0].checkType;
const newCategory = cat.typeCode || '';
// Bug #428修复: 使用 cat.typeName 进行比较(与 newItem.checkType 保持一致)
const newCategory = cat.typeName || '';
if (currentCategory !== newCategory) {
ElMessage.warning('一个检查单不能同时选择多个项目类型的检查项目');
return;
@@ -1234,7 +1237,8 @@ async function handleItemSelect(checked, item, cat) {
if (selectedItems.value.length > 0) {
const currentCategory = selectedItems.value[0].checkType;
const newCategory = cat.typeCode || '';
// Bug #428修复: 使用 cat.typeName 进行比较(与 effectiveCheckType 保持一致)
const newCategory = cat.typeName || '';
if (currentCategory !== newCategory) {
ElMessage.warning('一个检查单不能同时选择多个项目类型的检查项目');
item.checked = false;