feat(checkType): 添加检查类型下拉选项功能

- 新增 getAllCheckTypes 接口用于获取所有检查类型列表
- 在前端组件中使用检查类型选项替换原有字典数据
- 实现套餐名称字段的下拉选择和模糊过滤功能
- 统一检查类型相关的标签显示逻辑
- 优化检查项目设置界面的表单交互体验
This commit is contained in:
2026-03-11 18:21:36 +08:00
parent 75737cf95c
commit cf3f971741
3 changed files with 158 additions and 57 deletions

View File

@@ -48,6 +48,16 @@ public class CheckTypeController extends BaseController {
private final ICheckPackageDetailService checkPackageDetailService; private final ICheckPackageDetailService checkPackageDetailService;
private final ICheckPackageAppService checkPackageAppService; private final ICheckPackageAppService checkPackageAppService;
/**
* 获取所有检查类型列表(不分页,用于下拉选项)
*/
@GetMapping("/all")
public AjaxResult getAllCheckTypes() {
List<CheckType> list = checkTypeService.list(
new QueryWrapper<CheckType>().orderByAsc("id"));
return AjaxResult.success(list);
}
/** /**
* 获取检查类型列表(支持分页) * 获取检查类型列表(支持分页)
*/ */

View File

@@ -1,5 +1,13 @@
import request from '@/utils/request' import request from '@/utils/request'
// 查询所有检查类型列表(不分页,用于下拉选项)
export function getAllCheckTypes() {
return request({
url: '/system/check-type/all',
method: 'get'
})
}
// 查询检查类型列表 // 查询检查类型列表
export function listCheckType(query) { export function listCheckType(query) {
return request({ return request({

View File

@@ -112,16 +112,16 @@
<select v-model="item.type" :class="{ 'placeholder-text': !item.type }"> <select v-model="item.type" :class="{ 'placeholder-text': !item.type }">
<option value="">选择检查类型</option> <option value="">选择检查类型</option>
<option <option
v-for="dict in inspectionTypeDicts" v-for="opt in checkTypeOptions"
:key="dict.dictValue" :key="opt.value"
:value="dict.dictValue" :value="opt.value"
> >
{{ dict.dictLabel }} {{ opt.label }}
</option> </option>
</select> </select>
</template> </template>
<template v-else> <template v-else>
<span v-if="item.type">{{ getInspectionTypeLabel(item.type) }}</span> <span v-if="item.type">{{ getCheckTypeLabel(item.type) }}</span>
<span v-else class="placeholder-text">选择检查类型</span> <span v-else class="placeholder-text">选择检查类型</span>
</template> </template>
</td> </td>
@@ -219,10 +219,10 @@
<label>检查类型</label> <label>检查类型</label>
<el-select v-model="searchParamsMethod.checkType" placeholder="选择检查类型" style="width: 150px"> <el-select v-model="searchParamsMethod.checkType" placeholder="选择检查类型" style="width: 150px">
<el-option <el-option
v-for="dict in inspectionTypeDicts" v-for="item in checkTypeOptions"
:key="dict.dictValue" :key="item.value"
:label="dict.dictLabel" :label="item.label"
:value="dict.dictValue" :value="item.value"
> >
</el-option> </el-option>
</el-select> </el-select>
@@ -237,8 +237,8 @@
<el-option <el-option
v-for="pkg in checkPackages" v-for="pkg in checkPackages"
:key="pkg.id" :key="pkg.id"
:label="pkg.name" :label="pkg.packageName"
:value="pkg.name" :value="pkg.packageName"
> >
</el-option> </el-option>
</el-select> </el-select>
@@ -293,25 +293,37 @@
</td> </td>
<td> <td>
<template v-if="item.editing"> <template v-if="item.editing">
<select v-model="item.checkType"> <el-select v-model="item.checkType" placeholder="选择检查类型" style="width: 100%">
<option value="">选择检查类型</option> <el-option
<option v-for="opt in checkTypeOptions"
v-for="dict in inspectionTypeDicts" :key="opt.value"
:key="dict.dictValue" :label="opt.label"
:value="dict.dictValue" :value="opt.value"
> />
{{ dict.dictLabel }} </el-select>
</option>
</select>
</template> </template>
<template v-else> <template v-else>
{{ getInspectionTypeLabel(item.checkType) || '' }} {{ getCheckTypeLabel(item.checkType) || '' }}
</template> </template>
</td> </td>
<td> <td>
<template v-if="item.editing"> <template v-if="item.editing">
<input type="text" placeholder="请输入套餐名称" v-model="item.packageName"> <el-select
v-model="item.packageName"
placeholder="请选择套餐"
style="width: 100%"
filterable
clearable
:filter-method="filterPackageOptions"
>
<el-option
v-for="pkg in filteredPackageOptions"
:key="pkg.id"
:label="pkg.packageName"
:value="pkg.packageName"
/>
</el-select>
</template> </template>
<template v-else> <template v-else>
{{ item.packageName || '' }} {{ item.packageName || '' }}
@@ -378,10 +390,10 @@
<label>检查类型</label> <label>检查类型</label>
<el-select v-model="searchParamsPart.checkType" placeholder="选择检查类型" style="width: 150px"> <el-select v-model="searchParamsPart.checkType" placeholder="选择检查类型" style="width: 150px">
<el-option <el-option
v-for="dict in inspectionTypeDicts" v-for="item in checkTypeOptions"
:key="dict.dictValue" :key="item.value"
:label="dict.dictLabel" :label="item.label"
:value="dict.dictValue" :value="item.value"
> >
</el-option> </el-option>
</el-select> </el-select>
@@ -392,7 +404,21 @@
</div> </div>
<div class="search-item"> <div class="search-item">
<label>费用套餐</label> <label>费用套餐</label>
<el-input placeholder="费用套餐" v-model="searchParamsPart.packageName" /> <el-select
v-model="searchParamsPart.packageName"
placeholder="选择套餐"
style="width: 150px"
filterable
clearable
:filter-method="filterPackageOptions"
>
<el-option
v-for="pkg in filteredPackageOptions"
:key="pkg.id"
:label="pkg.packageName"
:value="pkg.packageName"
/>
</el-select>
</div> </div>
<div class="search-actions"> <div class="search-actions">
@@ -447,19 +473,39 @@
</td> </td>
<td> <td>
<template v-if="item.editing"> <template v-if="item.editing">
<select v-model="item.checkType"> <el-select v-model="item.checkType" placeholder="选择检查类型" style="width: 100%">
<option value="">选择检查类型</option> <el-option
<option v-for="opt in checkTypeOptions"
v-for="dict in inspectionTypeDicts" :key="opt.value"
:key="dict.dictValue" :label="opt.label"
:value="dict.dictValue" :value="opt.value"
> />
{{ dict.dictLabel }} </el-select>
</option>
</select>
</template> </template>
<template v-else> <template v-else>
{{ getInspectionTypeLabel(item.checkType) || '' }} {{ getCheckTypeLabel(item.checkType) || '' }}
</template>
</td>
<td>
<template v-if="item.editing">
<el-select
v-model="item.packageName"
placeholder="请选择套餐"
style="width: 100%"
filterable
clearable
:filter-method="filterPackageOptions"
>
<el-option
v-for="pkg in filteredPackageOptions"
:key="pkg.id"
:label="pkg.packageName"
:value="pkg.packageName"
/>
</el-select>
</template>
<template v-else>
{{ item.packageName || '' }}
</template> </template>
</td> </td>
<td> <td>
@@ -470,14 +516,6 @@
{{ item.exposureNum || '0' }} {{ item.exposureNum || '0' }}
</template> </template>
</td> </td>
<td>
<template v-if="item.editing">
<input type="text" placeholder="请输入费用套餐" v-model="item.packageName">
</template>
<template v-else>
{{ item.packageName || '' }}
</template>
</td>
<td> <td>
<template v-if="item.editing"> <template v-if="item.editing">
<input type="number" step="0.01" min="0" placeholder="请输入金额" v-model="item.price"> <input type="number" step="0.01" min="0" placeholder="请输入金额" v-model="item.price">
@@ -496,19 +534,17 @@
</td> </td>
<td> <td>
<template v-if="item.editing"> <template v-if="item.editing">
<select v-model="item.serviceScope"> <el-select v-model="item.serviceScope" placeholder="选择服务范围" style="width: 100%">
<option value="">选择服务范围</option> <el-option
<option
v-for="dict in serviceScopeDicts" v-for="dict in serviceScopeDicts"
:key="dict.dictValue" :key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue" :value="dict.dictValue"
> />
{{ dict.dictLabel }} </el-select>
</option>
</select>
</template> </template>
<template v-else> <template v-else>
{{ getServiceScopeLabel(item.serviceScope) || '' }} {{ getServiceScopeLabel(item.serviceScope) || '' }}
</template> </template>
</td> </td>
<td> <td>
@@ -596,6 +632,7 @@ import {
delCheckType, delCheckType,
exportCheckMethod, exportCheckMethod,
exportCheckPart, exportCheckPart,
getAllCheckTypes,
listCheckMethod, listCheckMethod,
listCheckPackage, listCheckPackage,
listCheckPart, listCheckPart,
@@ -622,6 +659,8 @@ const currentPackageData = ref(null)
// 检查类型和科室选项 // 检查类型和科室选项
const checkTypes = ref([]); const checkTypes = ref([]);
// 从检查类型维护界面获取的检查类型列表(用于下拉选项)
const checkTypeOptions = ref([]);
// 完整的检查类型字典数据 // 完整的检查类型字典数据
const inspectionTypeDicts = ref([]); const inspectionTypeDicts = ref([]);
// 完整的服务范围字典数据 // 完整的服务范围字典数据
@@ -634,6 +673,13 @@ const checkTypes = ref([]);
return dictItem ? dictItem.dictLabel : value; return dictItem ? dictItem.dictLabel : value;
}; };
// 根据值从检查类型选项中获取标签
const getCheckTypeLabel = (value) => {
if (!value) return '';
const option = checkTypeOptions.value.find(item => item.value === value);
return option ? option.label : value;
};
// 根据字典值获取服务范围标签 // 根据字典值获取服务范围标签
const getServiceScopeLabel = (value) => { const getServiceScopeLabel = (value) => {
const dictItem = serviceScopeDicts.value.find(item => item.dictValue === value); const dictItem = serviceScopeDicts.value.find(item => item.dictValue === value);
@@ -641,8 +687,21 @@ const checkTypes = ref([]);
}; };
const checkParts = ref([]); const checkParts = ref([]);
const checkPackages = ref([]); const checkPackages = ref([]);
// 套餐下拉选项的过滤结果
const filteredPackageOptions = ref([]);
const departments = ref([]); const departments = ref([]);
// 套餐模糊查询过滤方法
const filterPackageOptions = (query) => {
if (query) {
filteredPackageOptions.value = checkPackages.value.filter(pkg =>
pkg.packageName && pkg.packageName.toLowerCase().includes(query.toLowerCase())
);
} else {
filteredPackageOptions.value = checkPackages.value;
}
};
// 表格数据 - 为每个菜单创建独立的数据存储 // 表格数据 - 为每个菜单创建独立的数据存储
const checkTypeData = reactive([]); const checkTypeData = reactive([]);
const checkMethodData = reactive([]); const checkMethodData = reactive([]);
@@ -818,6 +877,27 @@ onMounted(async () => {
inspectionTypeDicts.value = []; inspectionTypeDicts.value = [];
} }
// 从检查类型维护界面获取所有检查类型(用于下拉选项)
try {
const checkTypeListResponse = await getAllCheckTypes();
if (checkTypeListResponse && checkTypeListResponse.data) {
// 处理返回的数据,提取 name 和 code/type 用于下拉选项
const typeList = Array.isArray(checkTypeListResponse.data)
? checkTypeListResponse.data
: (checkTypeListResponse.data.records || []);
checkTypeOptions.value = typeList.map(item => ({
value: item.code || item.type || item.id,
label: item.name,
id: item.id,
code: item.code,
type: item.type
}));
}
} catch (e) {
console.error('获取检查类型列表失败', e);
checkTypeOptions.value = [];
}
// 获取服务范围数据(从数据字典获取) // 获取服务范围数据(从数据字典获取)
const scopeResponse = await getDicts('scope_of_services'); const scopeResponse = await getDicts('scope_of_services');
if (scopeResponse && scopeResponse.data) { if (scopeResponse && scopeResponse.data) {
@@ -853,8 +933,11 @@ onMounted(async () => {
if (packageResponse && packageResponse.data) { if (packageResponse && packageResponse.data) {
// 确保data是数组类型 // 确保data是数组类型
checkPackages.value = Array.isArray(packageResponse.data) ? packageResponse.data : []; checkPackages.value = Array.isArray(packageResponse.data) ? packageResponse.data : [];
// 初始化过滤后的套餐选项
filteredPackageOptions.value = checkPackages.value;
} else { } else {
checkPackages.value = []; checkPackages.value = [];
filteredPackageOptions.value = [];
} }
} catch (error) { } catch (error) {