mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-11-12 05:33:48 +08:00
v3.20.0 【新增】优化登录使用spring cache;【新增】优化部门cache;【新增】代码生成枚举;【优化】三级等保Label显示宽度
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { dictApi } from '/@/api/support/dict-api';
|
||||
import { smartSentry } from '/@/lib/smart-sentry';
|
||||
import { DICT_SPLIT } from '/@/constants/support/dict-const.js';
|
||||
import _ from 'lodash';
|
||||
|
||||
@@ -23,14 +21,21 @@ export const useDictStore = defineStore({
|
||||
|
||||
// 获取字典的值名称
|
||||
getDataLabels(dictCode, dataValue) {
|
||||
if (!dataValue) {
|
||||
if (_.isNil(dataValue) || _.isNaN(dataValue)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
let dict = this.getDictData(dictCode);
|
||||
if (dict.length === 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// 是数字的话,需要特殊处理
|
||||
if(_.isNumber(dataValue)){
|
||||
let target = _.find(dict, { dataValue: dataValue });
|
||||
return target ? target.dataLabel : '';
|
||||
}
|
||||
|
||||
let valueArray = dataValue.split(DICT_SPLIT);
|
||||
let result = [];
|
||||
for (let item of valueArray) {
|
||||
@@ -42,7 +47,7 @@ export const useDictStore = defineStore({
|
||||
return result.join(DICT_SPLIT);
|
||||
},
|
||||
// 初始化字典
|
||||
initData(dictDataList){
|
||||
initData(dictDataList) {
|
||||
this.dictMap.clear();
|
||||
for (let data of dictDataList) {
|
||||
let dataArray = this.dictMap.get(data.dictCode);
|
||||
|
||||
Reference in New Issue
Block a user