privilege.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. (function(vc){
  2. vc.extends({
  3. data:{
  4. privilegeInfo:{
  5. _currentPgId:"",
  6. _currentPgName:"",
  7. _privileges:[]
  8. }
  9. },
  10. _initMethod:function(){
  11. },
  12. _initEvent:function(){
  13. vc.component.$on('privilege_group_event',function(_pgObj){
  14. vc.component.privilegeInfo._currentPgId = _pgObj._pgId;
  15. vc.component.privilegeInfo._currentPgName = _pgObj._pgName;
  16. //调用接口查询权限
  17. vc.component._loadPrivilege(_pgObj._pgId);
  18. });
  19. },
  20. methods:{
  21. _loadPrivilege:function(_pgId){
  22. var param = {
  23. params:{pgId:_pgId}
  24. };
  25. //发送get请求
  26. vc.http.get('privilege',
  27. 'listPrivilege',
  28. param,
  29. function(json){
  30. var _privileges = JSON.parse(json);
  31. vc.component.privilegeInfo._privileges = _privileges;
  32. },function(){
  33. console.log('请求失败处理');
  34. }
  35. );
  36. }
  37. }
  38. });
  39. })(window.vc);