耗材目录包装单位的拼音搜索

This commit is contained in:
2025-12-23 15:03:37 +08:00
parent cce71f324b
commit 0833f82fb4
9 changed files with 134 additions and 8 deletions

View File

@@ -18,10 +18,11 @@ export function getData(dictCode) {
}
// 根据字典类型查询字典数据信息
export function getDicts(dictType) {
export function getDicts(dictType, searchKey) {
return request({
url: '/system/dict/data/type/' + dictType,
method: 'get'
method: 'get',
params: searchKey ? { searchKey } : {}
})
}

View File

@@ -94,11 +94,16 @@
v-model="form.unitCode"
clearable
filterable
remote
reserve-keyword
:remote-method="handleUnitCodeSearch"
:loading="unitCodeLoading"
@focus="handleUnitCodeFocus"
@change="handleUnitCodeChange"
:disabled="form.isEditInfoDisable === 1 || form.isEditInfoDisable === 2"
>
<el-option
v-for="dict in unit_code"
v-for="dict in unitCodeOptions"
:key="dict.value"
:label="dict.label"
:value="dict.value"
@@ -349,6 +354,7 @@
<script setup name="MedicineDialog">
import { editDevice, addDevice, deptTreeSelect, locationTreeSelect } from './device';
import { getDicts } from '@/api/system/dict/data';
const { proxy } = getCurrentInstance();
const { device_type_code, unit_code, fin_type_code, chrgitm_lv, med_chrgitm_type } = proxy.useDict(
@@ -367,6 +373,8 @@ const locationOptions = ref(undefined); // 地点树选项
const deviceCategories = ref([]); // 器材分类
const statusFlagOptions = ref([]); // 状态标记
const supplierListOptions = ref([]); // 供应商列表
const unitCodeOptions = ref([]); // 包装单位选项列表(用于搜索)
const unitCodeLoading = ref(false); // 包装单位搜索加载状态
const data = reactive({
form: {},
@@ -439,6 +447,8 @@ function show() {
form.value.size = '-';
getDeptTree();
getLocationTree();
// 初始化包装单位列表
handleUnitCodeFocus();
visible.value = true;
}
//医保目录对照后,赋值
@@ -479,6 +489,8 @@ function edit() {
supplierListOptions.value = props.supplierListOptions;
getDeptTree();
getLocationTree();
// 初始化包装单位列表
handleUnitCodeFocus();
visible.value = true;
}
/** 重置操作表单 */
@@ -551,6 +563,41 @@ function submitForm() {
});
}
/** 包装单位搜索方法(支持拼音搜索) */
function handleUnitCodeSearch(query) {
if (query !== '') {
unitCodeLoading.value = true;
getDicts('unit_code', query).then(response => {
unitCodeOptions.value = response.data ? response.data.map(p => ({
label: p.dictLabel,
value: p.dictValue
})) : [];
unitCodeLoading.value = false;
}).catch(() => {
unitCodeOptions.value = [];
unitCodeLoading.value = false;
});
} else {
// 如果搜索关键词为空,加载全部数据
handleUnitCodeFocus();
}
}
/** 包装单位下拉框获得焦点时,加载全部数据 */
function handleUnitCodeFocus() {
unitCodeLoading.value = true;
getDicts('unit_code').then(response => {
unitCodeOptions.value = response.data ? response.data.map(p => ({
label: p.dictLabel,
value: p.dictValue
})) : [];
unitCodeLoading.value = false;
}).catch(() => {
unitCodeOptions.value = [];
unitCodeLoading.value = false;
});
}
/** 当用户选择包装单位时,销售单位和最小单位的值设置为与包装单位相同的值 */
function handleUnitCodeChange(value) {
form.value.salesUnitCode = value;