套餐设置页面完成

This commit is contained in:
2025-12-24 14:25:06 +08:00
parent 4c6886be6a
commit 6c20b15339
2 changed files with 93 additions and 56 deletions

View File

@@ -42,3 +42,46 @@ export function delInspectionType(inspectionTypeId) {
method: 'delete' method: 'delete'
}) })
} }
// 查询检验套餐列表
export function listInspectionPackage(query) {
return request({
url: '/system/inspection-package/list',
method: 'get',
params: query
})
}
// 查询检验套餐详细
export function getInspectionPackage(packageId) {
return request({
url: `/system/inspection-package/${packageId}`,
method: 'get'
})
}
// 新增检验套餐
export function addInspectionPackage(data) {
return request({
url: '/system/inspection-package',
method: 'post',
data: data
})
}
// 修改检验套餐
export function updateInspectionPackage(data) {
return request({
url: '/system/inspection-package',
method: 'put',
data: data
})
}
// 删除检验套餐
export function delInspectionPackage(packageId) {
return request({
url: `/system/inspection-package/${packageId}`,
method: 'delete'
})
}

View File

@@ -338,18 +338,11 @@
</td> </td>
<td class="action-cell"> <td class="action-cell">
<template v-if="editingRowId === item.id"> <template v-if="editingRowId === item.id">
<div class="action-btn save-btn" @click="saveItem(item)"> <div class="action-btn save-btn" @click="saveItem(item)" title="保存">
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <span style="font-size: 12px;"></span>
<polyline points="20 6 9 17 4 12"></polyline>
</svg>
保存
</div> </div>
<div class="action-btn cancel-btn" @click="cancelEdit(item)"> <div class="action-btn cancel-btn" @click="cancelEdit(item)" title="取消">
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <span style="font-size: 12px;"></span>
<line x1="18" y1="6" x2="6" y2="18"></line>
<line x1="6" y1="6" x2="18" y2="18"></line>
</svg>
取消
</div> </div>
</template> </template>
<template v-else-if="!editingRowId"> <template v-else-if="!editingRowId">
@@ -443,28 +436,11 @@
</div> </div>
<div class="form-item" id="userContainer" v-show="packageLevel === '个人套餐'"> <div class="form-item" id="userContainer" v-show="packageLevel === '个人套餐'">
<span class="form-label">用户</span> <span class="form-label">用户</span>
<select class="form-control form-select"> <input type="text" class="form-control" :value="userStore.nickName" readonly>
<option value="">请选择用户</option>
<option value="1">张三</option>
<option value="2">李四</option>
<option value="3">王五</option>
<option value="4">赵六</option>
</select>
</div> </div>
<div class="form-item"> <div class="form-item">
<span class="form-label"><span style="color:red"></span>套餐名称</span> <span class="form-label"><span style="color:red"></span>套餐名称</span>
<el-autocomplete <input type="text" class="form-control" v-model="packageName" placeholder="请输入套餐名称">
ref="autocompleteRef"
v-model="packageName"
:fetch-suggestions="queryDiagnosisItems"
placeholder="输入套餐名称或首字母搜索"
style="width: 100%;"
@select="handleSelectPackage"
@focus="handleFocus"
clearable
trigger-on-focus
:min-length="0"
></el-autocomplete>
<div class="error-message" id="packageNameError" style="color: #ff4d4f; font-size: 12px; margin-top: 4px; display: none;">套餐名称不能为空</div> <div class="error-message" id="packageNameError" style="color: #ff4d4f; font-size: 12px; margin-top: 4px; display: none;">套餐名称不能为空</div>
</div> </div>
<div class="form-item"> <div class="form-item">
@@ -976,16 +952,33 @@ const packageAmount = ref(0.00);
const serviceFee = ref(0.00); const serviceFee = ref(0.00);
const bloodVolume = ref(''); const bloodVolume = ref('');
const remarks = ref(''); const remarks = ref('');
const autocompleteRef = ref(); // 检验套餐明细项目 - 从后端API获取
const packageItems = ref([ const packageItems = ref([]);
{ name: '血常规五分类', dosage: '项/人', route: '项/人', frequency: '', days: '', quantity: 1, unit: '项', unitPrice: 25.00, amount: 25.00, serviceFee: 0.00, totalAmount: 25.00, origin: '' },
{ name: '总IgE测定', dosage: '项/人', route: '项/人', frequency: '', days: '', quantity: 1, unit: '项', unitPrice: 30.00, amount: 30.00, serviceFee: 0.00, totalAmount: 30.00, origin: '' }, // 从后端API获取检验项目数据并转换为套餐明细格式
{ name: '肝功能12项', dosage: '项/人', route: '项/人', frequency: '', days: '', quantity: 1, unit: '项', unitPrice: 120.00, amount: 120.00, serviceFee: 0.00, totalAmount: 120.00, origin: '' }, const loadPackageItemsFromAPI = () => {
{ name: '肾功能三项', dosage: '项/人', route: '项/人', frequency: '', days: '', quantity: 1, unit: '项', unitPrice: 50.00, amount: 50.00, serviceFee: 0.00, totalAmount: 50.00, origin: '' }, queryDiagnosisItems('', (results) => {
{ name: '血糖', dosage: '项/人', route: '项/人', frequency: '', days: '', quantity: 1, unit: '项', unitPrice: 15.00, amount: 15.00, serviceFee: 0.00, totalAmount: 15.00, origin: '' }, // 将API返回的检验项目转换为套餐明细格式
{ name: '糖化血红蛋白', dosage: '项/人', route: '项/人', frequency: '', days: '', quantity: 1, unit: '项', unitPrice: 50.00, amount: 50.00, serviceFee: 0.00, totalAmount: 50.00, origin: '' }, const formattedItems = results.map(item => ({
{ name: '血脂五项', dosage: '项/人', route: '项/人', frequency: '', days: '', quantity: 1, unit: '项', unitPrice: 80.00, amount: 80.00, serviceFee: 0.00, totalAmount: 80.00, origin: '' } name: item.name,
]); dosage: '项/人',
route: '项/人',
frequency: '',
days: '',
quantity: 1,
unit: item.unit || '项',
unitPrice: parseFloat(item.retailPrice || 0.00),
amount: parseFloat(item.retailPrice || 0.00),
serviceFee: 0.00,
totalAmount: parseFloat(item.retailPrice || 0.00),
origin: ''
}));
// 只保留前几个项目作为示例
packageItems.value = formattedItems.slice(0, 10);
console.log('加载的套餐项目:', packageItems.value);
});
};
// 查询诊疗目录中的检验项目 // 查询诊疗目录中的检验项目
const queryDiagnosisItems = (queryString, cb) => { const queryDiagnosisItems = (queryString, cb) => {
@@ -1050,22 +1043,6 @@ const handleItemFocus = (index) => {
// 可以在这里添加项目选择逻辑,或者留空让用户直接输入 // 可以在这里添加项目选择逻辑,或者留空让用户直接输入
}; };
// 处理输入框获得焦点事件,手动触发下拉框显示
const handleFocus = () => {
// 延迟执行,确保输入框已经获得焦点
setTimeout(() => {
// 手动触发查询,获取所有检验项目
if (autocompleteRef.value) {
// 模拟空输入查询
queryDiagnosisItems('', (results) => {
// 设置建议列表
autocompleteRef.value.suggestions = results;
// 显示下拉框
autocompleteRef.value.showPopper = true;
});
}
}, 100);
};
// 添加新的套餐项目 // 添加新的套餐项目
let addingItem = false; let addingItem = false;
@@ -1643,12 +1620,16 @@ const handlePackageManagement = () => {
const refreshPage = () => { const refreshPage = () => {
getInspectionTypeList(); getInspectionTypeList();
// 刷新时也重新加载套餐项目
loadPackageItemsFromAPI();
}; };
// 页面加载时获取数据 // 页面加载时获取数据
onMounted(() => { onMounted(() => {
getInspectionTypeList(); getInspectionTypeList();
getLisGroupList(); getLisGroupList();
// 加载检验套餐明细项目
loadPackageItemsFromAPI();
// 检查URL参数如果有tab参数则切换到对应导航项 // 检查URL参数如果有tab参数则切换到对应导航项
const query = router.currentRoute.value.query; const query = router.currentRoute.value.query;
if (query.tab === '0' || query.tab === '1' || query.tab === '2') { if (query.tab === '0' || query.tab === '1' || query.tab === '2') {
@@ -1899,9 +1880,11 @@ watch(packageItems, (newVal) => {
.action-cell { .action-cell {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center;
gap: 8px; gap: 8px;
position: relative; position: relative;
z-index: 10; z-index: 10;
height: 100%;
} }
.data-table-type .action-cell { .data-table-type .action-cell {
@@ -1909,6 +1892,11 @@ watch(packageItems, (newVal) => {
padding-left: 24px; padding-left: 24px;
} }
/* 套餐明细表格的操作列垂直居中 */
.data-table .action-cell {
vertical-align: middle;
}
.action-btn { .action-btn {
width: 28px; width: 28px;
height: 28px; height: 28px;
@@ -1925,6 +1913,7 @@ watch(packageItems, (newVal) => {
z-index: 10; z-index: 10;
background-color: #66b1ff; background-color: #66b1ff;
color: white; color: white;
flex-shrink: 0;
} }
.confirm-btn { .confirm-btn {
@@ -2211,6 +2200,11 @@ watch(packageItems, (newVal) => {
.table-actions { .table-actions {
display: flex; display: flex;
gap: 8px; gap: 8px;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
flex-wrap: nowrap;
} }
/* 表格内输入框和选择框样式 */ /* 表格内输入框和选择框样式 */