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