parent
c551f7f777
commit
a724e29dac
@ -1,40 +0,0 @@
|
||||
|
||||
const DictMixin = {
|
||||
dicts: [],
|
||||
computed: {
|
||||
dict() {
|
||||
return this.$store.getters.dict;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
if (this.$options.dicts) {
|
||||
const noDicts = [];
|
||||
const hasDicts = [];
|
||||
this.$options.dicts.forEach((type) => {
|
||||
if (!this.dict[type]) {
|
||||
noDicts.push(type);
|
||||
} else {
|
||||
hasDicts.push(type);
|
||||
}
|
||||
});
|
||||
|
||||
if (hasDicts.length > 0 && this.MXDictFetched) {
|
||||
this.MXDictFetched(hasDicts);
|
||||
}
|
||||
|
||||
if (noDicts.length === 0) {
|
||||
return;
|
||||
}
|
||||
this.$store.dispatch('dict/fetchDict', {
|
||||
types: noDicts,
|
||||
success: () => {
|
||||
if (this.MXDictFetched) {
|
||||
this.MXDictFetched(noDicts);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default DictMixin;
|
Loading…
Reference in new issue