chore: 字典相关逻辑
This commit is contained in:
parent
329b41bc44
commit
89047a7dde
@ -75,7 +75,6 @@ const onSelected: SelectHandler = async (tenantId: string, option: any) => {
|
|||||||
|
|
||||||
async function onDeselect() {
|
async function onDeselect() {
|
||||||
await tenantDynamicClear();
|
await tenantDynamicClear();
|
||||||
dictStore.resetCache();
|
|
||||||
message.success($t('component.tenantToggle.reset'));
|
message.success($t('component.tenantToggle.reset'));
|
||||||
lastSelected.value = '';
|
lastSelected.value = '';
|
||||||
close(false);
|
close(false);
|
||||||
|
@ -12,10 +12,13 @@ export function getDict(dictName: string): DictData[] {
|
|||||||
if (dictList.length === 0 && !dictRequestCache.has(dictName)) {
|
if (dictList.length === 0 && !dictRequestCache.has(dictName)) {
|
||||||
dictRequestCache.set(
|
dictRequestCache.set(
|
||||||
dictName,
|
dictName,
|
||||||
dictDataInfo(dictName).then((resp) => {
|
dictDataInfo(dictName)
|
||||||
|
.then((resp) => {
|
||||||
// 缓存到store 这样就不用重复获取了
|
// 缓存到store 这样就不用重复获取了
|
||||||
// 内部处理了push的逻辑 这里不用push
|
// 内部处理了push的逻辑 这里不用push
|
||||||
setDictInfo(dictName, resp);
|
setDictInfo(dictName, resp);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
// 移除请求状态缓存
|
// 移除请求状态缓存
|
||||||
dictRequestCache.delete(dictName);
|
dictRequestCache.delete(dictName);
|
||||||
}),
|
}),
|
||||||
@ -31,10 +34,13 @@ export function getDictOptions(dictName: string): Option[] {
|
|||||||
if (dictOptionList.length === 0 && !dictRequestCache.has(dictName)) {
|
if (dictOptionList.length === 0 && !dictRequestCache.has(dictName)) {
|
||||||
dictRequestCache.set(
|
dictRequestCache.set(
|
||||||
dictName,
|
dictName,
|
||||||
dictDataInfo(dictName).then((resp) => {
|
dictDataInfo(dictName)
|
||||||
|
.then((resp) => {
|
||||||
// 缓存到store 这样就不用重复获取了
|
// 缓存到store 这样就不用重复获取了
|
||||||
// 内部处理了push的逻辑 这里不用push
|
// 内部处理了push的逻辑 这里不用push
|
||||||
setDictInfo(dictName, resp);
|
setDictInfo(dictName, resp);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
// 移除请求状态缓存
|
// 移除请求状态缓存
|
||||||
dictRequestCache.delete(dictName);
|
dictRequestCache.delete(dictName);
|
||||||
}),
|
}),
|
||||||
|
Loading…
Reference in New Issue
Block a user