feat(checkType): 添加检查类型下拉选项功能
- 新增 getAllCheckTypes 接口用于获取所有检查类型列表 - 在前端组件中使用检查类型选项替换原有字典数据 - 实现套餐名称字段的下拉选择和模糊过滤功能 - 统一检查类型相关的标签显示逻辑 - 优化检查项目设置界面的表单交互体验
This commit is contained in:
@@ -1,5 +1,13 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询所有检查类型列表(不分页,用于下拉选项)
|
||||
export function getAllCheckTypes() {
|
||||
return request({
|
||||
url: '/system/check-type/all',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 查询检查类型列表
|
||||
export function listCheckType(query) {
|
||||
return request({
|
||||
|
||||
@@ -112,16 +112,16 @@
|
||||
<select v-model="item.type" :class="{ 'placeholder-text': !item.type }">
|
||||
<option value="">选择检查类型</option>
|
||||
<option
|
||||
v-for="dict in inspectionTypeDicts"
|
||||
:key="dict.dictValue"
|
||||
:value="dict.dictValue"
|
||||
v-for="opt in checkTypeOptions"
|
||||
:key="opt.value"
|
||||
:value="opt.value"
|
||||
>
|
||||
{{ dict.dictLabel }}
|
||||
{{ opt.label }}
|
||||
</option>
|
||||
</select>
|
||||
</template>
|
||||
<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>
|
||||
</template>
|
||||
</td>
|
||||
@@ -219,10 +219,10 @@
|
||||
<label>检查类型</label>
|
||||
<el-select v-model="searchParamsMethod.checkType" placeholder="选择检查类型" style="width: 150px">
|
||||
<el-option
|
||||
v-for="dict in inspectionTypeDicts"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
v-for="item in checkTypeOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
@@ -237,8 +237,8 @@
|
||||
<el-option
|
||||
v-for="pkg in checkPackages"
|
||||
:key="pkg.id"
|
||||
:label="pkg.name"
|
||||
:value="pkg.name"
|
||||
:label="pkg.packageName"
|
||||
:value="pkg.packageName"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
@@ -293,25 +293,37 @@
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<select v-model="item.checkType">
|
||||
<option value="">选择检查类型</option>
|
||||
<option
|
||||
v-for="dict in inspectionTypeDicts"
|
||||
:key="dict.dictValue"
|
||||
:value="dict.dictValue"
|
||||
>
|
||||
{{ dict.dictLabel }}
|
||||
</option>
|
||||
</select>
|
||||
<el-select v-model="item.checkType" placeholder="选择检查类型" style="width: 100%">
|
||||
<el-option
|
||||
v-for="opt in checkTypeOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ getInspectionTypeLabel(item.checkType) || '无' }}
|
||||
{{ getCheckTypeLabel(item.checkType) || '无' }}
|
||||
</template>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<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 v-else>
|
||||
{{ item.packageName || '' }}
|
||||
@@ -378,10 +390,10 @@
|
||||
<label>检查类型</label>
|
||||
<el-select v-model="searchParamsPart.checkType" placeholder="选择检查类型" style="width: 150px">
|
||||
<el-option
|
||||
v-for="dict in inspectionTypeDicts"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
v-for="item in checkTypeOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
@@ -392,7 +404,21 @@
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<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 class="search-actions">
|
||||
@@ -447,19 +473,39 @@
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<select v-model="item.checkType">
|
||||
<option value="">选择检查类型</option>
|
||||
<option
|
||||
v-for="dict in inspectionTypeDicts"
|
||||
:key="dict.dictValue"
|
||||
:value="dict.dictValue"
|
||||
>
|
||||
{{ dict.dictLabel }}
|
||||
</option>
|
||||
</select>
|
||||
<el-select v-model="item.checkType" placeholder="选择检查类型" style="width: 100%">
|
||||
<el-option
|
||||
v-for="opt in checkTypeOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
<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>
|
||||
</td>
|
||||
<td>
|
||||
@@ -470,14 +516,6 @@
|
||||
{{ item.exposureNum || '0' }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<input type="text" placeholder="请输入费用套餐" v-model="item.packageName">
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.packageName || '' }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<input type="number" step="0.01" min="0" placeholder="请输入金额" v-model="item.price">
|
||||
@@ -496,19 +534,17 @@
|
||||
</td>
|
||||
<td>
|
||||
<template v-if="item.editing">
|
||||
<select v-model="item.serviceScope">
|
||||
<option value="">选择服务范围</option>
|
||||
<option
|
||||
v-for="dict in serviceScopeDicts"
|
||||
:key="dict.dictValue"
|
||||
<el-select v-model="item.serviceScope" placeholder="选择服务范围" style="width: 100%">
|
||||
<el-option
|
||||
v-for="dict in serviceScopeDicts"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
>
|
||||
{{ dict.dictLabel }}
|
||||
</option>
|
||||
</select>
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ getServiceScopeLabel(item.serviceScope) || '' }}
|
||||
{{ getServiceScopeLabel(item.serviceScope) || '无' }}
|
||||
</template>
|
||||
</td>
|
||||
<td>
|
||||
@@ -596,6 +632,7 @@ import {
|
||||
delCheckType,
|
||||
exportCheckMethod,
|
||||
exportCheckPart,
|
||||
getAllCheckTypes,
|
||||
listCheckMethod,
|
||||
listCheckPackage,
|
||||
listCheckPart,
|
||||
@@ -622,6 +659,8 @@ const currentPackageData = ref(null)
|
||||
|
||||
// 检查类型和科室选项
|
||||
const checkTypes = ref([]);
|
||||
// 从检查类型维护界面获取的检查类型列表(用于下拉选项)
|
||||
const checkTypeOptions = ref([]);
|
||||
// 完整的检查类型字典数据
|
||||
const inspectionTypeDicts = ref([]);
|
||||
// 完整的服务范围字典数据
|
||||
@@ -634,6 +673,13 @@ const checkTypes = ref([]);
|
||||
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 dictItem = serviceScopeDicts.value.find(item => item.dictValue === value);
|
||||
@@ -641,8 +687,21 @@ const checkTypes = ref([]);
|
||||
};
|
||||
const checkParts = ref([]);
|
||||
const checkPackages = ref([]);
|
||||
// 套餐下拉选项的过滤结果
|
||||
const filteredPackageOptions = 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 checkMethodData = reactive([]);
|
||||
@@ -818,6 +877,27 @@ onMounted(async () => {
|
||||
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');
|
||||
if (scopeResponse && scopeResponse.data) {
|
||||
@@ -853,8 +933,11 @@ onMounted(async () => {
|
||||
if (packageResponse && packageResponse.data) {
|
||||
// 确保data是数组类型
|
||||
checkPackages.value = Array.isArray(packageResponse.data) ? packageResponse.data : [];
|
||||
// 初始化过滤后的套餐选项
|
||||
filteredPackageOptions.value = checkPackages.value;
|
||||
} else {
|
||||
checkPackages.value = [];
|
||||
filteredPackageOptions.value = [];
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user