privilege.js 1.8 KB

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