222
This commit is contained in:
parent
d66da4f971
commit
a47e763254
|
@ -10,7 +10,7 @@ export default function (Vue, options) {
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
|
|
||||||
const dict = new Dict();
|
const dict = new Dict(this.$options.dictapiurl);
|
||||||
if(this.$options.dictapiurl){
|
if(this.$options.dictapiurl){
|
||||||
apiurl=this.$options.dictapiurl;
|
apiurl=this.$options.dictapiurl;
|
||||||
dict.apiurl=this.$options.dictapiurl;
|
dict.apiurl=this.$options.dictapiurl;
|
||||||
|
@ -29,11 +29,13 @@ export default function (Vue, options) {
|
||||||
if (!(this.dict instanceof Dict)) {
|
if (!(this.dict instanceof Dict)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if(this.$options.dictapiurl){
|
||||||
|
this.dict.apiurl=this.$options.dictapiurl;
|
||||||
|
}
|
||||||
let dicttime=sessionStorage.getItem("dicttime");
|
let dicttime=sessionStorage.getItem("dicttime");
|
||||||
if(dicttime&&new Date().getTime()-Number(dicttime)>1000*60*720){
|
if(dicttime&&new Date().getTime()-Number(dicttime)>1000*60*720){
|
||||||
options.onCreated && options.onCreated(this.dict)
|
options.onCreated && options.onCreated(this.dict)
|
||||||
this.dict.init(this.$options.dicts,this.$options.dictapiurl).then(() => {
|
this.dict.init(this.$options.dicts).then(() => {
|
||||||
this.dictstatus = true;
|
this.dictstatus = true;
|
||||||
sessionStorage.setItem("dicttime",new Date().getTime());
|
sessionStorage.setItem("dicttime",new Date().getTime());
|
||||||
options.onReady && options.onReady(this.dict)
|
options.onReady && options.onReady(this.dict)
|
||||||
|
@ -45,22 +47,43 @@ export default function (Vue, options) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}else{
|
||||||
|
const dictdata = sessionStorage.getItem("dictdata");
|
||||||
|
if (dictdata) {
|
||||||
|
let sedata = JSON.parse(dictdata);
|
||||||
|
const find=this.$options.dicts.find((f)=>{
|
||||||
|
let findchild=Object.keys(sedata).find((h)=>h.indexOf(f)>-1);
|
||||||
|
return !findchild;
|
||||||
|
});
|
||||||
|
if(find){
|
||||||
|
options.onCreated && options.onCreated(this.dict)
|
||||||
|
this.dict.init(this.$options.dicts).then(() => {
|
||||||
|
this.dictstatus = true;
|
||||||
|
sessionStorage.setItem("dicttime",new Date().getTime());
|
||||||
|
options.onReady && options.onReady(this.dict)
|
||||||
|
|
||||||
const dictdata = sessionStorage.getItem("dictdata");
|
this.$nextTick(() => {
|
||||||
if (dictdata) {
|
this.$emit('dictReady', this.dict)
|
||||||
let sedata = JSON.parse(dictdata);
|
if (this.$options.methods && this.$options.methods.onDictReady instanceof Function) {
|
||||||
const find=this.$options.dicts.find((f)=>{
|
this.$options.methods.onDictReady.call(this, this.dict)
|
||||||
let findchild=Object.keys(sedata).find((h)=>h.indexOf(f)>-1);
|
|
||||||
return !findchild;
|
}
|
||||||
});
|
})
|
||||||
if(find){
|
})
|
||||||
|
}else{
|
||||||
|
this.dict.doSession(sedata).then(() => {
|
||||||
|
this.dictstatus = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$emit('dictReady', this.dict)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
options.onCreated && options.onCreated(this.dict)
|
options.onCreated && options.onCreated(this.dict)
|
||||||
this.dict.init(this.$options.dicts).then(() => {
|
this.dict.init(this.$options.dicts).then(() => {
|
||||||
this.dictstatus = true;
|
this.dictstatus = true;
|
||||||
sessionStorage.setItem("dicttime",new Date().getTime());
|
sessionStorage.setItem("dicttime",new Date().getTime());
|
||||||
options.onReady && options.onReady(this.dict)
|
options.onReady && options.onReady(this.dict)
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$emit('dictReady', this.dict)
|
this.$emit('dictReady', this.dict)
|
||||||
if (this.$options.methods && this.$options.methods.onDictReady instanceof Function) {
|
if (this.$options.methods && this.$options.methods.onDictReady instanceof Function) {
|
||||||
|
@ -69,29 +92,7 @@ export default function (Vue, options) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}else{
|
|
||||||
this.dict.doSession(sedata).then(() => {
|
|
||||||
this.dictstatus = true;
|
|
||||||
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.$emit('dictReady', this.dict)
|
|
||||||
})
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
options.onCreated && options.onCreated(this.dict)
|
|
||||||
this.dict.init(this.$options.dicts,this.$options.dictapiurl).then(() => {
|
|
||||||
this.dictstatus = true;
|
|
||||||
sessionStorage.setItem("dicttime",new Date().getTime());
|
|
||||||
options.onReady && options.onReady(this.dict)
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.$emit('dictReady', this.dict)
|
|
||||||
if (this.$options.methods && this.$options.methods.onDictReady instanceof Function) {
|
|
||||||
this.$options.methods.onDictReady.call(this, this.dict)
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -119,9 +120,11 @@ export default function (Vue, options) {
|
||||||
},
|
},
|
||||||
getDict(name) {
|
getDict(name) {
|
||||||
new Promise((r)=>{
|
new Promise((r)=>{
|
||||||
this.dict = new Dict();
|
this.dict = new Dict(this.apiurl);
|
||||||
this.dict.owner = this;
|
this.dict.owner = this;
|
||||||
this.dict.apiurl=this.apiurl;
|
if(this.apiurl){
|
||||||
|
this.dict.apiurl=this.apiurl;
|
||||||
|
}
|
||||||
this.dict.getDict(name).then(() => {
|
this.dict.getDict(name).then(() => {
|
||||||
r(this.dict);
|
r(this.dict);
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "erp-element-ui",
|
"name": "erp-element-ui",
|
||||||
"version": "1.0.43",
|
"version": "1.0.44",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
Loading…
Reference in New Issue