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

完善操作标识映射统一资源

上级 4bc2fa7f
<#ibiztemplate>
TARGET=PSSYSAPP
</#ibiztemplate>
/**
* 实体权限服务
*
* @export
* @class AuthService
*/
export default class AuthService {
/**
* Vue 状态管理器
*
* @public
* @type {(any | null)}
* @memberof AuthService
*/
public $store: any;
/**
* 系统操作标识映射统一资源Map
*
* @public
* @type {Map<string,any>}
* @memberof AuthService
*/
public sysOPPrivsMap:Map<string,any> = new Map();
/**
* 默认操作标识
*
* @public
* @type {(any)}
* @memberof AuthService
*/
public defaultOPPrivs: any = {<#if sys.getAllPSDEOPPrivs()??><#list sys.getAllPSDEOPPrivs() as sysOPPrivs>${sysOPPrivs.getName()}: 1<#if sysOPPrivs_has_next>,</#if></#list></#if>};
/**
* Creates an instance of AuthService.
*
* @param {*} [opts={}]
* @memberof AuthService
*/
constructor(opts: any = {}) {
this.$store = opts.$store;
this.registerSysOPPrivs();
}
/**
* 获取状态管理器
*
* @returns {(any | null)}
* @memberof AuthService
*/
public getStore(): any {
return this.$store;
}
/**
* 获取实体权限服务
*
* @param {string} name 实体名称
* @returns {Promise<any>}
* @memberof AuthService
*/
public getService(name: string): Promise<any> {
return (window as any)['authServiceRegister'].getService(name);
}
/**
* 注册系统操作标识统一资源
*
* @param {string} name 实体名称
* @returns {Promise<any>}
* @memberof AuthService
*/
public registerSysOPPrivs(){
<#if sys.getAllPSDEOPPrivs()??>
<#list sys.getAllPSDEOPPrivs() as sysOPPrivs>
<#if sysOPPrivs.getMapPSSysUniRes()??>
this.sysOPPrivsMap.set('${sysOPPrivs.getName()}','${sysOPPrivs.getMapPSSysUniRes().getResCode()}');
</#if>
</#list>
</#if>
}
/**
* 根据当前数据获取实体操作标识
*
* @param {string} name 实体名称
* @returns {any}
* @memberof AuthService
*/
public getOPPrivs(data: any): any {
return null;
}
/**
* 根据菜单项获取菜单权限
*
* @param {*} item 菜单标识
* @returns {boolean}
* @memberof AuthService
*/
public getMenusPermission(item: any): boolean {
return this.$store.getters['authresource/getAuthMenu'](item);
}
/**
* 根据统一资源标识获取统一资源权限
*
* @param {*} tag 统一资源标识
* @returns {boolean}
* @memberof AuthService
*/
public getResourcePermission(tag: any): boolean {
return this.$store.getters['authresource/getResourceData'](tag);
}
}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册