耗材目录包装单位的拼音搜索
This commit is contained in:
@@ -62,11 +62,12 @@ public class SysDictDataController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据字典类型查询字典数据信息
|
* 根据字典类型查询字典数据信息(支持拼音搜索)
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/type/{dictType}")
|
@GetMapping(value = "/type/{dictType}")
|
||||||
public AjaxResult dictType(@PathVariable String dictType) {
|
public AjaxResult dictType(@PathVariable String dictType,
|
||||||
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
|
@RequestParam(value = "searchKey", required = false) String searchKey) {
|
||||||
|
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType, searchKey);
|
||||||
if (StringUtils.isNull(data)) {
|
if (StringUtils.isNull(data)) {
|
||||||
data = new ArrayList<SysDictData>();
|
data = new ArrayList<SysDictData>();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,6 +53,9 @@ public class SysDictData extends BaseEntity {
|
|||||||
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
|
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
/** 拼音首字母 */
|
||||||
|
private String pyStr;
|
||||||
|
|
||||||
public Long getDictCode() {
|
public Long getDictCode() {
|
||||||
return dictCode;
|
return dictCode;
|
||||||
}
|
}
|
||||||
@@ -136,13 +139,21 @@ public class SysDictData extends BaseEntity {
|
|||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPyStr() {
|
||||||
|
return pyStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPyStr(String pyStr) {
|
||||||
|
this.pyStr = pyStr;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("dictCode", getDictCode())
|
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("dictCode", getDictCode())
|
||||||
.append("dictSort", getDictSort()).append("dictLabel", getDictLabel()).append("dictValue", getDictValue())
|
.append("dictSort", getDictSort()).append("dictLabel", getDictLabel()).append("dictValue", getDictValue())
|
||||||
.append("dictType", getDictType()).append("cssClass", getCssClass()).append("listClass", getListClass())
|
.append("dictType", getDictType()).append("cssClass", getCssClass()).append("listClass", getListClass())
|
||||||
.append("isDefault", getIsDefault()).append("status", getStatus()).append("createBy", getCreateBy())
|
.append("isDefault", getIsDefault()).append("status", getStatus()).append("pyStr", getPyStr())
|
||||||
.append("createTime", getCreateTime()).append("updateBy", getUpdateBy())
|
.append("createBy", getCreateBy()).append("createTime", getCreateTime()).append("updateBy", getUpdateBy())
|
||||||
.append("updateTime", getUpdateTime()).append("remark", getRemark()).toString();
|
.append("updateTime", getUpdateTime()).append("remark", getRemark()).toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,18 @@ public interface SysDictDataMapper {
|
|||||||
*/
|
*/
|
||||||
public List<SysDictData> selectDictDataByType(String dictType);
|
public List<SysDictData> selectDictDataByType(String dictType);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型和搜索关键字查询字典数据(支持拼音搜索)
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型
|
||||||
|
* @param searchKey 搜索关键字(支持名称和拼音首字母搜索)
|
||||||
|
* @return 字典数据集合信息
|
||||||
|
*/
|
||||||
|
public List<SysDictData> selectDictDataByTypeWithSearch(@Param("dictType") String dictType, @Param("searchKey") String searchKey);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据字典类型和字典键值查询字典数据信息
|
* 根据字典类型和字典键值查询字典数据信息
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -34,6 +34,15 @@ public interface ISysDictTypeService {
|
|||||||
*/
|
*/
|
||||||
public List<SysDictData> selectDictDataByType(String dictType);
|
public List<SysDictData> selectDictDataByType(String dictType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型和搜索关键字查询字典数据(支持拼音搜索)
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型
|
||||||
|
* @param searchKey 搜索关键字(支持名称和拼音首字母搜索),可为null
|
||||||
|
* @return 字典数据集合信息
|
||||||
|
*/
|
||||||
|
public List<SysDictData> selectDictDataByType(String dictType, String searchKey);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据字典类型ID查询信息
|
* 根据字典类型ID查询信息
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import com.core.common.core.domain.entity.SysDictData;
|
import com.core.common.core.domain.entity.SysDictData;
|
||||||
import com.core.common.utils.DictUtils;
|
import com.core.common.utils.DictUtils;
|
||||||
import com.core.system.mapper.SysDictDataMapper;
|
import com.core.system.mapper.SysDictDataMapper;
|
||||||
|
import com.core.common.utils.ChineseConvertUtils;
|
||||||
import com.core.system.service.ISysDictDataService;
|
import com.core.system.service.ISysDictDataService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -88,6 +89,10 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertDictData(SysDictData data) {
|
public int insertDictData(SysDictData data) {
|
||||||
|
// 自动计算拼音首字母
|
||||||
|
if (data.getDictLabel() != null && !data.getDictLabel().isEmpty()) {
|
||||||
|
data.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(data.getDictLabel()));
|
||||||
|
}
|
||||||
int row = dictDataMapper.insertDictData(data);
|
int row = dictDataMapper.insertDictData(data);
|
||||||
if (row > 0) {
|
if (row > 0) {
|
||||||
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
|
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
|
||||||
@@ -104,6 +109,10 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateDictData(SysDictData data) {
|
public int updateDictData(SysDictData data) {
|
||||||
|
// 如果字典标签有变化,重新计算拼音首字母
|
||||||
|
if (data.getDictLabel() != null && !data.getDictLabel().isEmpty()) {
|
||||||
|
data.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(data.getDictLabel()));
|
||||||
|
}
|
||||||
int row = dictDataMapper.updateDictData(data);
|
int row = dictDataMapper.updateDictData(data);
|
||||||
if (row > 0) {
|
if (row > 0) {
|
||||||
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
|
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
|
||||||
|
|||||||
@@ -71,6 +71,24 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysDictData> selectDictDataByType(String dictType) {
|
public List<SysDictData> selectDictDataByType(String dictType) {
|
||||||
|
return selectDictDataByType(dictType, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型和搜索关键字查询字典数据(支持拼音搜索)
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型
|
||||||
|
* @param searchKey 搜索关键字(支持名称和拼音首字母搜索),可为null
|
||||||
|
* @return 字典数据集合信息
|
||||||
|
*/
|
||||||
|
public List<SysDictData> selectDictDataByType(String dictType, String searchKey) {
|
||||||
|
// 如果有搜索关键字,使用带搜索的SQL查询
|
||||||
|
if (StringUtils.isNotEmpty(searchKey) && !searchKey.trim().isEmpty()) {
|
||||||
|
String trimmedKey = searchKey.trim();
|
||||||
|
return dictDataMapper.selectDictDataByTypeWithSearch(dictType, trimmedKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 否则使用原有方法(带缓存)
|
||||||
List<SysDictData> dictDatas = DictUtils.getDictCache(dictType);
|
List<SysDictData> dictDatas = DictUtils.getDictCache(dictType);
|
||||||
if (StringUtils.isNotEmpty(dictDatas)) {
|
if (StringUtils.isNotEmpty(dictDatas)) {
|
||||||
return dictDatas;
|
return dictDatas;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
<result property="listClass" column="list_class"/>
|
<result property="listClass" column="list_class"/>
|
||||||
<result property="isDefault" column="is_default"/>
|
<result property="isDefault" column="is_default"/>
|
||||||
<result property="status" column="status"/>
|
<result property="status" column="status"/>
|
||||||
|
<result property="pyStr" column="py_str"/>
|
||||||
<result property="createBy" column="create_by"/>
|
<result property="createBy" column="create_by"/>
|
||||||
<result property="createTime" column="create_time"/>
|
<result property="createTime" column="create_time"/>
|
||||||
<result property="updateBy" column="update_by"/>
|
<result property="updateBy" column="update_by"/>
|
||||||
@@ -30,6 +31,7 @@
|
|||||||
list_class,
|
list_class,
|
||||||
is_default,
|
is_default,
|
||||||
status,
|
status,
|
||||||
|
py_str,
|
||||||
create_by,
|
create_by,
|
||||||
create_time,
|
create_time,
|
||||||
remark
|
remark
|
||||||
@@ -56,6 +58,19 @@
|
|||||||
<include refid="selectDictDataVo"/>
|
<include refid="selectDictDataVo"/>
|
||||||
where status = '0' and dict_type = #{dictType} order by dict_sort asc
|
where status = '0' and dict_type = #{dictType} order by dict_sort asc
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectDictDataByTypeWithSearch" resultMap="SysDictDataResult">
|
||||||
|
<include refid="selectDictDataVo"/>
|
||||||
|
where status = '0'
|
||||||
|
and dict_type = #{dictType}
|
||||||
|
<if test="searchKey != null and searchKey != ''">
|
||||||
|
and (
|
||||||
|
(dict_label is not null and dict_label like concat('%', #{searchKey}, '%'))
|
||||||
|
or (py_str is not null and py_str like concat('%', #{searchKey}, '%'))
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
order by dict_sort asc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<select id="selectDictLabel" resultType="String">
|
<select id="selectDictLabel" resultType="String">
|
||||||
select dict_label
|
select dict_label
|
||||||
@@ -105,6 +120,7 @@
|
|||||||
<if test="listClass != null">list_class = #{listClass},</if>
|
<if test="listClass != null">list_class = #{listClass},</if>
|
||||||
<if test="isDefault != null and isDefault != ''">is_default = #{isDefault},</if>
|
<if test="isDefault != null and isDefault != ''">is_default = #{isDefault},</if>
|
||||||
<if test="status != null">status = #{status},</if>
|
<if test="status != null">status = #{status},</if>
|
||||||
|
<if test="pyStr !=null">pyStr = #{pyStr}</if>
|
||||||
<if test="remark != null">remark = #{remark},</if>
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||||
update_time = now()
|
update_time = now()
|
||||||
@@ -128,6 +144,7 @@
|
|||||||
<if test="listClass != null and listClass != ''">list_class,</if>
|
<if test="listClass != null and listClass != ''">list_class,</if>
|
||||||
<if test="isDefault != null and isDefault != ''">is_default,</if>
|
<if test="isDefault != null and isDefault != ''">is_default,</if>
|
||||||
<if test="status != null">status,</if>
|
<if test="status != null">status,</if>
|
||||||
|
<if test="pyStr !=null and pyStr !=null ''" >py_str,</if>
|
||||||
<if test="remark != null and remark != ''">remark,</if>
|
<if test="remark != null and remark != ''">remark,</if>
|
||||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||||
create_time
|
create_time
|
||||||
@@ -140,6 +157,7 @@
|
|||||||
<if test="listClass != null and listClass != ''">#{listClass},</if>
|
<if test="listClass != null and listClass != ''">#{listClass},</if>
|
||||||
<if test="isDefault != null and isDefault != ''">#{isDefault},</if>
|
<if test="isDefault != null and isDefault != ''">#{isDefault},</if>
|
||||||
<if test="status != null">#{status},</if>
|
<if test="status != null">#{status},</if>
|
||||||
|
<if test="pyStr !=null and pyStr !=''" >{pystr},</if>
|
||||||
<if test="remark != null and remark != ''">#{remark},</if>
|
<if test="remark != null and remark != ''">#{remark},</if>
|
||||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||||
now()
|
now()
|
||||||
|
|||||||
@@ -18,10 +18,11 @@ export function getData(dictCode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 根据字典类型查询字典数据信息
|
// 根据字典类型查询字典数据信息
|
||||||
export function getDicts(dictType) {
|
export function getDicts(dictType, searchKey) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/dict/data/type/' + dictType,
|
url: '/system/dict/data/type/' + dictType,
|
||||||
method: 'get'
|
method: 'get',
|
||||||
|
params: searchKey ? { searchKey } : {}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -94,11 +94,16 @@
|
|||||||
v-model="form.unitCode"
|
v-model="form.unitCode"
|
||||||
clearable
|
clearable
|
||||||
filterable
|
filterable
|
||||||
|
remote
|
||||||
|
reserve-keyword
|
||||||
|
:remote-method="handleUnitCodeSearch"
|
||||||
|
:loading="unitCodeLoading"
|
||||||
|
@focus="handleUnitCodeFocus"
|
||||||
@change="handleUnitCodeChange"
|
@change="handleUnitCodeChange"
|
||||||
:disabled="form.isEditInfoDisable === 1 || form.isEditInfoDisable === 2"
|
:disabled="form.isEditInfoDisable === 1 || form.isEditInfoDisable === 2"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in unit_code"
|
v-for="dict in unitCodeOptions"
|
||||||
:key="dict.value"
|
:key="dict.value"
|
||||||
:label="dict.label"
|
:label="dict.label"
|
||||||
:value="dict.value"
|
:value="dict.value"
|
||||||
@@ -349,6 +354,7 @@
|
|||||||
|
|
||||||
<script setup name="MedicineDialog">
|
<script setup name="MedicineDialog">
|
||||||
import { editDevice, addDevice, deptTreeSelect, locationTreeSelect } from './device';
|
import { editDevice, addDevice, deptTreeSelect, locationTreeSelect } from './device';
|
||||||
|
import { getDicts } from '@/api/system/dict/data';
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const { device_type_code, unit_code, fin_type_code, chrgitm_lv, med_chrgitm_type } = proxy.useDict(
|
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 deviceCategories = ref([]); // 器材分类
|
||||||
const statusFlagOptions = ref([]); // 状态标记
|
const statusFlagOptions = ref([]); // 状态标记
|
||||||
const supplierListOptions = ref([]); // 供应商列表
|
const supplierListOptions = ref([]); // 供应商列表
|
||||||
|
const unitCodeOptions = ref([]); // 包装单位选项列表(用于搜索)
|
||||||
|
const unitCodeLoading = ref(false); // 包装单位搜索加载状态
|
||||||
|
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
form: {},
|
form: {},
|
||||||
@@ -439,6 +447,8 @@ function show() {
|
|||||||
form.value.size = '-';
|
form.value.size = '-';
|
||||||
getDeptTree();
|
getDeptTree();
|
||||||
getLocationTree();
|
getLocationTree();
|
||||||
|
// 初始化包装单位列表
|
||||||
|
handleUnitCodeFocus();
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
}
|
}
|
||||||
//医保目录对照后,赋值
|
//医保目录对照后,赋值
|
||||||
@@ -479,6 +489,8 @@ function edit() {
|
|||||||
supplierListOptions.value = props.supplierListOptions;
|
supplierListOptions.value = props.supplierListOptions;
|
||||||
getDeptTree();
|
getDeptTree();
|
||||||
getLocationTree();
|
getLocationTree();
|
||||||
|
// 初始化包装单位列表
|
||||||
|
handleUnitCodeFocus();
|
||||||
visible.value = true;
|
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) {
|
function handleUnitCodeChange(value) {
|
||||||
form.value.salesUnitCode = value;
|
form.value.salesUnitCode = value;
|
||||||
|
|||||||
Reference in New Issue
Block a user