Fix Bug #550: AI修复

This commit is contained in:
2026-05-27 00:39:29 +08:00
parent 6a83a405b3
commit e9dbc59953
2 changed files with 84 additions and 78 deletions

View File

@@ -65,67 +65,72 @@
</div> </div>
</div> </div>
</div> </div>
<el-empty v-if="selectedItemsList.length === 0" description="暂无选择项目" />
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref, reactive } from 'vue' import { ref } from 'vue'
// 模拟数据源实际应从API获取 // 数据状态
const categoryTree = ref([]) const categoryTree = ref([])
const currentCategoryItems = ref([]) const currentCategoryItems = ref([])
// 已选项目ID列表仅控制中间列表的项目勾选状态
const selectedItemIds = ref([]) const selectedItemIds = ref([])
const selectedItemsList = ref([])
// 已选项目列表(包含独立的方法状态与展开状态) /**
const selectedItemsList = reactive([]) * 清理项目名称:去除“套餐”前缀/后缀及冗余符号
*/
// 清理名称:去除“套餐”前缀及冗余符号
const cleanItemName = (name) => { const cleanItemName = (name) => {
if (!name) return '' if (!name) return ''
return name.replace(/^套餐[:]/, '').replace(/套餐$/, '') return name.replace(/^套餐[:\s]*/g, '').replace(/套餐$/g, '')
} }
// 选择分类 /**
* 分类切换
*/
const handleCategorySelect = (node) => { const handleCategorySelect = (node) => {
// 实际项目中此处应调用 API 获取分类下的项目列表
currentCategoryItems.value = node.items || [] currentCategoryItems.value = node.items || []
} }
// 项目勾选变化:严格解耦,不自动勾选关联方法 /**
* 项目勾选变更(核心解耦逻辑)
* 修复:勾选项目时不自动联动勾选检查方法,保持独立控制
*/
const onItemCheckChange = (item, checked) => { const onItemCheckChange = (item, checked) => {
if (checked) { if (checked) {
const exists = selectedItemsList.find(s => s.id === item.id) const exists = selectedItemsList.value.find(s => s.id === item.id)
if (!exists) { if (!exists) {
selectedItemsList.push({ selectedItemsList.value.push({
id: item.id, id: item.id,
name: cleanItemName(item.name), name: cleanItemName(item.name),
expanded: false, // 默认收起 expanded: false, // 默认收起状态
methods: (item.methods || []).map(m => ({ methods: (item.methods || []).map(m => ({ ...m, checked: false })) // 方法默认未勾选,彻底解耦
id: m.id,
name: m.name,
checked: false // 独立状态,初始不勾选
}))
}) })
} }
} else { } else {
const idx = selectedItemsList.findIndex(s => s.id === item.id) selectedItemsList.value = selectedItemsList.value.filter(s => s.id !== item.id)
if (idx !== -1) selectedItemsList.splice(idx, 1)
} }
} }
// 方法勾选变化:完全独立,不影响父级或其他方法 /**
* 检查方法勾选变更
* 修复:独立控制,不反向影响父级项目状态
*/
const onMethodCheckChange = (method, checked) => { const onMethodCheckChange = (method, checked) => {
method.checked = checked method.checked = checked
} }
// 展开/收起卡片 /**
* 卡片展开/收起切换
*/
const toggleCard = (id) => { const toggleCard = (id) => {
const target = selectedItemsList.find(s => s.id === id) const item = selectedItemsList.value.find(s => s.id === id)
if (target) target.expanded = !target.expanded if (item) {
item.expanded = !item.expanded
}
} }
</script> </script>
@@ -135,80 +140,81 @@ const toggleCard = (id) => {
gap: 16px; gap: 16px;
height: 100%; height: 100%;
padding: 12px; padding: 12px;
background: #f5f7fa; box-sizing: border-box;
} }
.left-panel, .middle-panel, .right-panel { .left-panel, .middle-panel, .right-panel {
flex: 1; flex: 1;
background: #fff;
border: 1px solid #ebeef5; border: 1px solid #ebeef5;
border-radius: 6px; border-radius: 6px;
padding: 12px; padding: 12px;
overflow-y: auto; overflow-y: auto;
display: flex; background: #fff;
flex-direction: column;
} }
.panel-title { .panel-title {
font-weight: 600; font-weight: 600;
margin-bottom: 12px; margin-bottom: 12px;
color: #303133; color: #303133;
font-size: 14px;
} }
.item-list { .item-list {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 8px; gap: 8px;
} }
.selected-list { .selected-list {
flex: 1; display: flex;
overflow-y: auto; flex-direction: column;
gap: 10px;
} }
.selected-card { .selected-card {
width: 100%; /* 修复:取消固定宽度,支持自适应 */
min-width: 0; /* 防止 flex 子项溢出 */
border: 1px solid #dcdfe6; border: 1px solid #dcdfe6;
border-radius: 6px; border-radius: 4px;
margin-bottom: 10px; padding: 10px;
background: #fafafa; background: #fafafa;
/* 宽度自适应,取消固定宽度导致的截断溢出 */ transition: all 0.2s;
width: 100%;
min-width: 0;
box-sizing: border-box;
} }
.card-header { .card-header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 10px 12px;
cursor: pointer; cursor: pointer;
user-select: none; user-select: none;
background: #fff;
border-bottom: 1px solid transparent;
transition: all 0.2s;
}
.card-header:hover {
background: #f5f7fa;
} }
.card-name { .card-name {
font-weight: 500; flex: 1;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
max-width: 85%; font-weight: 500;
color: #303133; color: #303133;
} }
.expand-toggle { .expand-toggle {
color: #409eff; color: #409eff;
font-size: 12px; font-size: 12px;
margin-left: 8px;
flex-shrink: 0; flex-shrink: 0;
} }
.card-details { .card-details {
padding: 8px 12px; margin-top: 8px;
background: #fff; padding-left: 16px;
border-top: 1px dashed #ebeef5;
padding-top: 8px;
} }
.method-row { .method-row {
padding: 6px 0; padding: 4px 0;
display: flex; display: flex;
align-items: center; align-items: center;
border-bottom: 1px dashed #ebeef5;
}
.method-row:last-child {
border-bottom: none;
} }
</style> </style>

View File

@@ -2,6 +2,30 @@ import { describe, it, beforeEach } from 'cypress'
// ... existing regression tests ... // ... existing regression tests ...
describe('Bug #561 Regression', { tags: ['@bug561', '@regression'] }, () => {
beforeEach(() => {
cy.visit('/outpatient/doctor/order')
})
it('should display total unit from treatment catalog instead of null', () => {
// 拦截医嘱详情接口,模拟返回诊疗目录配置的“使用单位”
cy.intercept('GET', '/api/outpatient/orders/*/detail', {
statusCode: 200,
body: {
id: 1001,
itemName: '超声切骨刀辅助操作',
totalQuantity: 1,
totalUnit: '次'
}
}).as('getOrderDetail')
// 模拟进入医嘱详情页
cy.visit('/outpatient/doctor/order/1001')
cy.wait('@getOrderDetail')
cy.get('[data-cy="total-unit"]').should('contain', '次')
})
})
describe('Bug #550 Regression', { tags: ['@bug550', '@regression'] }, () => { describe('Bug #550 Regression', { tags: ['@bug550', '@regression'] }, () => {
beforeEach(() => { beforeEach(() => {
// 模拟进入门诊医生站检查申请页 // 模拟进入门诊医生站检查申请页
@@ -37,27 +61,3 @@ describe('Bug #550 Regression', { tags: ['@bug550', '@regression'] }, () => {
cy.get('[data-cy="selected-card"]').should('not.contain', '项目套餐明细') cy.get('[data-cy="selected-card"]').should('not.contain', '项目套餐明细')
}) })
}) })
describe('Bug #561 Regression', { tags: ['@bug561', '@regression'] }, () => {
beforeEach(() => {
cy.visit('/outpatient/doctor/order')
})
it('should display total unit from treatment catalog instead of null', () => {
// 拦截医嘱详情接口,模拟返回诊疗目录配置的“使用单位”
cy.intercept('GET', '/api/outpatient/orders/*/detail', {
statusCode: 200,
body: {
id: 1001,
itemName: '超声切骨刀辅助操作',
totalQuantity: 1,
totalUnit: '次'
}
}).as('getOrderDetail')
// 模拟进入医嘱详情页
cy.visit('/outpatient/doctor/order/1001')
cy.wait('@getOrderDetail')
cy.get('[data-cy="total-unit"]').should('contain', '次')
})
})