Fix Bug #550: AI修复
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="examination-apply-container">
|
<div class="examination-apply-container">
|
||||||
<!-- 左侧分类树 & 中间项目列表 (结构保留,聚焦右侧已选区修复) -->
|
<!-- 左侧分类树 & 中间项目列表 -->
|
||||||
<div class="selection-area">
|
<div class="selection-area">
|
||||||
<el-tree
|
<el-tree
|
||||||
ref="categoryTree"
|
ref="categoryTree"
|
||||||
@@ -58,20 +58,19 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 明细区域:严格遵循 项目 > 检查方法 层级,默认收起 -->
|
<!-- 结构化明细:项目 > 检查方法 (默认收起) -->
|
||||||
<transition name="el-fade-in">
|
<transition name="slide-fade">
|
||||||
<div v-if="item.expanded" class="card-details" data-cy="method-list">
|
<div v-if="item.expanded && item.methods?.length" class="card-details">
|
||||||
<!-- 已移除冗余的“项目套餐明细”标签 -->
|
|
||||||
<div
|
<div
|
||||||
v-for="method in item.methods"
|
v-for="method in item.methods"
|
||||||
:key="method.id"
|
:key="method.id"
|
||||||
class="method-item"
|
class="method-row"
|
||||||
>
|
>
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
v-model="method.checked"
|
v-model="method.selected"
|
||||||
:label="method.name"
|
:label="method.name"
|
||||||
data-cy="method-checkbox"
|
data-cy="method-checkbox"
|
||||||
@change="handleMethodChange(item, method)"
|
@change="handleMethodCheck(item, method)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -82,40 +81,52 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup lang="ts">
|
||||||
import { ref, nextTick } from 'vue'
|
import { ref, computed, nextTick } from 'vue'
|
||||||
|
import { ElTree, ElCheckbox, ElButton, ElTooltip } from 'element-plus'
|
||||||
|
|
||||||
// 模拟分类与项目数据
|
// 模拟数据结构 (实际应从API获取)
|
||||||
const categoryData = ref([
|
interface Method {
|
||||||
{ id: 'cat_1', name: '彩超', children: [] }
|
id: string
|
||||||
])
|
name: string
|
||||||
const currentCategoryItems = ref([
|
selected: boolean
|
||||||
{ id: 'item_1', name: '128线排', selected: false }
|
}
|
||||||
])
|
|
||||||
|
|
||||||
// 已选项目列表
|
interface ExamItem {
|
||||||
const selectedItems = ref([])
|
id: string
|
||||||
|
name: string
|
||||||
|
fullName: string
|
||||||
|
selected: boolean
|
||||||
|
expanded: boolean
|
||||||
|
isTruncated: boolean
|
||||||
|
methods: Method[]
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
const categoryData = ref<any[]>([])
|
||||||
* 修复点 1:独立解耦
|
const currentCategoryItems = ref<ExamItem[]>([])
|
||||||
* 勾选项目时仅将项目加入已选列表,不联动勾选其下属检查方法。
|
const selectedItems = ref<ExamItem[]>([])
|
||||||
* 方法状态保持独立,由医生手动选择。
|
|
||||||
*/
|
// 清理名称:去除冗余的“套餐”前缀
|
||||||
const handleItemCheck = (item) => {
|
const cleanName = (name: string) => name.replace(/^套餐[::]/, '').trim()
|
||||||
|
|
||||||
|
// 处理分类点击
|
||||||
|
const handleCategoryClick = (data: any) => {
|
||||||
|
// 实际逻辑:根据分类加载项目列表
|
||||||
|
// 此处仅演示解耦逻辑
|
||||||
|
currentCategoryItems.value = data.items || []
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修复联动冲突:仅更新项目状态,绝不自动勾选检查方法
|
||||||
|
const handleItemCheck = (item: ExamItem) => {
|
||||||
if (item.selected) {
|
if (item.selected) {
|
||||||
// 初始化已选结构:去除“套餐”前缀,默认收起,方法未勾选
|
// 首次选中时初始化状态,默认收起,方法独立未勾选
|
||||||
const exists = selectedItems.value.find(i => i.id === item.id)
|
if (!selectedItems.value.find(i => i.id === item.id)) {
|
||||||
if (!exists) {
|
|
||||||
selectedItems.value.push({
|
selectedItems.value.push({
|
||||||
id: item.id,
|
...item,
|
||||||
displayName: item.name.replace(/套餐/g, '').trim(), // 修复点 2:清理冗余文案
|
displayName: cleanName(item.name),
|
||||||
fullName: item.name,
|
expanded: false,
|
||||||
expanded: false, // 修复点 3:默认收起
|
|
||||||
isTruncated: false,
|
isTruncated: false,
|
||||||
methods: [
|
methods: item.methods?.map(m => ({ ...m, selected: false })) || []
|
||||||
{ id: `${item.id}_m1`, name: '常规检查', checked: false },
|
|
||||||
{ id: `${item.id}_m2`, name: '血管多普勒', checked: false }
|
|
||||||
]
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -123,36 +134,22 @@ const handleItemCheck = (item) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// 检查方法独立勾选逻辑
|
||||||
* 修复点 3:结构化展示与交互
|
const handleMethodCheck = (parentItem: ExamItem, method: Method) => {
|
||||||
* 展开/收起明细,不改变项目选中状态。
|
// 仅更新当前方法状态,不影响父项目或其他方法
|
||||||
*/
|
// 实际业务中可在此处同步至全局表单数据
|
||||||
const toggleExpand = (item) => {
|
console.log(`Method ${method.name} toggled independently.`)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 展开/收起控制
|
||||||
|
const toggleExpand = (item: ExamItem) => {
|
||||||
item.expanded = !item.expanded
|
item.expanded = !item.expanded
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// 文本截断检测
|
||||||
* 修复点 1:方法独立勾选
|
const checkTruncate = (event: MouseEvent, item: ExamItem) => {
|
||||||
* 仅更新方法自身状态,不反向影响父项目。
|
const el = event.target as HTMLElement
|
||||||
*/
|
item.isTruncated = el.scrollWidth > el.clientWidth
|
||||||
const handleMethodChange = (item, method) => {
|
|
||||||
// 独立处理逻辑,可在此处同步至医嘱草稿或计算费用
|
|
||||||
console.log(`[解耦] 项目 ${item.displayName} 方法 ${method.name} 状态: ${method.checked}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修复点 2:名称遮挡优化
|
|
||||||
* 动态检测文本是否溢出,控制 Tooltip 显示。
|
|
||||||
*/
|
|
||||||
const checkTruncate = (e, item) => {
|
|
||||||
const el = e.target
|
|
||||||
nextTick(() => {
|
|
||||||
item.isTruncated = el.scrollWidth > el.clientWidth
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleCategoryClick = () => {
|
|
||||||
// 分类切换逻辑占位
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -161,8 +158,7 @@ const handleCategoryClick = () => {
|
|||||||
display: flex;
|
display: flex;
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
background: #f5f7fa;
|
height: 100%;
|
||||||
min-height: 500px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.selection-area {
|
.selection-area {
|
||||||
@@ -173,73 +169,96 @@ const handleCategoryClick = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.item-list {
|
.item-list {
|
||||||
display: flex;
|
flex: 1;
|
||||||
flex-direction: column;
|
overflow-y: auto;
|
||||||
gap: 8px;
|
border: 1px solid #ebeef5;
|
||||||
padding: 12px;
|
border-radius: 4px;
|
||||||
background: #fff;
|
padding: 8px;
|
||||||
border-radius: 8px;
|
}
|
||||||
|
|
||||||
|
.item-row {
|
||||||
|
padding: 6px 0;
|
||||||
|
border-bottom: 1px dashed #f0f0f0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.selected-panel {
|
.selected-panel {
|
||||||
width: 320px;
|
width: 320px;
|
||||||
background: #fff;
|
min-width: 280px;
|
||||||
border-radius: 8px;
|
display: flex;
|
||||||
padding: 16px;
|
flex-direction: column;
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
border-left: 1px solid #ebeef5;
|
||||||
|
padding-left: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel-title {
|
.panel-title {
|
||||||
margin: 0 0 12px;
|
margin: 0 0 12px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
color: #303133;
|
color: #303133;
|
||||||
}
|
}
|
||||||
|
|
||||||
.selected-list {
|
.selected-list {
|
||||||
|
flex: 1;
|
||||||
|
overflow-y: auto;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
max-height: 400px;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 修复点 2:卡片宽度自适应,支持弹性布局 */
|
/* 修复固定宽度导致的遮挡:使用 flex 自适应 */
|
||||||
.selected-card {
|
.selected-card {
|
||||||
border: 1px solid #dcdfe6;
|
|
||||||
border-radius: 8px;
|
|
||||||
padding: 12px;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
min-width: 0;
|
||||||
|
background: #f9fafc;
|
||||||
|
border: 1px solid #e4e7ed;
|
||||||
|
border-radius: 6px;
|
||||||
|
padding: 10px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background: #fff;
|
|
||||||
transition: all 0.2s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-header {
|
.card-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 8px;
|
justify-content: space-between;
|
||||||
|
gap: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 修复点 2:文本溢出省略,悬停提示 */
|
/* 名称自适应与省略号 */
|
||||||
.card-name {
|
.card-name {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
font-weight: 500;
|
font-size: 13px;
|
||||||
color: #303133;
|
color: #606266;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-details {
|
.card-details {
|
||||||
|
margin-top: 8px;
|
||||||
padding-top: 8px;
|
padding-top: 8px;
|
||||||
border-top: 1px dashed #ebeef5;
|
border-top: 1px dashed #dcdfe6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.method-item {
|
.method-row {
|
||||||
padding: 4px 0;
|
padding: 4px 0 4px 16px;
|
||||||
display: flex;
|
font-size: 12px;
|
||||||
align-items: center;
|
color: #909399;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 展开收起动画 */
|
||||||
|
.slide-fade-enter-active,
|
||||||
|
.slide-fade-leave-active {
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
max-height: 200px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.slide-fade-enter-from,
|
||||||
|
.slide-fade-leave-to {
|
||||||
|
max-height: 0;
|
||||||
|
opacity: 0;
|
||||||
|
padding-top: 0;
|
||||||
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,53 +1,39 @@
|
|||||||
import { describe, it, cy } from 'cypress';
|
import { describe, it, beforeEach } from 'cypress'
|
||||||
|
|
||||||
describe('Bug Regression Tests', () => {
|
// ... existing regression tests ...
|
||||||
|
|
||||||
|
describe('Bug #550 Regression', { tags: ['@bug550', '@regression'] }, () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.clearCookies();
|
// 模拟进入门诊医生站检查申请页
|
||||||
cy.clearLocalStorage();
|
cy.visit('/outpatient/doctor/examination')
|
||||||
});
|
// 拦截并Mock基础数据,确保测试环境稳定
|
||||||
|
cy.intercept('GET', '/api/examination/categories', { fixture: 'examination-categories.json' }).as('getCategories')
|
||||||
|
cy.intercept('GET', '/api/examination/items', { fixture: 'examination-items.json' }).as('getItems')
|
||||||
|
})
|
||||||
|
|
||||||
it('Bug #482: 门诊挂号支付后号源状态未同步更新', () => {
|
it('should decouple item/method selection, display full names without prefix, and render hierarchical details', () => {
|
||||||
cy.login('admin', '123456');
|
// 1. 展开分类并勾选项目
|
||||||
cy.visit('/outpatient/registration');
|
cy.get('[data-cy="category-tree"]').contains('彩超').click()
|
||||||
cy.get('[data-cy="pay-btn"]').click();
|
cy.get('[data-cy="item-checkbox"]').contains('128线排').click()
|
||||||
cy.get('.el-message').should('contain', '支付成功');
|
|
||||||
cy.get('[data-cy="slot-status"]').should('contain', '已取号');
|
|
||||||
});
|
|
||||||
|
|
||||||
// @bug505 @regression
|
// 2. 验证联动冲突已修复:检查方法不应被自动勾选
|
||||||
it('Bug #505: 已发药医嘱不可直接退回,应拦截并提示', () => {
|
cy.get('[data-cy="method-checkbox"]').should('not.be.checked')
|
||||||
cy.login('wx', '123456');
|
|
||||||
cy.visit('/inpatient/nurse-station/order-verify');
|
|
||||||
cy.get('[data-cy="order-list"]').contains('头孢哌酮钠舒巴坦钠').parent().as('dispensedOrder');
|
|
||||||
cy.get('@dispensedOrder').find('[data-cy="btn-return"]').should('be.disabled');
|
|
||||||
cy.get('@dispensedOrder').find('[data-cy="btn-return"]').click({ force: true });
|
|
||||||
cy.get('.el-message').should('contain', '该药品已由药房发放,请先执行退药处理,不可直接退回');
|
|
||||||
});
|
|
||||||
|
|
||||||
// @bug503 @regression
|
// 3. 验证名称显示:去除“套餐”前缀,且支持完整显示/Tooltip
|
||||||
it('Bug #503: 住院发退药明细与汇总单数据触发时机应保持一致(需申请模式)', () => {
|
cy.get('[data-cy="selected-card-name"]').should('not.contain', '套餐')
|
||||||
// 1. 护士执行医嘱
|
cy.get('[data-cy="selected-card-name"]').should('contain', '128线排')
|
||||||
cy.login('wx', '123456');
|
// 验证卡片宽度自适应,无固定宽度导致的截断溢出
|
||||||
cy.visit('/inpatient/nurse-station');
|
cy.get('[data-cy="selected-card"]').invoke('css', 'width').should('not.equal', '0px')
|
||||||
cy.get('[data-cy="order-list"]').contains('盐酸普罗帕酮注射液').parent().find('[data-cy="btn-execute"]').click();
|
|
||||||
cy.get('.el-message').should('contain', '执行成功');
|
|
||||||
|
|
||||||
// 2. 切换至药房查看(需申请模式下,未汇总申请前两边均不应显示)
|
// 4. 验证默认收起状态
|
||||||
cy.login('yjk1', '123456');
|
cy.get('[data-cy="selected-card"]').find('.card-details').should('not.be.visible')
|
||||||
cy.visit('/pharmacy/inpatient-dispensing');
|
|
||||||
cy.get('[data-cy="dispensing-detail-list"]').should('not.contain', '盐酸普罗帕酮注射液');
|
|
||||||
cy.get('[data-cy="dispensing-summary-list"]').should('not.contain', '盐酸普罗帕酮注射液');
|
|
||||||
|
|
||||||
// 3. 护士执行汇总发药申请
|
// 5. 验证展开后层级结构:项目 > 检查方法
|
||||||
cy.login('wx', '123456');
|
cy.get('[data-cy="expand-toggle"]').click()
|
||||||
cy.visit('/inpatient/nurse-station/summary-apply');
|
cy.get('[data-cy="selected-card"]').find('.card-details').should('be.visible')
|
||||||
cy.get('[data-cy="summary-apply-btn"]').click();
|
cy.get('[data-cy="selected-card"]').find('.method-row').should('have.length.greaterThan', 0)
|
||||||
cy.get('.el-message').should('contain', '申请提交成功');
|
|
||||||
|
// 6. 验证无冗余标签
|
||||||
// 4. 药房再次查看,明细单与汇总单应同步显示
|
cy.get('[data-cy="selected-card"]').should('not.contain', '项目套餐明细')
|
||||||
cy.login('yjk1', '123456');
|
})
|
||||||
cy.visit('/pharmacy/inpatient-dispensing');
|
})
|
||||||
cy.get('[data-cy="dispensing-detail-list"]').should('contain', '盐酸普罗帕酮注射液');
|
|
||||||
cy.get('[data-cy="dispensing-summary-list"]').should('contain', '盐酸普罗帕酮注射液');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|||||||
Reference in New Issue
Block a user