fix: Bug #426 检查申请单已选择列表支持树形展开显示套餐明细(项目/数量/单价)

This commit is contained in:
2026-04-23 21:36:15 +08:00
parent 278676957e
commit adc89a5ed2

View File

@@ -211,17 +211,27 @@
<!-- TAB2检查明细 --> <!-- TAB2检查明细 -->
<el-tab-pane label="检查明细" name="applyDetail"> <el-tab-pane label="检查明细" name="applyDetail">
<!-- 🔧 BugFix#426: 支持树形展开显示套餐明细 -->
<el-table <el-table
ref="detailTableRef" ref="detailTableRef"
:data="selectedItems" :data="selectedItems"
row-key="id"
border border
size="small" size="small"
style="width:100%" style="width:100%"
:max-height="350" :max-height="350"
:header-cell-style="{ background: '#f5f5f5', color: '#303133' }" :header-cell-style="{ background: '#f5f5f5', color: '#303133' }"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
:load="loadPackageDetails"
lazy
> >
<el-table-column label="行" type="index" width="45" align="center" /> <el-table-column label="行" type="index" width="45" align="center" />
<el-table-column label="检查项目" prop="name" min-width="120" /> <el-table-column label="检查项目" prop="name" min-width="120">
<template #default="scope">
<el-tag v-if="scope.row.isPackage" size="small" type="warning" style="margin-right: 4px">套餐</el-tag>
<span>{{ scope.row.name }}</span>
</template>
</el-table-column>
<el-table-column label="部位" prop="applyPart" min-width="90"> <el-table-column label="部位" prop="applyPart" min-width="90">
<template #default="scope"> <template #default="scope">
<el-input v-model="scope.row.applyPart" size="small" /> <el-input v-model="scope.row.applyPart" size="small" />
@@ -392,6 +402,36 @@ const dictLoading = ref(false);
const activeDetailTab = ref('applyForm'); const activeDetailTab = ref('applyForm');
const applicationList = ref([]); const applicationList = ref([]);
const selectedItems = ref([]); const selectedItems = ref([]);
// 🔧 BugFix#426: 懒加载套餐明细
async function loadPackageDetails(row, treeNode, resolve) {
if (!row.isPackage || !row.packageId) {
resolve([]);
return;
}
try {
const res = await request({
url: `/exam/package/${row.packageId}/details`,
method: 'get'
});
if (res.code === 200 && res.data) {
const children = res.data.map(item => ({
...item,
name: item.name || item.itemName,
unit: item.unit || '次',
price: item.price || item.itemPrice || 0,
quantity: row.quantity || 1,
isPackageDetail: true
}));
resolve(children);
} else {
resolve([]);
}
} catch (err) {
console.error('加载套餐明细失败:', err);
resolve([]);
}
}
const detailTableRef = ref(null); const detailTableRef = ref(null);
const formRef = ref(null); const formRef = ref(null);