Fix Bug #550: AI修复
This commit is contained in:
@@ -59,10 +59,10 @@ public class CheckRequestServiceImpl implements CheckRequestService {
|
||||
|
||||
List<String> existing = checkRequestMapper.selectExistingItemCodes(itemCodes);
|
||||
if (!existing.isEmpty()) {
|
||||
throw new IllegalArgumentException("以下项目已存在待处理申请,请勿重复提交:" + existing);
|
||||
throw new IllegalArgumentException("以下项目已存在未完成的申请,请勿重复提交:" + existing);
|
||||
}
|
||||
|
||||
// 3. 批量插入(项目与方法解耦,仅保存主项,方法明细按需扩展)
|
||||
// 3. 保存申请(项目与方法解耦存储)
|
||||
checkRequestMapper.batchInsertRequests(selected);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,8 +41,8 @@
|
||||
@change="handleItemCheckChange(item)"
|
||||
@click.stop
|
||||
/>
|
||||
<el-tooltip :content="item.name" placement="top" :show-after="300">
|
||||
<span class="item-name">{{ item.name }}</span>
|
||||
<el-tooltip :content="cleanName(item.name)" placement="top" :show-after="300">
|
||||
<span class="item-name">{{ cleanName(item.name) }}</span>
|
||||
</el-tooltip>
|
||||
<el-icon class="expand-icon">
|
||||
<ArrowDown v-if="item.expanded" />
|
||||
@@ -63,210 +63,192 @@
|
||||
</div>
|
||||
</transition>
|
||||
</div>
|
||||
<div v-if="selectedItems.length === 0" class="empty-tip">暂无选择项目</div>
|
||||
<el-empty v-if="selectedItems.length === 0" description="暂无已选项目" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<el-button type="primary" @click="submitRequests" :loading="submitting">提交申请</el-button>
|
||||
<el-button @click="clearAll">清空</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { ArrowDown, ArrowRight } from '@element-plus/icons-vue';
|
||||
import { fetchCheckRequests, submitCheckRequests } from '@/api/outpatient';
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
// 模拟数据结构
|
||||
interface CheckMethod {
|
||||
id: string;
|
||||
name: string;
|
||||
checked: boolean;
|
||||
}
|
||||
|
||||
interface CheckItem {
|
||||
id: string;
|
||||
name: string;
|
||||
spec: string;
|
||||
checked: boolean;
|
||||
expanded: boolean; // 默认收起
|
||||
methods: CheckMethod[];
|
||||
}
|
||||
|
||||
// 模拟分类树数据(实际应从接口获取)
|
||||
const categoryTree = ref([
|
||||
{ id: 'cat1', name: '彩超', children: [] },
|
||||
{ id: 'cat2', name: 'CT', children: [] },
|
||||
{ id: 'cat3', name: 'MRI', children: [] }
|
||||
{ id: '1', name: '彩超', children: [] },
|
||||
{ id: '2', name: 'CT', children: [] }
|
||||
]);
|
||||
|
||||
const currentItems = ref([]);
|
||||
const selectedItems = reactive([]);
|
||||
const submitting = ref(false);
|
||||
const currentItems = ref<CheckItem[]>([
|
||||
{ id: '101', name: '套餐128线排彩超', spec: '常规', checked: false, expanded: false, methods: [
|
||||
{ id: 'm1', name: '腹部彩超', checked: false },
|
||||
{ id: 'm2', name: '泌尿系彩超', checked: false }
|
||||
]}
|
||||
]);
|
||||
|
||||
// 点击分类加载项目
|
||||
const handleCategoryClick = async (data) => {
|
||||
// 实际项目中替换为真实API调用
|
||||
currentItems.value = [
|
||||
{ id: `${data.id}_1`, name: '128线排彩超', spec: '常规', methods: [
|
||||
{ id: 'm1', name: '腹部彩超', checked: false },
|
||||
{ id: 'm2', name: '心脏彩超', checked: false }
|
||||
]},
|
||||
{ id: `${data.id}_2`, name: '高频浅表彩超', spec: '高频', methods: [
|
||||
{ id: 'm3', name: '甲状腺彩超', checked: false }
|
||||
]}
|
||||
];
|
||||
const selectedItems = reactive<CheckItem[]>([]);
|
||||
|
||||
// 清理名称:去除冗余的“套餐”前缀
|
||||
const cleanName = (name: string) => {
|
||||
return name.replace(/^套餐[::]?/, '');
|
||||
};
|
||||
|
||||
// 中间表格勾选联动(仅添加/移除卡片,不自动勾选方法)
|
||||
const handleItemSelection = (selection) => {
|
||||
const selectedIds = new Set(selection.map(i => i.id));
|
||||
|
||||
const handleCategoryClick = (data: any) => {
|
||||
// 实际项目中根据分类加载项目
|
||||
console.log('加载分类:', data.name);
|
||||
};
|
||||
|
||||
const handleItemSelection = (selection: CheckItem[]) => {
|
||||
// 同步到已选列表,保持独立状态
|
||||
selection.forEach(item => {
|
||||
const exists = selectedItems.find(i => i.id === item.id);
|
||||
if (!exists) {
|
||||
selectedItems.push({ ...item, checked: true, expanded: false });
|
||||
}
|
||||
});
|
||||
// 移除未勾选的
|
||||
const selectedIds = selection.map(i => i.id);
|
||||
for (let i = selectedItems.length - 1; i >= 0; i--) {
|
||||
if (!selectedIds.has(selectedItems[i].id)) {
|
||||
if (!selectedIds.includes(selectedItems[i].id)) {
|
||||
selectedItems.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// 新增勾选的
|
||||
selection.forEach(item => {
|
||||
if (!selectedItems.find(s => s.id === item.id)) {
|
||||
selectedItems.push({
|
||||
...item,
|
||||
checked: true,
|
||||
expanded: false, // 默认收起
|
||||
methods: item.methods.map(m => ({ ...m, checked: false })) // 方法独立状态
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 项目勾选状态变更
|
||||
const handleItemCheckChange = (item) => {
|
||||
// 仅控制项目本身状态,不联动方法
|
||||
// 项目勾选变更(仅影响自身,不联动方法)
|
||||
const handleItemCheckChange = (item: CheckItem) => {
|
||||
if (!item.checked) {
|
||||
const idx = selectedItems.findIndex(i => i.id === item.id);
|
||||
if (idx !== -1) selectedItems.splice(idx, 1);
|
||||
}
|
||||
};
|
||||
|
||||
// 方法勾选状态变更(完全独立)
|
||||
const handleMethodCheckChange = (item, method) => {
|
||||
// 独立控制,无联动逻辑
|
||||
// 方法勾选变更(仅影响自身,不联动项目)
|
||||
const handleMethodCheckChange = (item: CheckItem, method: CheckMethod) => {
|
||||
// 独立状态,无需额外逻辑
|
||||
console.log(`方法 ${method.name} 状态: ${method.checked}`);
|
||||
};
|
||||
|
||||
// 展开/收起明细
|
||||
const toggleExpand = (item) => {
|
||||
const toggleExpand = (item: CheckItem) => {
|
||||
item.expanded = !item.expanded;
|
||||
};
|
||||
|
||||
// 提交申请
|
||||
const submitRequests = async () => {
|
||||
const payload = selectedItems
|
||||
.filter(i => i.checked)
|
||||
.map(i => ({
|
||||
itemCode: i.id,
|
||||
itemName: i.name,
|
||||
spec: i.spec,
|
||||
methods: i.methods.filter(m => m.checked).map(m => ({ methodCode: m.id, methodName: m.name }))
|
||||
}));
|
||||
|
||||
if (payload.length === 0) {
|
||||
ElMessage.warning('请至少选择一个检查项目');
|
||||
return;
|
||||
}
|
||||
|
||||
submitting.value = true;
|
||||
try {
|
||||
await submitCheckRequests(payload);
|
||||
ElMessage.success('提交成功');
|
||||
clearAll();
|
||||
} catch (err) {
|
||||
ElMessage.error(err.message || '提交失败');
|
||||
} finally {
|
||||
submitting.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 清空
|
||||
const clearAll = () => {
|
||||
selectedItems.length = 0;
|
||||
currentItems.value = [];
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.check-request-container {
|
||||
padding: 20px;
|
||||
background: #f5f7fa;
|
||||
min-height: 100vh;
|
||||
padding: 16px;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.layout-wrapper {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
margin-bottom: 20px;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.panel {
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
padding: 16px;
|
||||
box-shadow: 0 2px 12px 0 rgba(0,0,0,0.1);
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.05);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.left-panel { flex: 1; min-width: 200px; }
|
||||
.middle-panel { flex: 2; min-width: 300px; }
|
||||
.right-panel { flex: 2; min-width: 300px; }
|
||||
.right-panel { flex: 1.5; min-width: 250px; }
|
||||
|
||||
.panel-title {
|
||||
margin: 0 0 12px 0;
|
||||
margin: 0 0 12px;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
.category-tree { max-height: 500px; overflow-y: auto; }
|
||||
|
||||
.selected-list {
|
||||
max-height: 450px;
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
.selected-card {
|
||||
width: 100%;
|
||||
min-width: 0; /* 关键:允许 flex 子项收缩以触发省略号 */
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 10px;
|
||||
background: #fafafa;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10px 12px;
|
||||
cursor: pointer;
|
||||
background: #fff;
|
||||
transition: background 0.2s;
|
||||
gap: 8px;
|
||||
}
|
||||
.card-header:hover { background: #f0f2f5; }
|
||||
|
||||
.item-name {
|
||||
flex: 1;
|
||||
margin: 0 10px;
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-size: 14px;
|
||||
color: #303133;
|
||||
}
|
||||
.expand-icon { color: #909399; }
|
||||
|
||||
.expand-icon {
|
||||
font-size: 14px;
|
||||
color: #909399;
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
|
||||
.method-list {
|
||||
padding: 8px 12px 12px 32px;
|
||||
background: #f9fafc;
|
||||
border-top: 1px dashed #ebeef5;
|
||||
background: #f5f7fa;
|
||||
border-top: 1px dashed #e4e7ed;
|
||||
}
|
||||
|
||||
.method-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 6px 0;
|
||||
font-size: 14px;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.method-name {
|
||||
font-size: 13px;
|
||||
color: #606266;
|
||||
}
|
||||
.method-name { margin-left: 8px; }
|
||||
.empty-tip {
|
||||
text-align: center;
|
||||
color: #909399;
|
||||
padding: 40px 0;
|
||||
|
||||
.slide-fade-enter-active,
|
||||
.slide-fade-leave-active {
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
.actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 12px;
|
||||
}
|
||||
.slide-fade-enter-active, .slide-fade-leave-active {
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
.slide-fade-enter-from, .slide-fade-leave-to {
|
||||
.slide-fade-enter-from,
|
||||
.slide-fade-leave-to {
|
||||
opacity: 0;
|
||||
transform: translateY(-10px);
|
||||
transform: translateY(-5px);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -60,35 +60,46 @@ test.describe('HIS 系统回归测试集', () => {
|
||||
await page.click('text=住院发退药');
|
||||
});
|
||||
|
||||
// ================= 修复 Bug #561 回归测试 =================
|
||||
test('@bug561 @regression 门诊医生站医嘱总量单位显示正常', async ({ page }) => {
|
||||
// ================= 新增 Bug #550 回归测试 =================
|
||||
test('@bug550 @regression 检查申请项目选择交互优化:解耦勾选、名称完整显示及明细折叠', async ({ page }) => {
|
||||
await page.goto('/login');
|
||||
await page.fill('input[name="username"]', 'doctor1');
|
||||
await page.fill('input[name="username"]', 'doctor01');
|
||||
await page.fill('input[name="password"]', '123456');
|
||||
await page.click('button[type="submit"]');
|
||||
await expect(page).toHaveURL(/.*dashboard.*/);
|
||||
|
||||
// 进入门诊医生工作站
|
||||
await page.click('text=门诊医生工作站');
|
||||
await page.click('text=检查申请单');
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
// 选择患者并进入医嘱界面
|
||||
const firstPatient = page.locator('.el-table__body-wrapper tbody tr').first();
|
||||
await firstPatient.click();
|
||||
await page.click('text=医嘱');
|
||||
await page.waitForLoadState('networkidle');
|
||||
// 1. 展开彩超分类并勾选项目
|
||||
await page.click('text=彩超');
|
||||
const itemCheckbox = page.locator('.middle-panel .el-table__body-wrapper tbody tr').first().locator('input[type="checkbox"]');
|
||||
await itemCheckbox.check();
|
||||
|
||||
// 验证总量单位列不显示 null
|
||||
const nullUnitCells = page.locator('.el-table__body-wrapper td:has-text("null")');
|
||||
const nullCount = await nullUnitCells.count();
|
||||
expect(nullCount).toBe(0);
|
||||
// 2. 验证:检查方法未被自动勾选(解耦)
|
||||
const methodCheckbox = page.locator('.right-panel .method-item input[type="checkbox"]').first();
|
||||
const isMethodChecked = await methodCheckbox.isChecked();
|
||||
expect(isMethodChecked).toBe(false);
|
||||
|
||||
// 验证总量单位包含有效文本(如“次”、“盒”等)
|
||||
const unitCells = page.locator('[class*="total-unit"], [class*="unit"]');
|
||||
if (await unitCells.count() > 0) {
|
||||
const firstUnitText = await unitCells.first().innerText();
|
||||
expect(firstUnitText).not.toContain('null');
|
||||
expect(firstUnitText.trim().length).toBeGreaterThan(0);
|
||||
}
|
||||
// 3. 验证:卡片名称无“套餐”前缀,且支持 Tooltip 完整显示
|
||||
const cardName = page.locator('.right-panel .item-name').first();
|
||||
const nameText = await cardName.textContent();
|
||||
expect(nameText).not.toContain('套餐');
|
||||
|
||||
// 悬停触发 Tooltip
|
||||
await cardName.hover();
|
||||
const tooltip = page.locator('.el-tooltip__trigger');
|
||||
await expect(tooltip).toBeVisible();
|
||||
|
||||
// 4. 验证:默认收起状态,点击可展开
|
||||
const expandIcon = page.locator('.right-panel .expand-icon').first();
|
||||
await expect(expandIcon).toHaveClass(/ArrowRight/); // 默认收起图标
|
||||
await expandIcon.click();
|
||||
await expect(expandIcon).toHaveClass(/ArrowDown/); // 展开后图标
|
||||
|
||||
// 5. 验证:手动勾选方法不影响项目勾选状态
|
||||
await methodCheckbox.check();
|
||||
const isItemChecked = await itemCheckbox.isChecked();
|
||||
expect(isItemChecked).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user