Fix Bug #550: AI修复
This commit is contained in:
@@ -1,13 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="exam-application-container">
|
<div class="examination-application-container">
|
||||||
<el-row :gutter="16" class="layout-grid">
|
<el-row :gutter="16" class="main-layout">
|
||||||
<!-- 左侧:检查项目分类 -->
|
<!-- 左侧:检查项目分类 -->
|
||||||
<el-col :span="6">
|
<el-col :span="5">
|
||||||
<el-card shadow="never" class="panel-card">
|
<el-card shadow="never" class="panel-card">
|
||||||
<template #header>检查项目分类</template>
|
<template #header>检查项目分类</template>
|
||||||
<el-tree
|
<el-tree
|
||||||
:data="categories"
|
ref="categoryTreeRef"
|
||||||
:props="{ label: 'name', children: 'children' }"
|
:data="categoryList"
|
||||||
node-key="id"
|
node-key="id"
|
||||||
highlight-current
|
highlight-current
|
||||||
@node-click="handleCategoryClick"
|
@node-click="handleCategoryClick"
|
||||||
@@ -20,64 +20,60 @@
|
|||||||
<el-col :span="9">
|
<el-col :span="9">
|
||||||
<el-card shadow="never" class="panel-card">
|
<el-card shadow="never" class="panel-card">
|
||||||
<template #header>检查项目</template>
|
<template #header>检查项目</template>
|
||||||
<div class="item-list" v-loading="loadingItems">
|
<div class="item-scroll-area" data-cy="item-list">
|
||||||
<el-checkbox-group v-model="selectedItemIds" @change="onItemSelect">
|
<div v-for="item in currentItems" :key="item.id" class="item-row">
|
||||||
<div
|
<el-checkbox
|
||||||
v-for="item in currentItems"
|
v-model="item.checked"
|
||||||
:key="item.id"
|
@change="handleItemCheck(item)"
|
||||||
class="item-row"
|
:label="item.name"
|
||||||
:data-cy="`item-${item.id}`"
|
|
||||||
>
|
>
|
||||||
<el-checkbox :label="item.id" :value="item.id">
|
{{ formatItemName(item.name) }}
|
||||||
{{ cleanItemName(item.name) }}
|
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
</div>
|
</div>
|
||||||
</el-checkbox-group>
|
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
<!-- 右侧/下方:已选择区域 -->
|
<!-- 右侧:已选择区域 -->
|
||||||
<el-col :span="9">
|
<el-col :span="10">
|
||||||
<el-card shadow="never" class="panel-card">
|
<el-card shadow="never" class="panel-card">
|
||||||
<template #header>已选择项目</template>
|
<template #header>已选择</template>
|
||||||
<div class="selected-list" v-if="selectedItems.length > 0">
|
<div class="selected-scroll-area" data-cy="selected-list">
|
||||||
|
<div v-if="selectedItems.length === 0" class="empty-tip">暂无已选项目</div>
|
||||||
<div
|
<div
|
||||||
v-for="item in selectedItems"
|
v-for="sel in selectedItems"
|
||||||
:key="item.id"
|
:key="sel.id"
|
||||||
class="selected-card"
|
class="selected-card"
|
||||||
:title="cleanItemName(item.name)"
|
data-cy="selected-card"
|
||||||
:data-cy="`selected-card-${item.id}`"
|
|
||||||
>
|
>
|
||||||
<div class="card-header" @click="toggleExpand(item)">
|
<div class="card-header" @click="toggleDetails(sel.id)">
|
||||||
<span class="item-name">{{ cleanItemName(item.name) }}</span>
|
<el-tooltip
|
||||||
<el-icon class="expand-icon" data-cy="expand-toggle">
|
:content="formatItemName(sel.name)"
|
||||||
<ArrowUp v-if="item.expanded" />
|
placement="top"
|
||||||
<ArrowDown v-else />
|
:show-after="300"
|
||||||
|
>
|
||||||
|
<span class="item-name" data-cy="item-name">{{ formatItemName(sel.name) }}</span>
|
||||||
|
</el-tooltip>
|
||||||
|
<el-icon class="expand-icon">
|
||||||
|
<ArrowDown v-if="sel.expanded" />
|
||||||
|
<ArrowRight v-else />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- 检查方法明细(默认收起,独立勾选,移除冗余标签) -->
|
||||||
<!-- 检查方法明细(默认收起,独立勾选) -->
|
<div v-show="sel.expanded" class="method-list" data-cy="method-list">
|
||||||
<div v-show="item.expanded" class="card-details" data-cy="detail-content">
|
<div v-for="method in sel.methods" :key="method.id" class="method-row">
|
||||||
<div class="method-section">
|
<el-checkbox
|
||||||
<span class="section-label">检查方法</span>
|
v-model="method.checked"
|
||||||
<el-checkbox-group v-model="item.selectedMethods" class="method-grid">
|
@change="handleMethodCheck(sel, method)"
|
||||||
<div
|
class="method-checkbox"
|
||||||
v-for="method in item.methods"
|
data-cy="method-checkbox"
|
||||||
:key="method.id"
|
|
||||||
class="method-item"
|
|
||||||
data-cy="method-item"
|
|
||||||
>
|
>
|
||||||
<el-checkbox :label="method.id" :value="method.id">
|
|
||||||
{{ method.name }}
|
{{ method.name }}
|
||||||
</el-checkbox>
|
</el-checkbox>
|
||||||
</div>
|
</div>
|
||||||
</el-checkbox-group>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<el-empty v-else description="暂无已选项目" />
|
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@@ -85,108 +81,88 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { ArrowUp, ArrowDown } from '@element-plus/icons-vue'
|
import { ArrowDown, ArrowRight } from '@element-plus/icons-vue'
|
||||||
|
|
||||||
// 模拟分类与项目数据(实际应从 API 获取)
|
// 分类数据(实际应从后端API获取)
|
||||||
const categories = ref([
|
const categoryList = ref([
|
||||||
{ id: 'ultrasound', name: '彩超', children: [] }
|
{ id: 'c1', label: '彩超', children: [] },
|
||||||
|
{ id: 'c2', label: 'CT', children: [] }
|
||||||
])
|
])
|
||||||
|
|
||||||
const currentItems = ref([])
|
const currentItems = ref([])
|
||||||
const loadingItems = ref(false)
|
|
||||||
const selectedItemIds = ref([])
|
|
||||||
const selectedItems = ref([])
|
const selectedItems = ref([])
|
||||||
|
|
||||||
// 清理冗余“套餐”字样
|
// 格式化名称:去除冗余的“套餐”字样,避免显示混乱
|
||||||
const cleanItemName = (name) => {
|
const formatItemName = (name) => {
|
||||||
if (!name) return ''
|
if (!name) return ''
|
||||||
return name.replace(/套餐/g, '').trim()
|
return name.replace(/套餐/g, '').trim()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 切换分类加载项目
|
// 切换分类加载项目
|
||||||
const handleCategoryClick = (data) => {
|
const handleCategoryClick = (node) => {
|
||||||
loadingItems.value = true
|
// 实际项目中此处调用API获取项目列表
|
||||||
// 模拟异步请求
|
|
||||||
setTimeout(() => {
|
|
||||||
currentItems.value = [
|
currentItems.value = [
|
||||||
{ id: '128', name: '128线排彩超', methods: [
|
{ id: 'i1', name: '128线排套餐', checked: false, methods: [{ id: 'm1', name: '常规扫描', checked: false }, { id: 'm2', name: '增强扫描', checked: false }] },
|
||||||
{ id: 'm1', name: '常规检查方法' },
|
{ id: 'i2', name: '腹部彩超', checked: false, methods: [] }
|
||||||
{ id: 'm2', name: '血管多普勒' }
|
|
||||||
]},
|
|
||||||
{ id: '192', name: '192线排彩超', methods: [
|
|
||||||
{ id: 'm3', name: '心脏专项检查' }
|
|
||||||
]}
|
|
||||||
]
|
]
|
||||||
loadingItems.value = false
|
|
||||||
}, 300)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 核心修复:项目与检查方法解耦
|
// 勾选项目:解耦逻辑,不自动勾选检查方法
|
||||||
const onItemSelect = (ids) => {
|
const handleItemCheck = (item) => {
|
||||||
// 1. 移除未勾选的项目
|
if (item.checked) {
|
||||||
selectedItems.value = selectedItems.value.filter(item => ids.includes(item.id))
|
const exists = selectedItems.value.find(s => s.id === item.id)
|
||||||
|
if (!exists) {
|
||||||
// 2. 新增勾选的项目(默认收起,方法独立)
|
|
||||||
ids.forEach(id => {
|
|
||||||
if (!selectedItems.value.find(i => i.id === id)) {
|
|
||||||
const sourceItem = currentItems.value.find(i => i.id === id)
|
|
||||||
if (sourceItem) {
|
|
||||||
selectedItems.value.push({
|
selectedItems.value.push({
|
||||||
id: sourceItem.id,
|
id: item.id,
|
||||||
name: sourceItem.name,
|
name: item.name,
|
||||||
methods: sourceItem.methods || [],
|
expanded: false, // 默认收起明细
|
||||||
selectedMethods: [], // 独立维护方法勾选状态
|
methods: (item.methods || []).map(m => ({ ...m, checked: false })) // 保持独立,不联动勾选
|
||||||
expanded: false // 默认收起
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
selectedItems.value = selectedItems.value.filter(s => s.id !== item.id)
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
|
||||||
|
// 勾选检查方法:独立控制,不影响父级项目状态
|
||||||
|
const handleMethodCheck = (parentItem, method) => {
|
||||||
|
// 仅更新方法状态,不触发父级联动。可根据业务需要在此处添加校验逻辑
|
||||||
}
|
}
|
||||||
|
|
||||||
// 展开/收起明细
|
// 展开/收起明细
|
||||||
const toggleExpand = (item) => {
|
const toggleDetails = (id) => {
|
||||||
item.expanded = !item.expanded
|
const target = selectedItems.value.find(s => s.id === id)
|
||||||
|
if (target) {
|
||||||
|
target.expanded = !target.expanded
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.exam-application-container {
|
.examination-application-container {
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
background: #f5f7fa;
|
background: #f5f7fa;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel-card {
|
.panel-card {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
.item-scroll-area, .selected-scroll-area {
|
||||||
.item-list {
|
height: 500px;
|
||||||
max-height: 500px;
|
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
|
||||||
|
|
||||||
.item-row {
|
|
||||||
padding: 8px 0;
|
padding: 8px 0;
|
||||||
border-bottom: 1px dashed #ebeef5;
|
|
||||||
}
|
}
|
||||||
|
.item-row {
|
||||||
.selected-list {
|
padding: 8px 12px;
|
||||||
display: flex;
|
border-bottom: 1px solid #ebeef5;
|
||||||
flex-direction: column;
|
|
||||||
gap: 12px;
|
|
||||||
max-height: 500px;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.selected-card {
|
.selected-card {
|
||||||
|
margin-bottom: 12px;
|
||||||
border: 1px solid #dcdfe6;
|
border: 1px solid #dcdfe6;
|
||||||
border-radius: 6px;
|
border-radius: 4px;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
width: 100%; /* 宽度自适应 */
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-header {
|
.card-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@@ -194,42 +170,34 @@ const toggleExpand = (item) => {
|
|||||||
padding: 10px 12px;
|
padding: 10px 12px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
background: #fafafa;
|
background: #fafafa;
|
||||||
border-radius: 6px 6px 0 0;
|
border-bottom: 1px solid #ebeef5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-name {
|
.item-name {
|
||||||
font-weight: 500;
|
flex: 1;
|
||||||
color: #303133;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
max-width: 85%;
|
white-space: nowrap;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #303133;
|
||||||
}
|
}
|
||||||
|
|
||||||
.expand-icon {
|
.expand-icon {
|
||||||
|
margin-left: 8px;
|
||||||
color: #909399;
|
color: #909399;
|
||||||
transition: transform 0.2s;
|
|
||||||
}
|
}
|
||||||
|
.method-list {
|
||||||
.card-details {
|
padding: 8px 12px;
|
||||||
padding: 12px;
|
background: #fff;
|
||||||
border-top: 1px solid #ebeef5;
|
|
||||||
}
|
}
|
||||||
|
.method-row {
|
||||||
.section-label {
|
padding: 6px 0;
|
||||||
display: block;
|
border-bottom: 1px dashed #ebeef5;
|
||||||
font-size: 12px;
|
}
|
||||||
|
.method-row:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
.empty-tip {
|
||||||
|
text-align: center;
|
||||||
color: #909399;
|
color: #909399;
|
||||||
margin-bottom: 8px;
|
padding: 40px 0;
|
||||||
}
|
|
||||||
|
|
||||||
.method-grid {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.method-item {
|
|
||||||
padding-left: 8px;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -58,30 +58,21 @@ describe('Bug #550: 门诊医生站-检查申请项目选择交互优化', { tag
|
|||||||
it('should decouple item and method selection, optimize display, and structure hierarchy', () => {
|
it('should decouple item and method selection, optimize display, and structure hierarchy', () => {
|
||||||
cy.login('doctor1', '123456')
|
cy.login('doctor1', '123456')
|
||||||
cy.visit('/outpatient/examination-application')
|
cy.visit('/outpatient/examination-application')
|
||||||
// ... 原有测试逻辑 ...
|
|
||||||
})
|
// 1. 验证联动解耦:勾选项目不应自动勾选检查方法
|
||||||
})
|
cy.get('[data-cy="category-tree"]').contains('彩超').click()
|
||||||
|
cy.get('[data-cy="item-list"]').contains('128线排套餐').parent().find('input[type="checkbox"]').check()
|
||||||
// =========================================================================
|
cy.get('[data-cy="selected-list"]').find('.method-checkbox').should('not.be.checked')
|
||||||
// Bug #561 Regression Test
|
|
||||||
// =========================================================================
|
// 2. 验证显示优化:无“套餐”前缀,支持完整名称提示,默认收起
|
||||||
describe('Bug #561: 门诊医生站-医嘱总量单位显示修复', { tags: ['@bug561', '@regression'] }, () => {
|
cy.get('[data-cy="selected-card"]').should('have.length', 1)
|
||||||
it('should display correct usage unit from catalog instead of null', () => {
|
cy.get('[data-cy="selected-card"] .item-name').should('not.contain', '套餐')
|
||||||
cy.login('doctor1', '123456')
|
cy.get('[data-cy="selected-card"] .item-name').should('contain', '128线排')
|
||||||
cy.visit('/outpatient/doctor-workstation')
|
cy.get('[data-cy="selected-card"] .method-list').should('not.be.visible') // 默认收起
|
||||||
|
|
||||||
// 选择患者并进入医嘱页签
|
// 3. 验证层级结构:点击可展开明细,项目 > 检查方法
|
||||||
cy.get('[data-cy="patient-select"]').click()
|
cy.get('[data-cy="selected-card"] .card-header').click()
|
||||||
cy.get('[data-cy="patient-option"]').first().click()
|
cy.get('[data-cy="selected-card"] .method-list').should('be.visible')
|
||||||
cy.get('[data-cy="tab-orders"]').click()
|
cy.get('[data-cy="selected-card"] .method-row').should('have.length.greaterThan', 0)
|
||||||
|
|
||||||
// 验证医嘱列表加载
|
|
||||||
cy.get('[data-cy="order-list"]').should('be.visible')
|
|
||||||
|
|
||||||
// 核心断言:总量单位不应显示为 null,应正确渲染诊疗目录配置的单位(如“次”)
|
|
||||||
cy.get('[data-cy="order-row"]').first().within(() => {
|
|
||||||
cy.get('[data-cy="total-quantity"]').should('not.contain', 'null')
|
|
||||||
cy.get('[data-cy="total-quantity"]').should('match', /\d+\s*[^\s]+/)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user