Fix Bug #550: AI修复
This commit is contained in:
@@ -58,51 +58,73 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed } from 'vue'
|
||||
import { ref } from 'vue'
|
||||
|
||||
// 类型定义(实际项目中应从 API 或全局类型导入)
|
||||
interface ExamMethod { id: string; name: string; checked: boolean }
|
||||
interface ExamItem { id: string; name: string; checked: boolean; methods: ExamMethod[] }
|
||||
interface Category { id: string; name: string; children: ExamItem[] }
|
||||
// 类型定义
|
||||
interface Method {
|
||||
id: string
|
||||
name: string
|
||||
checked: boolean
|
||||
}
|
||||
|
||||
// 模拟数据源(实际应通过 API 获取)
|
||||
interface ExamItem {
|
||||
id: string
|
||||
name: string
|
||||
checked: boolean
|
||||
methods: Method[]
|
||||
}
|
||||
|
||||
interface Category {
|
||||
id: string
|
||||
name: string
|
||||
children?: Category[]
|
||||
items?: ExamItem[]
|
||||
}
|
||||
|
||||
// 状态初始化
|
||||
const categories = ref<Category[]>([])
|
||||
const currentCategory = ref<Category | null>(null)
|
||||
|
||||
// 修复 Bug #550:默认收起状态,不预设任何展开项
|
||||
const currentItems = ref<ExamItem[]>([])
|
||||
const selectedItems = ref<ExamItem[]>([])
|
||||
// 修复:默认收起,不自动展开明细
|
||||
const activeCollapseNames = ref<string[]>([])
|
||||
|
||||
const currentItems = computed(() => currentCategory.value?.children || [])
|
||||
|
||||
const selectedItems = computed(() => {
|
||||
const result: ExamItem[] = []
|
||||
categories.value.forEach(cat => {
|
||||
cat.children.forEach(item => {
|
||||
if (item.checked) result.push(item)
|
||||
})
|
||||
})
|
||||
return result
|
||||
})
|
||||
|
||||
// 分类切换
|
||||
const handleCategorySelect = (node: Category) => {
|
||||
currentCategory.value = node
|
||||
currentItems.value = node.items || []
|
||||
}
|
||||
|
||||
// 修复 Bug #550:项目勾选与检查方法完全解耦
|
||||
const handleItemCheck = (item: ExamItem) => {
|
||||
// 仅切换项目自身的 checked 状态,绝不联动修改 item.methods
|
||||
// 保持父子状态独立,由医生手动分别勾选
|
||||
}
|
||||
|
||||
const handleMethodCheck = (sel: ExamItem, method: ExamMethod) => {
|
||||
// 仅切换检查方法状态,不影响父级项目
|
||||
}
|
||||
|
||||
// 修复 Bug #550:清理冗余“套餐”字样,避免名称遮挡
|
||||
// 修复:清理名称,去除冗余的“套餐”字样
|
||||
const cleanName = (name: string) => {
|
||||
if (!name) return ''
|
||||
// 移除常见冗余前缀/后缀,保留核心业务名称
|
||||
return name.replace(/(项目)?套餐(明细)?/g, '').trim()
|
||||
return name.replace(/套餐/g, '').trim()
|
||||
}
|
||||
|
||||
// 修复:项目勾选与检查方法解耦,仅维护已选列表,不联动勾选方法
|
||||
const handleItemCheck = (item: ExamItem) => {
|
||||
if (item.checked) {
|
||||
// 若未加入已选列表,则添加(方法默认未勾选)
|
||||
if (!selectedItems.value.find(s => s.id === item.id)) {
|
||||
selectedItems.value.push({
|
||||
...item,
|
||||
methods: item.methods.map(m => ({ ...m, checked: false }))
|
||||
})
|
||||
}
|
||||
} else {
|
||||
// 取消勾选则从已选列表移除,并清理折叠状态
|
||||
selectedItems.value = selectedItems.value.filter(s => s.id !== item.id)
|
||||
activeCollapseNames.value = activeCollapseNames.value.filter(n => n !== item.id)
|
||||
}
|
||||
}
|
||||
|
||||
// 修复:检查方法独立控制,不反向影响父项目状态
|
||||
const handleMethodCheck = (parentItem: ExamItem, method: Method) => {
|
||||
const sel = selectedItems.value.find(s => s.id === parentItem.id)
|
||||
if (sel) {
|
||||
const targetMethod = sel.methods.find(m => m.id === method.id)
|
||||
if (targetMethod) {
|
||||
targetMethod.checked = method.checked
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -111,46 +133,53 @@ const cleanName = (name: string) => {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
padding: 16px;
|
||||
height: 100%;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.category-panel, .item-panel, .selected-panel {
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.item-list {
|
||||
max-height: 300px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.item-row, .method-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 8px 0;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
/* 修复 Bug #550:名称超长时省略显示,配合 Tooltip 提示完整内容 */
|
||||
.item-name, .collapse-title {
|
||||
.item-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 4px 0;
|
||||
}
|
||||
/* 修复:名称自适应宽度,超长省略并支持悬浮提示 */
|
||||
.item-name {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
}
|
||||
.collapse-title {
|
||||
font-weight: 500;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
max-width: 100%;
|
||||
display: inline-block;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.method-container {
|
||||
padding-left: 24px;
|
||||
border-left: 2px solid #ebeef5;
|
||||
margin-left: 4px;
|
||||
padding: 8px 0 8px 24px;
|
||||
border-left: 2px solid #e4e7ed;
|
||||
margin-left: 8px;
|
||||
}
|
||||
.method-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 4px 0;
|
||||
}
|
||||
|
||||
.empty-tip {
|
||||
color: #909399;
|
||||
text-align: center;
|
||||
padding: 24px 0;
|
||||
font-size: 14px;
|
||||
padding: 20px 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user