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