Fix Bug #550: AI修复
This commit is contained in:
@@ -30,6 +30,7 @@
|
|||||||
<div v-else class="selected-list">
|
<div v-else class="selected-list">
|
||||||
<div v-for="item in selectedItems" :key="item.id" class="selected-card">
|
<div v-for="item in selectedItems" :key="item.id" class="selected-card">
|
||||||
<div class="card-header" @click="toggleExpand(item.id)">
|
<div class="card-header" @click="toggleExpand(item.id)">
|
||||||
|
<!-- 宽度自适应 + 悬停提示完整名称 -->
|
||||||
<span class="item-title" :title="item.name">{{ formatItemName(item.name) }}</span>
|
<span class="item-title" :title="item.name">{{ formatItemName(item.name) }}</span>
|
||||||
<el-icon class="expand-icon">
|
<el-icon class="expand-icon">
|
||||||
<ArrowDown v-if="!item.expanded" />
|
<ArrowDown v-if="!item.expanded" />
|
||||||
@@ -58,159 +59,139 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
import { ArrowDown, ArrowUp } from '@element-plus/icons-vue'
|
import { ArrowDown, ArrowUp } from '@element-plus/icons-vue'
|
||||||
|
|
||||||
// 模拟数据结构(实际应从 API 获取)
|
// 状态定义
|
||||||
interface ExamItem {
|
|
||||||
id: string
|
|
||||||
name: string
|
|
||||||
methods: { id: string; name: string }[]
|
|
||||||
}
|
|
||||||
|
|
||||||
const categoryTree = ref<any[]>([])
|
const categoryTree = ref<any[]>([])
|
||||||
const currentItems = ref<ExamItem[]>([])
|
const currentItems = ref<any[]>([])
|
||||||
const selectedItemIds = ref<string[]>([])
|
const selectedItemIds = ref<number[]>([])
|
||||||
const selectedMethodIds = ref<string[]>([])
|
const selectedMethodIds = ref<number[]>([])
|
||||||
|
const selectedItems = ref<any[]>([])
|
||||||
// 已选项目状态管理(独立维护展开状态)
|
|
||||||
const selectedItems = reactive<{ id: string; name: string; methods: ExamItem['methods']; expanded: boolean }[]>([])
|
|
||||||
|
|
||||||
// 格式化名称:去除冗余“套餐”字样
|
|
||||||
const formatItemName = (name: string) => {
|
|
||||||
return name.replace(/^套餐|套餐$/g, '').trim()
|
|
||||||
}
|
|
||||||
|
|
||||||
// 分类切换
|
// 分类切换
|
||||||
const handleCategorySelect = (data: any) => {
|
const handleCategorySelect = (node: any) => {
|
||||||
// TODO: 调用 API 加载对应分类下的项目
|
currentItems.value = node.items || []
|
||||||
currentItems.value = data.items || []
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 项目勾选(核心修复1:解耦,不联动勾选方法)
|
// 项目勾选变更(核心解耦逻辑)
|
||||||
const handleItemChange = (ids: string[]) => {
|
const handleItemChange = (ids: number[]) => {
|
||||||
const addedIds = ids.filter(id => !selectedItemIds.value.includes(id))
|
const addedIds = ids.filter(id => !selectedItemIds.value.includes(id))
|
||||||
const removedIds = selectedItemIds.value.filter(id => !ids.includes(id))
|
const removedIds = selectedItemIds.value.filter(id => !ids.includes(id))
|
||||||
|
|
||||||
// 新增项目
|
// 新增项目:默认 expanded: false,不联动勾选方法
|
||||||
addedIds.forEach(id => {
|
addedIds.forEach(id => {
|
||||||
const item = currentItems.value.find(i => i.id === id)
|
const item = currentItems.value.find(i => i.id === id)
|
||||||
if (item && !selectedItems.find(s => s.id === id)) {
|
if (item && !selectedItems.value.find(s => s.id === id)) {
|
||||||
selectedItems.push({
|
selectedItems.value.push({
|
||||||
id: item.id,
|
...item,
|
||||||
name: item.name,
|
expanded: false, // 修复:默认收起状态
|
||||||
methods: item.methods || [],
|
methods: item.methods || []
|
||||||
expanded: false // 核心修复3:默认收起
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// 移除项目
|
// 移除项目:同步清理已选列表及对应的方法勾选
|
||||||
removedIds.forEach(id => {
|
removedIds.forEach(id => {
|
||||||
const idx = selectedItems.findIndex(s => s.id === id)
|
const target = selectedItems.value.find(s => s.id === id)
|
||||||
if (idx > -1) selectedItems.splice(idx, 1)
|
if (target) {
|
||||||
// 清理该项目关联的已选方法,保持状态干净
|
selectedMethodIds.value = selectedMethodIds.value.filter(
|
||||||
const item = selectedItems.find(s => s.id === id)
|
mId => !target.methods.some(m => m.id === mId)
|
||||||
if (item) {
|
)
|
||||||
selectedMethodIds.value = selectedMethodIds.value.filter(mid => !item.methods.some(m => m.id === mid))
|
|
||||||
}
|
}
|
||||||
|
selectedItems.value = selectedItems.value.filter(s => s.id !== id)
|
||||||
})
|
})
|
||||||
|
|
||||||
selectedItemIds.value = ids
|
selectedItemIds.value = ids
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查方法勾选(核心修复1:独立控制)
|
// 检查方法勾选变更(独立维护,不反向影响项目)
|
||||||
const handleMethodChange = (ids: string[]) => {
|
const handleMethodChange = (ids: number[]) => {
|
||||||
selectedMethodIds.value = ids
|
selectedMethodIds.value = ids
|
||||||
}
|
}
|
||||||
|
|
||||||
// 展开/收起切换
|
// 展开/收起切换
|
||||||
const toggleExpand = (id: string) => {
|
const toggleExpand = (id: number) => {
|
||||||
const item = selectedItems.find(s => s.id === id)
|
const item = selectedItems.value.find(i => i.id === id)
|
||||||
if (item) item.expanded = !item.expanded
|
if (item) item.expanded = !item.expanded
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 名称格式化:去除冗余“套餐”字样
|
||||||
|
const formatItemName = (name: string) => {
|
||||||
|
return name.replace(/套餐/g, '')
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.exam-request-wrapper {
|
.exam-request-wrapper {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
|
padding: 16px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.left-panel, .middle-panel, .right-panel {
|
||||||
|
border: 1px solid #ebeef5;
|
||||||
|
border-radius: 4px;
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
|
||||||
|
|
||||||
.left-panel, .middle-panel, .right-panel {
|
|
||||||
flex: 1;
|
|
||||||
border: 1px solid #ebeef5;
|
|
||||||
padding: 12px;
|
|
||||||
border-radius: 6px;
|
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
.left-panel { width: 20%; }
|
||||||
|
.middle-panel { width: 30%; }
|
||||||
|
.right-panel { width: 50%; }
|
||||||
|
|
||||||
.selected-list {
|
.selected-list {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.selected-card {
|
.selected-card {
|
||||||
border: 1px solid #dcdfe6;
|
border: 1px solid #dcdfe6;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
background: #fafafa;
|
background: #fafafa;
|
||||||
transition: all 0.2s;
|
width: 100%; /* 修复:宽度自适应容器 */
|
||||||
|
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;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
padding: 4px 0;
|
padding: 4px 0;
|
||||||
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 核心修复2:宽度自适应,超长省略,悬停提示 */
|
|
||||||
.item-title {
|
.item-title {
|
||||||
font-weight: 500;
|
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-width: 0;
|
font-weight: 500;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
margin-right: 8px;
|
max-width: 100%; /* 修复:支持文本溢出省略 */
|
||||||
color: #303133;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.expand-icon {
|
.expand-icon {
|
||||||
|
margin-left: 8px;
|
||||||
color: #909399;
|
color: #909399;
|
||||||
font-size: 14px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-body {
|
.card-body {
|
||||||
margin-top: 10px;
|
margin-top: 8px;
|
||||||
padding-top: 10px;
|
padding-top: 8px;
|
||||||
border-top: 1px dashed #e4e7ed;
|
border-top: 1px dashed #ebeef5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.method-section {
|
.method-section {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 8px;
|
gap: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 核心修复3:移除冗余标签,保留清晰层级 */
|
|
||||||
.section-label {
|
.section-label {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #909399;
|
color: #909399;
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
font-weight: 500;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.empty-tip {
|
.empty-tip {
|
||||||
text-align: center;
|
|
||||||
color: #909399;
|
color: #909399;
|
||||||
padding: 40px 0;
|
text-align: center;
|
||||||
font-size: 14px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -18,9 +18,10 @@ describe('HIS 门诊医生站回归测试', () => {
|
|||||||
|
|
||||||
it('Bug #550: 检查申请项目选择交互优化', { tags: ['@bug550', '@regression'] }, () => {
|
it('Bug #550: 检查申请项目选择交互优化', { tags: ['@bug550', '@regression'] }, () => {
|
||||||
// 1. 验证解耦:勾选项目不应自动勾选检查方法
|
// 1. 验证解耦:勾选项目不应自动勾选检查方法
|
||||||
cy.get('.category-panel').contains('彩超').click()
|
cy.get('.left-panel').contains('彩超').click()
|
||||||
cy.get('.item-panel').contains('128线排').click()
|
cy.get('.middle-panel').contains('128线排').click()
|
||||||
cy.get('.method-panel .el-checkbox').should('not.be.checked')
|
// 检查方法区域默认不应被勾选,保持独立
|
||||||
|
cy.get('.right-panel .method-section .el-checkbox').should('not.be.checked')
|
||||||
|
|
||||||
// 2. 验证卡片显示:去除“套餐”前缀,宽度自适应,悬停提示完整名称
|
// 2. 验证卡片显示:去除“套餐”前缀,宽度自适应,悬停提示完整名称
|
||||||
cy.get('.selected-card .item-title').should('not.contain', '套餐')
|
cy.get('.selected-card .item-title').should('not.contain', '套餐')
|
||||||
@@ -32,5 +33,9 @@ describe('HIS 门诊医生站回归测试', () => {
|
|||||||
cy.get('.selected-card .card-body').should('be.visible')
|
cy.get('.selected-card .card-body').should('be.visible')
|
||||||
cy.get('.selected-card .section-label').should('contain', '检查方法')
|
cy.get('.selected-card .section-label').should('contain', '检查方法')
|
||||||
cy.get('.selected-card .section-label').should('not.contain', '项目套餐明细')
|
cy.get('.selected-card .section-label').should('not.contain', '项目套餐明细')
|
||||||
|
|
||||||
|
// 4. 验证手动勾选方法不影响项目状态(反向解耦验证)
|
||||||
|
cy.get('.right-panel .method-section .el-checkbox').first().click()
|
||||||
|
cy.get('.middle-panel .el-checkbox').first().should('be.checked')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user