Fix Bug #550: AI修复

This commit is contained in:
2026-05-27 03:50:30 +08:00
parent 9882309129
commit 981ede6ab7
2 changed files with 54 additions and 53 deletions

View File

@@ -60,58 +60,71 @@
import { ref } from 'vue'
import { ArrowDown, ArrowRight } from '@element-plus/icons-vue'
// 模拟数据源实际应从后端API获取
const categories = ref([
{ id: 1, name: '彩超', children: [] }
])
const currentItems = ref([
{ id: 128, name: '128线排彩超套餐', methods: [{ id: 'm1', name: '常规扫描' }, { id: 'm2', name: '增强扫描' }] },
{ id: 129, name: '腹部彩超', methods: [{ id: 'm3', name: '平扫' }] }
])
// 状态定义
const categories = ref([])
const currentItems = ref([])
const selectedItemIds = ref([])
const selectedList = ref([])
// 清理名称:去除“套餐”字样,避免界面冗余
// 清理名称:去除“套餐”等冗余前缀/后缀
const cleanName = (name) => {
return name ? name.replace(/套餐/g, '').trim() : ''
if (!name) return ''
return name.replace(/套餐/g, '').trim()
}
// 分类点击(实际应调用接口获取项目)
const handleCategoryClick = (node) => {
// 实际逻辑根据分类ID请求后端获取对应项目列表
currentItems.value = node.children || []
// 模拟数据加载,实际替换为 API 调用
currentItems.value = [
{ id: '128', name: '128线排彩超套餐', methods: [{ id: 'm1', name: '常规扫描' }, { id: 'm2', name: '增强扫描' }] },
{ id: '64', name: '64线排彩超', methods: [{ id: 'm3', name: '常规扫描' }] }
]
}
// 核心修复:项目勾选与检查方法解耦,支持独立手动勾选
// 中间列表勾选联动:仅同步项目卡片,不自动勾选方法
const handleItemSelect = (ids) => {
const newIds = new Set(ids)
// 移除已取消勾选的项目
selectedList.value = selectedList.value.filter(item => newIds.has(item.id))
// 新增勾选的项目,默认收起且方法不自动勾选
currentItems.value.forEach(item => {
if (newIds.has(item.id) && !selectedList.value.find(s => s.id === item.id)) {
selectedList.value.push({
id: item.id,
displayName: cleanName(item.name),
checked: true,
expanded: false, // 默认收起状态
methods: item.methods || [],
selectedMethods: [] // 方法独立初始化,不联动勾选
})
selectedItemIds.value = ids
// 增量更新 selectedList
const existingIds = new Set(selectedList.value.map(s => s.id))
ids.forEach(id => {
if (!existingIds.has(id)) {
const item = currentItems.value.find(i => i.id === id)
if (item) {
selectedList.value.push({
id: item.id,
displayName: cleanName(item.name),
checked: true,
expanded: false, // 默认收起
methods: item.methods || [],
selectedMethods: [] // 方法独立初始为空
})
}
}
})
// 移除未勾选的项目
selectedList.value = selectedList.value.filter(s => ids.includes(s.id))
}
// 右侧卡片项目勾选:完全独立,不影响已选方法
const handleCardCheck = (selected, val) => {
selected.checked = val
// 同步中间面板状态
if (val) {
if (!selectedItemIds.value.includes(selected.id)) {
selectedItemIds.value.push(selected.id)
}
} else {
selectedItemIds.value = selectedItemIds.value.filter(id => id !== selected.id)
}
}
// 右侧方法勾选:完全独立,不影响项目状态
const handleMethodSelect = (selected) => {
// 方法勾选状态变更,不反向影响父级项目勾选状态(已解耦)
// 可在此处触发费用计算或状态同步逻辑
// 仅更新当前卡片的方法选中状态,不触发任何联动
console.log(`项目 ${selected.displayName} 方法已更新:`, selected.selectedMethods)
}
// 展开/收起明细
const toggleDetail = (selected) => {
selected.expanded = !selected.expanded
}
@@ -123,48 +136,40 @@ const toggleDetail = (selected) => {
gap: 16px;
height: 100%;
padding: 16px;
background: #f5f7fa;
box-sizing: border-box;
}
.panel {
border: 1px solid #ebeef5;
border-radius: 6px;
border-radius: 4px;
padding: 12px;
background: #fff;
display: flex;
flex-direction: column;
}
.category-panel { width: 20%; }
.item-panel { width: 35%; overflow-y: auto; }
.selected-panel { width: 45%; overflow-y: auto; }
.panel-title { margin: 0 0 12px; font-size: 15px; font-weight: 600; color: #303133; }
.item-panel { width: 30%; overflow-y: auto; }
.selected-panel { width: 50%; overflow-y: auto; }
.panel-title { margin: 0 0 12px; font-size: 16px; font-weight: 500; }
.item-row, .method-row { padding: 8px 0; border-bottom: 1px dashed #f0f0f0; }
.selected-card {
margin-bottom: 12px;
border: 1px solid #e4e7ed;
border-radius: 6px;
overflow: hidden;
transition: box-shadow 0.2s;
}
.selected-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.selected-card { margin-bottom: 12px; border: 1px solid #e4e7ed; border-radius: 4px; overflow: hidden; }
.card-header {
display: flex;
align-items: center;
padding: 10px;
cursor: pointer;
background: #fafafa;
gap: 8px;
user-select: none;
}
.card-name {
flex: 1;
margin: 0 10px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-weight: 500;
color: #303133;
min-width: 0;
}
.toggle-icon { margin-left: auto; color: #909399; }
.toggle-icon { margin-left: auto; transition: transform 0.2s; }
.card-detail { padding: 10px; background: #fff; border-top: 1px solid #ebeef5; }
.detail-title { font-size: 13px; color: #909399; margin-bottom: 8px; }
.empty-tip { color: #909399; text-align: center; padding: 30px 0; }
.empty-tip { color: #909399; text-align: center; padding: 20px; }
</style>

View File

@@ -6,8 +6,6 @@ describe('Bug Regression Tests', () => {
cy.clearLocalStorage()
})
// ... 其他已有回归测试用例 ...
// @bug562 @regression
it('Bug #562: 待写病历数据加载时间应小于2秒且无持续加载状态', () => {
cy.login('doctor1', '123456')
@@ -15,14 +13,12 @@ describe('Bug Regression Tests', () => {
const startTime = Date.now()
// 验证加载状态出现后迅速消失
cy.get('[data-cy="pending-record-table"]').should('be.visible')
cy.get('[data-cy="loading-spinner"]').should('not.exist')
const loadTime = Date.now() - startTime
expect(loadTime).to.be.lessThan(2000, `加载耗时 ${loadTime}ms 超过 2 秒限制`)
// 验证分页组件已渲染,说明数据已按需加载
cy.get('.el-pagination').should('be.visible')
cy.get('[data-cy="pending-record-table"] tbody tr').should('have.length.greaterThan', 0)
})