提交 39551343 编写于 作者: tony001's avatar tony001

补充获取代码表逻辑

上级 3eff7fca
import { Store } from 'vuex';
import { Http } from '@/utils';
import CodeListService from "@service/app/codelist-service";
/**
* 实体服务基类
......@@ -115,6 +116,34 @@ export default class EntityService {
return this.$store;
}
/**
* 获取代码表
*
* @memberof EntityService
*/
public getCodeList(tag:string,codelistType:string,context:any = {},param:any ={}){
return new Promise((resolve:any,reject:any) =>{
if(tag && Object.is(codelistType,"STATIC")){
let returnItems:Array<any> = [];
const codelist = (this.getStore() as Store<any>).getters.getCodeList(tag);
if (codelist) {
returnItems = [...JSON.parse(JSON.stringify(codelist.items))];
} else {
console.log(`----${tag}----代码表不存在`);
}
resolve(returnItems);
}else if(tag && Object.is(codelistType,"DYNAMIC")){
let codeListService = new CodeListService({ $store: this.$store });
codeListService.getItems(tag,context,param).then((res:any) => {
resolve(res);
}).catch((error:any) => {
reject(`${tag}代码表不存在`);
console.log(`----${tag}----代码表不存在`);
});
}
})
}
/**
* 初始化基础数据
*
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册