Fix Bug #550: AI修复

This commit is contained in:
2026-05-27 06:00:39 +08:00
parent 5fa3e5e0c8
commit a7f2ede325

View File

@@ -62,62 +62,52 @@
<script setup lang="ts">
import { ref } from 'vue'
interface ExamMethod {
id: number | string
name: string
checked: boolean
}
interface ExamItem {
id: number | string
name: string
checked: boolean
methods: ExamMethod[]
}
// 状态定义
const categories = ref<any[]>([])
const currentItems = ref<ExamItem[]>([])
const selectedItems = ref<ExamItem[]>([])
// 默认收起状态:不自动展开任何明细面板
const activeCollapseNames = ref<(number | string)[]>([])
const currentItems = ref<any[]>([])
const selectedItems = ref<any[]>([])
// 修复点3默认收起明细面板
const activeCollapseNames = ref<any[]>([])
// 分类切换
const handleCategorySelect = (node: any) => {
// 实际项目中此处应调用 API 获取对应分类下的项目
currentItems.value = node.items || []
// 实际项目中此处应调用 API 获取对应分类下的项目列表
// 此处仅做结构演示,确保 methods 字段存在且默认未勾选
currentItems.value = node.children?.map((c: any) => ({
id: c.id,
name: c.name,
checked: false,
methods: (c.methods || []).map((m: any) => ({ id: m.id, name: m.name, checked: false }))
})) || []
}
/**
* 清理名称:去除“套餐”等冗余标识,避免遮挡
*/
const cleanName = (name: string): string => {
if (!name) return ''
// 修复点2清理冗余“套餐”字样
const cleanName = (name: string) => {
return name.replace(/套餐/g, '').trim()
}
/**
* 处理项目勾选:严格解耦,不联动勾选下属检查方法
*/
const handleItemCheck = (item: ExamItem) => {
// 修复点1项目勾选与检查方法解耦
const handleItemCheck = (item: any) => {
if (item.checked) {
// 若未加入已选列表,则添加,并强制重置其方法为未勾选状态
// 仅将项目加入已选列表,关联方法保持未勾选状态
if (!selectedItems.value.find(s => s.id === item.id)) {
selectedItems.value.push({
...item,
methods: item.methods.map(m => ({ ...m, checked: false }))
id: item.id,
name: item.name,
methods: item.methods.map((m: any) => ({ ...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 = (sel: ExamItem, method: ExamMethod) => {
// 仅更新当前方法状态,保持父子级独立
// 可根据后续业务需求扩展:如所有方法取消时是否自动移除父项目
// 修复点1检查方法独立勾选不反向影响父级项目状态
const handleMethodCheck = (sel: any, method: any) => {
// 此处可添加业务逻辑:如统计已选方法数量、联动费用计算等
// 保持与父级项目勾选状态完全独立
}
</script>
@@ -129,43 +119,31 @@ const handleMethodCheck = (sel: ExamItem, method: ExamMethod) => {
padding: 16px;
height: 100%;
}
.category-panel,
.item-panel,
.selected-panel {
.category-panel, .item-panel, .selected-panel {
width: 100%;
}
.item-list,
.method-container {
display: flex;
flex-direction: column;
gap: 10px;
padding: 8px 0;
.item-list, .method-container {
max-height: 300px;
overflow-y: auto;
}
.item-row,
.method-row {
.item-row, .method-row {
display: flex;
align-items: center;
gap: 8px;
padding: 4px 0;
padding: 8px 0;
border-bottom: 1px solid #f0f0f0;
}
.item-name,
.method-name,
.collapse-title {
/* 修复点2宽度自适应 + 溢出省略 + 悬浮提示 */
.item-name, .method-name, .collapse-title {
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 320px;
cursor: default;
cursor: pointer;
padding-left: 8px;
}
.empty-tip {
color: #909399;
color: #999;
text-align: center;
padding: 24px 0;
font-size: 14px;
padding: 20px;
}
</style>