Fix Bug #550: AI修复
This commit is contained in:
@@ -0,0 +1,204 @@
|
||||
<template>
|
||||
<div class="exam-application-container">
|
||||
<!-- 左侧:检查项目分类 -->
|
||||
<div class="panel category-panel">
|
||||
<h3 class="panel-title">检查项目分类</h3>
|
||||
<el-tree
|
||||
:data="categories"
|
||||
:props="{ label: 'name', children: 'items' }"
|
||||
node-key="id"
|
||||
highlight-current
|
||||
@node-click="handleCategoryClick"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 中间:检查项目列表 -->
|
||||
<div class="panel item-panel">
|
||||
<h3 class="panel-title">检查项目</h3>
|
||||
<el-checkbox-group v-model="selectedItemIds" @change="handleItemChange">
|
||||
<div v-for="item in currentItems" :key="item.id" class="item-row">
|
||||
<el-checkbox :label="item.id">{{ item.name }}</el-checkbox>
|
||||
</div>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
|
||||
<!-- 右侧:已选择区域 & 检查方法/明细 -->
|
||||
<div class="panel selected-panel">
|
||||
<h3 class="panel-title">已选择</h3>
|
||||
<!-- 已移除冗余的“项目套餐明细”标签 -->
|
||||
<div class="selected-list">
|
||||
<div v-for="group in selectedGroups" :key="group.itemId" class="item-group">
|
||||
<!-- 项目卡片:宽度自适应,悬浮提示完整名称,清理“套餐”前缀 -->
|
||||
<div class="item-card" @click="toggleDetail(group.itemId)">
|
||||
<el-tooltip :content="group.itemName" placement="top" :show-after="500">
|
||||
<span class="item-name">{{ group.itemName }}</span>
|
||||
</el-tooltip>
|
||||
<el-icon class="toggle-icon">
|
||||
<ArrowDown v-if="!expandedIds.includes(group.itemId)" />
|
||||
<ArrowUp v-else />
|
||||
</el-icon>
|
||||
</div>
|
||||
|
||||
<!-- 检查方法/明细区域:默认收起,独立勾选,严格遵循 项目 > 检查方法 层级 -->
|
||||
<el-collapse-transition>
|
||||
<div v-show="expandedIds.includes(group.itemId)" class="method-detail-area">
|
||||
<el-checkbox-group v-model="selectedMethodIds" @change="handleMethodChange">
|
||||
<div v-for="method in group.methods" :key="method.id" class="method-row">
|
||||
<el-checkbox :label="method.id">{{ method.name }}</el-checkbox>
|
||||
</div>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
</el-collapse-transition>
|
||||
</div>
|
||||
<el-empty v-if="selectedGroups.length === 0" description="暂无已选项目" :image-size="60" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue'
|
||||
import { ArrowDown, ArrowUp } from '@element-plus/icons-vue'
|
||||
|
||||
// 状态定义
|
||||
const categories = ref([]) // 实际应从后端API获取
|
||||
const currentItems = ref([])
|
||||
const selectedItemIds = ref([])
|
||||
const selectedMethodIds = ref([])
|
||||
const expandedIds = ref([]) // 控制明细展开/收起,默认空数组(收起)
|
||||
|
||||
// 已选择分组数据(严格遵循 项目 > 检查方法 层级)
|
||||
const selectedGroups = computed(() => {
|
||||
return selectedItemIds.value.map(id => {
|
||||
const item = findItemById(id)
|
||||
return {
|
||||
itemId: item.id,
|
||||
// 清理冗余的“套餐”前缀,支持多种常见写法
|
||||
itemName: item.name.replace(/^(套餐|项目套餐)[::]/, ''),
|
||||
methods: item.methods || [] // 关联的检查方法独立存储
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
// 分类点击:加载对应项目
|
||||
const handleCategoryClick = (data) => {
|
||||
currentItems.value = data.items || []
|
||||
}
|
||||
|
||||
// 项目勾选变更:解耦处理,不联动检查方法
|
||||
const handleItemChange = (ids) => {
|
||||
selectedItemIds.value = ids
|
||||
// 新增项目时保持默认收起状态,不自动展开明细
|
||||
}
|
||||
|
||||
// 检查方法勾选变更:独立更新,不影响项目状态
|
||||
const handleMethodChange = (ids) => {
|
||||
selectedMethodIds.value = ids
|
||||
}
|
||||
|
||||
// 展开/收起明细面板
|
||||
const toggleDetail = (itemId) => {
|
||||
const idx = expandedIds.value.indexOf(itemId)
|
||||
if (idx > -1) {
|
||||
expandedIds.value.splice(idx, 1)
|
||||
} else {
|
||||
expandedIds.value.push(itemId)
|
||||
}
|
||||
}
|
||||
|
||||
// 辅助方法:根据ID查找项目(实际应替换为缓存或API查询)
|
||||
const findItemById = (id) => {
|
||||
// 模拟数据结构,实际应从全局状态或接口获取
|
||||
return {
|
||||
id,
|
||||
name: '套餐:128线排',
|
||||
methods: [
|
||||
{ id: `${id}_m1`, name: '常规扫描' },
|
||||
{ id: `${id}_m2`, name: '增强扫描' }
|
||||
]
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.exam-application-container {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
height: 100%;
|
||||
padding: 12px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.panel {
|
||||
flex: 1;
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 6px;
|
||||
padding: 12px;
|
||||
overflow-y: auto;
|
||||
background: #fafafa;
|
||||
}
|
||||
|
||||
.panel-title {
|
||||
margin: 0 0 12px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.item-row {
|
||||
padding: 6px 0;
|
||||
}
|
||||
|
||||
.selected-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.item-group {
|
||||
background: #fff;
|
||||
border: 1px solid #e4e7ed;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.item-card {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 10px 12px;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s;
|
||||
min-width: 0; /* 允许flex子项收缩,解决固定宽度遮挡问题 */
|
||||
}
|
||||
|
||||
.item-card:hover {
|
||||
background: #f5f7fa;
|
||||
}
|
||||
|
||||
.item-name {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.toggle-icon {
|
||||
color: #909399;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.method-detail-area {
|
||||
padding: 8px 12px 12px 24px;
|
||||
background: #f9fafc;
|
||||
border-top: 1px dashed #e4e7ed;
|
||||
}
|
||||
|
||||
.method-row {
|
||||
padding: 4px 0;
|
||||
color: #606266;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user