update ruoyi-ui/src/utils/dict/Dict.js.
防止字典重复加载
This commit is contained in:
parent
ec20194186
commit
a6ef318fbb
@ -37,7 +37,7 @@ export default class Dict {
|
|||||||
if (dictMeta.lazy) {
|
if (dictMeta.lazy) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ps.push(loadDict(this, dictMeta))
|
ps.push(removal(this, dictMeta))
|
||||||
})
|
})
|
||||||
return Promise.all(ps)
|
return Promise.all(ps)
|
||||||
}
|
}
|
||||||
@ -55,6 +55,26 @@ export default class Dict {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//过滤重复数据重复请求
|
||||||
|
function removal(dict, dictMeta) {
|
||||||
|
const type = dictMeta.type
|
||||||
|
let that = dict.owner;
|
||||||
|
let ld;
|
||||||
|
if(__dictCache.get(type)){
|
||||||
|
ld = __dictCache.get(type)
|
||||||
|
ld.then(dicts=>{
|
||||||
|
dict.type[type].splice(0, Number.MAX_SAFE_INTEGER, ...dicts)
|
||||||
|
dicts.forEach(d => {
|
||||||
|
Vue.set(dict.label[type], d.value, d.label)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
ld = loadDict(dict, dictMeta);
|
||||||
|
__dictCache.set(type,ld)
|
||||||
|
}
|
||||||
|
return ld
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载字典
|
* 加载字典
|
||||||
* @param {Dict} dict 字典
|
* @param {Dict} dict 字典
|
||||||
|
Loading…
x
Reference in New Issue
Block a user