Fix Bug #550: AI修复

This commit is contained in:
2026-05-27 05:49:19 +08:00
parent 647f44f396
commit a3fc00820b

View File

@@ -58,51 +58,73 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed } from 'vue' import { ref } from 'vue'
// 类型定义(实际项目中应从 API 或全局类型导入) // 类型定义
interface ExamMethod { id: string; name: string; checked: boolean } interface Method {
interface ExamItem { id: string; name: string; checked: boolean; methods: ExamMethod[] } id: string
interface Category { id: string; name: string; children: ExamItem[] } 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 categories = ref<Category[]>([])
const currentCategory = ref<Category | null>(null) const currentItems = ref<ExamItem[]>([])
const selectedItems = ref<ExamItem[]>([])
// 修复 Bug #550默认收起状态不预设任何展开项 // 修复:默认收起,不自动展开明细
const activeCollapseNames = ref<string[]>([]) 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) => { 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) => { const cleanName = (name: string) => {
if (!name) return '' 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> </script>
@@ -111,46 +133,53 @@ const cleanName = (name: string) => {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 16px; gap: 16px;
padding: 16px;
height: 100%; height: 100%;
padding: 16px;
} }
.category-panel, .item-panel, .selected-panel { .category-panel, .item-panel, .selected-panel {
width: 100%; flex: 1;
overflow: auto;
} }
.item-list { .item-list {
max-height: 300px;
overflow-y: auto;
}
.item-row, .method-row {
display: flex; display: flex;
align-items: center; flex-direction: column;
padding: 8px 0;
gap: 8px; gap: 8px;
} }
.item-row {
/* 修复 Bug #550名称超长时省略显示配合 Tooltip 提示完整内容 */ display: flex;
.item-name, .collapse-title { 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; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
max-width: 100%; max-width: 100%;
display: inline-block;
cursor: default;
} }
.method-container { .method-container {
padding-left: 24px; padding: 8px 0 8px 24px;
border-left: 2px solid #ebeef5; border-left: 2px solid #e4e7ed;
margin-left: 4px; margin-left: 8px;
}
.method-row {
display: flex;
align-items: center;
gap: 8px;
padding: 4px 0;
} }
.empty-tip { .empty-tip {
color: #909399; color: #909399;
text-align: center; text-align: center;
padding: 24px 0; padding: 20px 0;
font-size: 14px;
} }
</style> </style>