refactor: 字典相关功能重构 采用一个Map储存字典(之前为两个Map)
This commit is contained in:
@@ -45,12 +45,13 @@ function fetchAndCacheDictData<T>(
|
||||
|
||||
/**
|
||||
* 这里是提供给渲染标签使用的方法
|
||||
* @deprecated 使用getDictOptions代替 于下个版本删除
|
||||
* @param dictName 字典名称
|
||||
* @returns 字典信息
|
||||
*/
|
||||
export function getDict(dictName: string) {
|
||||
const { getDict } = useDictStore();
|
||||
return fetchAndCacheDictData(dictName, () => getDict(dictName));
|
||||
const { getDictOptions } = useDictStore();
|
||||
return fetchAndCacheDictData(dictName, () => getDictOptions(dictName));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,6 +1,8 @@
|
||||
import type { Component as ComponentType } from 'vue';
|
||||
|
||||
import type { DictData } from '#/api/system/dict/dict-data-model';
|
||||
|
||||
import { type Component as ComponentType, h } from 'vue';
|
||||
import { h } from 'vue';
|
||||
|
||||
import { JsonPreview } from '@vben/common-ui';
|
||||
import {
|
||||
@@ -29,7 +31,7 @@ import { Tag } from 'ant-design-vue';
|
||||
|
||||
import { DictTag } from '#/components/dict';
|
||||
|
||||
import { getDict } from './dict';
|
||||
import { getDictOptions } from './dict';
|
||||
|
||||
/**
|
||||
* 渲染标签
|
||||
@@ -148,7 +150,7 @@ export function renderDictTags(
|
||||
* @returns tag
|
||||
*/
|
||||
export function renderDict(value: string, dictName: string) {
|
||||
const dictInfo = getDict(dictName);
|
||||
const dictInfo = getDictOptions(dictName);
|
||||
return renderDictTag(value, dictInfo);
|
||||
}
|
||||
export function renderIconSpan(
|
||||
|
Reference in New Issue
Block a user