bug427 门诊医生站-检查开立:检查项目分类建议改为“手风琴”展开模式(唯一展开项)
This commit is contained in:
@@ -301,7 +301,12 @@
|
|||||||
<div v-if="filteredCategoryList.length === 0" class="empty-hint">
|
<div v-if="filteredCategoryList.length === 0" class="empty-hint">
|
||||||
{{ dictLoading ? '' : '暂无检查项目,请在"检查项目设置"中配置' }}
|
{{ dictLoading ? '' : '暂无检查项目,请在"检查项目设置"中配置' }}
|
||||||
</div>
|
</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
|
<el-collapse-item
|
||||||
v-for="cat in filteredCategoryList"
|
v-for="cat in filteredCategoryList"
|
||||||
:key="cat.typeId"
|
:key="cat.typeId"
|
||||||
@@ -511,7 +516,7 @@ const rules = {
|
|||||||
// ====== 检查项目分类 ======
|
// ====== 检查项目分类 ======
|
||||||
const categoryList = ref([]); // 原始分类+项目数据
|
const categoryList = ref([]); // 原始分类+项目数据
|
||||||
const dictSearchKey = ref('');
|
const dictSearchKey = ref('');
|
||||||
const activeNames = ref([]); // 当前展开的折叠项
|
const activeNames = ref(''); // 当前展开的折叠项
|
||||||
|
|
||||||
const allMethods = ref([]);
|
const allMethods = ref([]);
|
||||||
|
|
||||||
@@ -652,16 +657,14 @@ async function handleCategoryExpand(cat) {
|
|||||||
console.error('加载分类检查方法失败', err);
|
console.error('加载分类检查方法失败', err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async function handleCollapseChange(activeNames) {
|
async function handleCollapseChange(activeName) {
|
||||||
// 当折叠面板展开时,加载对应分类的检查方法
|
// 当折叠面板展开时,加载对应分类的检查方法
|
||||||
if (Array.isArray(activeNames) && activeNames.length > 0) {
|
if (activeName) {
|
||||||
for (const typeId of activeNames) {
|
const cat = filteredCategoryList.value.find(c => c.typeId == activeName);
|
||||||
const cat = filteredCategoryList.value.find(c => c.typeId == typeId);
|
|
||||||
if (cat && (!cat.methods || cat.methods.length === 0)) {
|
if (cat && (!cat.methods || cat.methods.length === 0)) {
|
||||||
await handleCategoryExpand(cat);
|
await handleCategoryExpand(cat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(availableMethods, (newMethods) => {
|
watch(availableMethods, (newMethods) => {
|
||||||
@@ -761,7 +764,7 @@ async function loadCategoryList() {
|
|||||||
|
|
||||||
// 默认展开第一个
|
// 默认展开第一个
|
||||||
if (categoryList.value.length > 0) {
|
if (categoryList.value.length > 0) {
|
||||||
activeNames.value = [categoryList.value[0].typeId];
|
activeNames.value = categoryList.value[0].typeId;
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('加载检查项目分类失败', err);
|
console.error('加载检查项目分类失败', err);
|
||||||
|
|||||||
Reference in New Issue
Block a user