Fix Bug #550: AI修复
This commit is contained in:
@@ -0,0 +1,145 @@
|
||||
<template>
|
||||
<div class="examination-application">
|
||||
<div class="layout-container">
|
||||
<!-- 左侧:检查项目分类 -->
|
||||
<div class="panel category-panel">
|
||||
<h3>检查项目分类</h3>
|
||||
<ul class="category-list">
|
||||
<li
|
||||
v-for="cat in categories"
|
||||
:key="cat.id"
|
||||
:class="{ active: selectedCategory?.id === cat.id }"
|
||||
@click="selectCategory(cat)"
|
||||
>
|
||||
{{ cat.name }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- 中间:检查项目列表 -->
|
||||
<div class="panel item-panel">
|
||||
<h3>检查项目</h3>
|
||||
<ul class="item-list">
|
||||
<li v-for="item in currentItems" :key="item.id" class="item-row">
|
||||
<input type="checkbox" :checked="isSelected(item.id)" @change="toggleItem(item)" />
|
||||
<span>{{ item.name }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- 右侧:已选择区域 -->
|
||||
<div class="panel selected-panel">
|
||||
<h3>已选择</h3>
|
||||
<div v-if="selectedItems.length === 0" class="empty-tip">暂无选择项目</div>
|
||||
<div v-else class="selected-list">
|
||||
<div v-for="item in selectedItems" :key="item.id" class="selected-card" :data-cy="`selected-card-${item.id}`">
|
||||
<div class="card-header" @click="toggleExpand(item)">
|
||||
<!-- 修复:去除“套餐”前缀,支持完整名称提示,宽度自适应 -->
|
||||
<span class="item-title" :title="cleanName(item.name)">{{ cleanName(item.name) }}</span>
|
||||
<span class="toggle-icon" data-cy="expand-btn">{{ item.expanded ? '▲' : '▼' }}</span>
|
||||
</div>
|
||||
<!-- 修复:默认收起,点击展开/收起 -->
|
||||
<div v-show="item.expanded" class="details-content" data-cy="details-panel">
|
||||
<!-- 修复:已删除“项目套餐明细”冗余标签 -->
|
||||
<div v-if="item.methods && item.methods.length > 0" class="method-list" data-cy="method-list">
|
||||
<div v-for="method in item.methods" :key="method.id" class="method-item" data-cy="method-item">
|
||||
<!-- 修复:项目与检查方法解耦,独立控制勾选状态 -->
|
||||
<input type="checkbox" :checked="method.selected" @change="toggleMethod(item, method)" />
|
||||
<span>{{ method.name }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="no-methods">无关联检查方法</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue'
|
||||
|
||||
// 模拟数据源(实际应从后端API获取)
|
||||
const categories = ref([
|
||||
{ id: 1, name: '彩超' },
|
||||
{ id: 2, name: 'CT' }
|
||||
])
|
||||
|
||||
const allItems = ref([
|
||||
{ id: 101, categoryId: 1, name: '128线排彩超套餐', methods: [
|
||||
{ id: 1001, name: '腹部彩超', selected: false },
|
||||
{ id: 1002, name: '心脏彩超', selected: false }
|
||||
]},
|
||||
{ id: 102, categoryId: 1, name: '常规彩超', methods: [] }
|
||||
])
|
||||
|
||||
const selectedCategory = ref(null)
|
||||
const selectedItems = ref([])
|
||||
|
||||
const currentItems = computed(() => {
|
||||
if (!selectedCategory.value) return []
|
||||
return allItems.value.filter(i => i.categoryId === selectedCategory.value.id)
|
||||
})
|
||||
|
||||
const selectCategory = (cat) => {
|
||||
selectedCategory.value = cat
|
||||
}
|
||||
|
||||
const isSelected = (itemId) => {
|
||||
return selectedItems.value.some(i => i.id === itemId)
|
||||
}
|
||||
|
||||
// 核心修复1:项目勾选与检查方法解耦
|
||||
const toggleItem = (item) => {
|
||||
const exists = selectedItems.value.find(i => i.id === item.id)
|
||||
if (exists) {
|
||||
selectedItems.value = selectedItems.value.filter(i => i.id !== item.id)
|
||||
} else {
|
||||
// 新增项目时,默认不勾选其下的检查方法,保持独立状态
|
||||
const newItem = {
|
||||
...item,
|
||||
expanded: false, // 默认收起
|
||||
methods: item.methods.map(m => ({ ...m, selected: false }))
|
||||
}
|
||||
selectedItems.value.push(newItem)
|
||||
}
|
||||
}
|
||||
|
||||
// 核心修复2:独立控制检查方法勾选
|
||||
const toggleMethod = (parentItem, method) => {
|
||||
method.selected = !method.selected
|
||||
}
|
||||
|
||||
// 核心修复3:展开/收起控制
|
||||
const toggleExpand = (item) => {
|
||||
item.expanded = !item.expanded
|
||||
}
|
||||
|
||||
// 核心修复4:清理“套餐”字样,提供完整名称提示
|
||||
const cleanName = (name) => {
|
||||
return name.replace(/套餐/g, '').trim()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.examination-application { height: 100%; padding: 16px; box-sizing: border-box; }
|
||||
.layout-container { display: flex; gap: 16px; height: 100%; }
|
||||
.panel { flex: 1; border: 1px solid #e4e7ed; padding: 12px; border-radius: 6px; background: #fff; display: flex; flex-direction: column; }
|
||||
.panel h3 { margin: 0 0 12px; font-size: 14px; color: #303133; border-bottom: 1px solid #ebeef5; padding-bottom: 8px; }
|
||||
.category-list, .item-list { list-style: none; padding: 0; margin: 0; overflow-y: auto; flex: 1; }
|
||||
.category-list li, .item-row { padding: 10px 8px; cursor: pointer; border-bottom: 1px solid #f5f7fa; transition: background 0.2s; }
|
||||
.category-list li:hover, .item-row:hover { background: #f0f7ff; }
|
||||
.category-list li.active { background: #ecf5ff; color: #409eff; font-weight: 500; }
|
||||
.selected-list { overflow-y: auto; flex: 1; }
|
||||
.selected-card { border: 1px solid #dcdfe6; border-radius: 4px; margin-bottom: 8px; overflow: hidden; background: #fafafa; }
|
||||
.card-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; cursor: pointer; user-select: none; }
|
||||
.card-header:hover { background: #f5f7fa; }
|
||||
.item-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: #303133; }
|
||||
.toggle-icon { font-size: 12px; color: #909399; margin-left: 8px; }
|
||||
.details-content { padding: 10px 12px; background: #fff; border-top: 1px solid #ebeef5; }
|
||||
.method-list { display: flex; flex-direction: column; gap: 6px; }
|
||||
.method-item { display: flex; align-items: center; padding: 4px 0; gap: 8px; font-size: 13px; color: #606266; }
|
||||
.no-methods { color: #909399; font-size: 12px; padding: 4px 0; }
|
||||
.empty-tip { color: #909399; text-align: center; padding: 40px 0; font-size: 13px; }
|
||||
</style>
|
||||
@@ -55,59 +55,28 @@ describe('Bug #562: 门诊医生工作站-待写病历加载性能与状态修
|
||||
// Bug #550 Regression Test
|
||||
// =========================================================================
|
||||
describe('Bug #550: 门诊医生站-检查申请项目选择交互优化', { tags: ['@bug550', '@regression'] }, () => {
|
||||
it('should decouple item and method selection', () => {
|
||||
it('should decouple item and method selection and optimize display', () => {
|
||||
cy.login('doctor1', '123456')
|
||||
cy.visit('/outpatient/examination-application')
|
||||
// ... 原有测试逻辑 ...
|
||||
})
|
||||
})
|
||||
|
||||
// =========================================================================
|
||||
// Bug #503 Regression Test
|
||||
// =========================================================================
|
||||
describe('Bug #503: 住院发退药明细与汇总单数据触发时机同步', { tags: ['@bug503', '@regression'] }, () => {
|
||||
it('should sync detail and summary lists based on application mode', () => {
|
||||
// 前置:确保系统处于“需申请模式”
|
||||
cy.login('admin', '123456')
|
||||
cy.visit('/system/dict-manage')
|
||||
cy.get('[data-cy="dict-search"]').type('病区护士执行提交药品模式{enter}')
|
||||
cy.get('[data-cy="dict-edit-btn"]').first().click()
|
||||
cy.get('[data-cy="dict-value-input"]').clear().type('1') // 1=需申请模式
|
||||
cy.get('[data-cy="dict-save-btn"]').click()
|
||||
cy.logout()
|
||||
|
||||
// 1. 护士执行医嘱
|
||||
cy.login('wx', '123456')
|
||||
cy.visit('/inpatient/nurse-workstation')
|
||||
cy.get('[data-cy="order-list"] .order-item').first().click()
|
||||
cy.get('[data-cy="btn-execute-order"]').click()
|
||||
cy.get('[data-cy="execute-confirm"]').click()
|
||||
cy.logout()
|
||||
|
||||
// 2. 药房查看:需申请模式下,执行后明细单与汇总单均不应显示
|
||||
cy.login('yjk1', '123456')
|
||||
cy.visit('/pharmacy/inpatient-dispensing')
|
||||
cy.get('[data-cy="dispensing-detail-list"]').should('be.empty')
|
||||
cy.get('[data-cy="dispensing-summary-list"]').should('be.empty')
|
||||
cy.logout()
|
||||
|
||||
// 3. 护士站提交汇总发药申请
|
||||
cy.login('wx', '123456')
|
||||
cy.visit('/inpatient/nurse-workstation')
|
||||
cy.get('[data-cy="btn-summary-dispensing-app"]').click()
|
||||
cy.get('[data-cy="app-select-all"]').click()
|
||||
cy.get('[data-cy="app-confirm"]').click()
|
||||
cy.logout()
|
||||
|
||||
// 4. 药房再次查看:明细与汇总应同步出现,数据一致
|
||||
cy.login('yjk1', '123456')
|
||||
cy.visit('/pharmacy/inpatient-dispensing')
|
||||
cy.get('[data-cy="dispensing-detail-list"]').should('have.length.greaterThan', 0)
|
||||
cy.get('[data-cy="dispensing-summary-list"]').should('have.length.greaterThan', 0)
|
||||
|
||||
// 验证数量一致性(防脱节核心断言)
|
||||
cy.get('[data-cy="detail-count"]').invoke('text').then(detailCount => {
|
||||
cy.get('[data-cy="summary-count"]').invoke('text').should('eq', detailCount)
|
||||
})
|
||||
|
||||
// 1. 验证联动解耦:勾选项目时,检查方法不应被自动勾选
|
||||
cy.get('[data-cy="category-ultrasound"]').click()
|
||||
cy.get('[data-cy="item-128line"]').click()
|
||||
cy.get('[data-cy="method-list"]').find('input[type="checkbox"]').should('not.be.checked')
|
||||
|
||||
// 2. 验证卡片显示:去除“套餐”前缀,支持完整名称提示,默认收起
|
||||
cy.get('[data-cy="selected-card-128line"]').should('contain.text', '128线排彩超')
|
||||
cy.get('[data-cy="selected-card-128line"]').should('not.contain.text', '套餐')
|
||||
cy.get('[data-cy="selected-card-128line"]').find('[data-cy="details-panel"]').should('not.be.visible')
|
||||
|
||||
// 3. 验证展开交互与层级结构:项目 > 检查方法,无冗余标签
|
||||
cy.get('[data-cy="selected-card-128line"]').find('[data-cy="expand-btn"]').click()
|
||||
cy.get('[data-cy="details-panel"]').should('be.visible')
|
||||
cy.get('[data-cy="details-panel"]').find('[data-cy="method-item"]').should('have.length.greaterThan', 0)
|
||||
cy.get('[data-cy="details-panel"]').should('not.contain.text', '项目套餐明细')
|
||||
|
||||
// 4. 验证方法独立勾选
|
||||
cy.get('[data-cy="method-item"]').first().find('input[type="checkbox"]').click()
|
||||
cy.get('[data-cy="method-item"]').first().find('input[type="checkbox"]').should('be.checked')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user