bug427 门诊医生站-检查开立:检查项目分类建议改为“手风琴”展开模式(唯一展开项)

This commit is contained in:
2026-05-06 17:47:05 +08:00
parent 42d9fb7ac2
commit dc24f0f2b9

View File

@@ -301,7 +301,12 @@
<div v-if="filteredCategoryList.length === 0" class="empty-hint">
{{ dictLoading ? '' : '暂无检查项目请在"检查项目设置"中配置' }}
</div>
<el-collapse v-else v-model="activeNames" @change="(activeNames) => handleCollapseChange(activeNames)">
<el-collapse
v-else
v-model="activeNames"
accordion
@change="handleCollapseChange"
>
<el-collapse-item
v-for="cat in filteredCategoryList"
:key="cat.typeId"
@@ -511,7 +516,7 @@ const rules = {
// ====== 检查项目分类 ======
const categoryList = ref([]); // 原始分类+项目数据
const dictSearchKey = ref('');
const activeNames = ref([]); // 当前展开的折叠项
const activeNames = ref(''); // 当前展开的折叠项
const allMethods = ref([]);
@@ -652,17 +657,15 @@ async function handleCategoryExpand(cat) {
console.error('加载分类检查方法失败', err);
}
}
async function handleCollapseChange(activeNames) {
async function handleCollapseChange(activeName) {
// 当折叠面板展开时,加载对应分类的检查方法
if (Array.isArray(activeNames) && activeNames.length > 0) {
for (const typeId of activeNames) {
const cat = filteredCategoryList.value.find(c => c.typeId == typeId);
if (activeName) {
const cat = filteredCategoryList.value.find(c => c.typeId == activeName);
if (cat && (!cat.methods || cat.methods.length === 0)) {
await handleCategoryExpand(cat);
}
}
}
}
watch(availableMethods, (newMethods) => {
if (form.inspectionMethod && !newMethods.find(m => m.name === form.inspectionMethod)) {
@@ -761,7 +764,7 @@ async function loadCategoryList() {
// 默认展开第一个
if (categoryList.value.length > 0) {
activeNames.value = [categoryList.value[0].typeId];
activeNames.value = categoryList.value[0].typeId;
}
} catch (err) {
console.error('加载检查项目分类失败', err);