Fix Bug #426: 门诊医生站-检查开立:已选择列表应支持树形展开,显示套餐明细(项目/数量/单价)
根因: Element Plus el-table 懒加载模式下,tree-props.hasChildren 要求行数据 包含 hasChildren: true 才能显示展开箭头。所有创建套餐项的代码路径都设置了 isPackage: true 和 packageId,但未设置 hasChildren 属性。 修复: 在 7 处代码路径中补充 hasChildren 属性设置。
This commit is contained in:
@@ -1250,7 +1250,8 @@ function handleRowClick(row) {
|
||||
expanded: false,
|
||||
packageDetailsLoading: false,
|
||||
isPackage: false,
|
||||
packageId: null
|
||||
packageId: null,
|
||||
hasChildren: false // #426修复: 树形表格懒加载展开标记,后续根据packageId动态设置
|
||||
};
|
||||
// 加载该项目的检查方法
|
||||
if (m.bodyPartCode) {
|
||||
@@ -1278,6 +1279,7 @@ function handleRowClick(row) {
|
||||
if (item.selectedMethod?.packageId) {
|
||||
item.isPackage = true;
|
||||
item.packageId = item.selectedMethod.packageId;
|
||||
item.hasChildren = true; // #426修复
|
||||
}
|
||||
}
|
||||
if (!item.selectedMethod && item.methods.length) {
|
||||
@@ -1286,6 +1288,7 @@ function handleRowClick(row) {
|
||||
if (item.selectedMethod?.packageId) {
|
||||
item.packageId = item.selectedMethod.packageId;
|
||||
item.isPackage = true;
|
||||
item.hasChildren = true; // #426修复
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
@@ -1361,6 +1364,7 @@ async function handleMethodSelect(checked, method, cat) {
|
||||
if (method.packageId) {
|
||||
existingItem.isPackage = true;
|
||||
existingItem.packageId = method.packageId;
|
||||
existingItem.hasChildren = true; // #426修复
|
||||
existingItem.packageName = method.packageName || existingItem.packageName; // #428修复: 确保 packageName 同步
|
||||
// 预加载套餐明细
|
||||
loadPackageDetailsForItem(existingItem);
|
||||
@@ -1395,7 +1399,8 @@ async function handleMethodSelect(checked, method, cat) {
|
||||
// 从方法或项目中获取套餐信息
|
||||
isPackage: !!method.packageId || !!targetItem.packageName,
|
||||
packageId: method.packageId || targetItem.packageId || null,
|
||||
packageName: method.packageName || targetItem.packageName || null // #428修复: 复制 packageName,确保套餐明细可加载
|
||||
packageName: method.packageName || targetItem.packageName || null, // #428修复: 复制 packageName,确保套餐明细可加载
|
||||
hasChildren: !!(method.packageId || targetItem.packageId) // #426修复: 树形表格懒加载展开标记
|
||||
};
|
||||
selectedItems.value.push(newItem);
|
||||
|
||||
@@ -1483,7 +1488,8 @@ async function handleItemSelect(checked, item, cat) {
|
||||
isPackage: !!(item.packageId || item.packageName),
|
||||
packageName: item.packageName || null,
|
||||
packageDetailsLoading: false,
|
||||
packageId: item.packageId || null
|
||||
packageId: item.packageId || null,
|
||||
hasChildren: !!(item.packageId) // #426修复: 树形表格懒加载展开标记
|
||||
};
|
||||
selectedItems.value.push(newRow);
|
||||
// 必须用数组里的响应式行,不能继续改局部 newRow:push 后列表内是 proxy,改 raw 对象不会触发右侧卡片更新(会一直卡在「加载中」)
|
||||
@@ -1605,6 +1611,7 @@ async function onDetailMethodChange(row, val) {
|
||||
if (val?.packageId) {
|
||||
row.packageId = val.packageId;
|
||||
row.isPackage = true;
|
||||
row.hasChildren = true; // #426修复
|
||||
}
|
||||
row.packageDetailsDisplay = undefined;
|
||||
const carrier = getPackageCarrier(row);
|
||||
|
||||
Reference in New Issue
Block a user