|
@@ -1,13 +1,15 @@
|
|
|
-(function(vc){
|
|
|
|
|
|
|
+(function(vc,vm){
|
|
|
|
|
|
|
|
vc.extends({
|
|
vc.extends({
|
|
|
data:{
|
|
data:{
|
|
|
addStaffPrivilegeInfo:{
|
|
addStaffPrivilegeInfo:{
|
|
|
- _currentPgId:'',
|
|
|
|
|
|
|
+ _currentUserId:'',
|
|
|
name:'',
|
|
name:'',
|
|
|
description:'',
|
|
description:'',
|
|
|
errorInfo:'',
|
|
errorInfo:'',
|
|
|
- _noAddPrivilege:[]
|
|
|
|
|
|
|
+ _noAddPrivilege:[],
|
|
|
|
|
+ _noAddPrivilegeGroup:[],
|
|
|
|
|
+ _currentTab:1
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
_initMethod:function(){
|
|
_initMethod:function(){
|
|
@@ -16,45 +18,85 @@
|
|
|
_initEvent:function(){
|
|
_initEvent:function(){
|
|
|
vc.on('addStaffPrivilege','addStaffPrivilegeModel',function(_params){
|
|
vc.on('addStaffPrivilege','addStaffPrivilegeModel',function(_params){
|
|
|
$('#addStaffPrivilegeModel').modal('show');
|
|
$('#addStaffPrivilegeModel').modal('show');
|
|
|
- /*vc.component.addPrivilegeInfo._currentPgId = _params.pgId;
|
|
|
|
|
- //查询没有添加的权限
|
|
|
|
|
- vc.component.listNoAddPrivilege();*/
|
|
|
|
|
|
|
+ vc.component._refreshData(_params);
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
methods:{
|
|
methods:{
|
|
|
|
|
+ _refreshData:function(_params){
|
|
|
|
|
+ vc.component.addStaffPrivilegeInfo._currentUserId = _params.userId;
|
|
|
|
|
+ vc.component.addStaffPrivilegeInfo._currentTab = 1;
|
|
|
|
|
+ vc.component.listNoAddPrivilegeGroup();
|
|
|
|
|
+ },
|
|
|
|
|
+ changeTab:function(_tempTab){
|
|
|
|
|
+ vc.component.addStaffPrivilegeInfo._currentTab= _tempTab;
|
|
|
|
|
+ if(_tempTab == 2){
|
|
|
|
|
+ vc.component.listNoAddPrivilege();
|
|
|
|
|
+ return ;
|
|
|
|
|
+ }
|
|
|
|
|
+ vc.component.listNoAddPrivilegeGroup();
|
|
|
|
|
+ },
|
|
|
|
|
+ listNoAddPrivilegeGroup:function(){
|
|
|
|
|
+ vc.component.addStaffPrivilegeInfo._noAddPrivilegeGroup = [];
|
|
|
|
|
+ var param = {
|
|
|
|
|
+ params:{
|
|
|
|
|
+ userId:vc.component.addStaffPrivilegeInfo._currentUserId
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+ vc.http.get(
|
|
|
|
|
+ 'addStaffPrivilege',
|
|
|
|
|
+ 'listNoAddPrivilegeGroup',
|
|
|
|
|
+ param,
|
|
|
|
|
+ function(json,res){
|
|
|
|
|
+ //vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
|
|
|
|
+ if(res.status == 200){
|
|
|
|
|
+ vc.component.addStaffPrivilegeInfo._noAddPrivilegeGroup = JSON.parse(json);
|
|
|
|
|
+ return ;
|
|
|
|
|
+ }
|
|
|
|
|
+ vc.component.addStaffPrivilegeInfo.errorInfo = json;
|
|
|
|
|
+ },
|
|
|
|
|
+ function(errInfo,error){
|
|
|
|
|
+ console.log('请求失败处理');
|
|
|
|
|
+
|
|
|
|
|
+ vc.component.addStaffPrivilegeInfo.errorInfo = errInfo;
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
listNoAddPrivilege:function(){
|
|
listNoAddPrivilege:function(){
|
|
|
- vc.component.addPrivilegeInfo._noAddPrivilege=[];
|
|
|
|
|
|
|
+ vc.component.addStaffPrivilegeInfo._noAddPrivilege=[];
|
|
|
var param = {
|
|
var param = {
|
|
|
params:{
|
|
params:{
|
|
|
- pgId:vc.component.addPrivilegeInfo._currentPgId
|
|
|
|
|
|
|
+ userId:vc.component.addStaffPrivilegeInfo._currentUserId
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
vc.http.get(
|
|
vc.http.get(
|
|
|
- 'addPrivilege',
|
|
|
|
|
|
|
+ 'addStaffPrivilege',
|
|
|
'listNoAddPrivilege',
|
|
'listNoAddPrivilege',
|
|
|
param,
|
|
param,
|
|
|
function(json,res){
|
|
function(json,res){
|
|
|
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
|
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
|
|
if(res.status == 200){
|
|
if(res.status == 200){
|
|
|
- vc.component.addPrivilegeInfo._noAddPrivilege = JSON.parse(json);
|
|
|
|
|
|
|
+ vc.component.addStaffPrivilegeInfo._noAddPrivilege = JSON.parse(json);
|
|
|
return ;
|
|
return ;
|
|
|
}
|
|
}
|
|
|
- vc.component.addPrivilegeInfo.errorInfo = json;
|
|
|
|
|
|
|
+ vc.component.addStaffPrivilegeInfo.errorInfo = json;
|
|
|
},
|
|
},
|
|
|
function(errInfo,error){
|
|
function(errInfo,error){
|
|
|
console.log('请求失败处理');
|
|
console.log('请求失败处理');
|
|
|
|
|
|
|
|
- vc.component.addPrivilegeInfo.errorInfo = errInfo;
|
|
|
|
|
|
|
+ vc.component.addStaffPrivilegeInfo.errorInfo = errInfo;
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
- addPrivilegeToPrivilegeGroup:function(_privilegeInfo){
|
|
|
|
|
-
|
|
|
|
|
- vc.component.addPrivilegeInfo.errorInfo = "";
|
|
|
|
|
- _privilegeInfo.pgId = vc.component.addPrivilegeInfo._currentPgId;
|
|
|
|
|
|
|
+ addStaffPrivilege:function(_pId,_privilegeFlag){
|
|
|
|
|
+ vc.component.addStaffPrivilegeInfo.errorInfo = "";
|
|
|
|
|
+ var param = {
|
|
|
|
|
+ userId:vc.component.addStaffPrivilegeInfo._currentUserId,
|
|
|
|
|
+ pId:_pId,
|
|
|
|
|
+ pFlag:_privilegeFlag
|
|
|
|
|
+ };
|
|
|
vc.http.post(
|
|
vc.http.post(
|
|
|
- 'addPrivilege',
|
|
|
|
|
- 'addPrivilegeToPrivilegeGroup',
|
|
|
|
|
- JSON.stringify(_privilegeInfo),
|
|
|
|
|
|
|
+ 'addStaffPrivilege',
|
|
|
|
|
+ 'addStaffPrivilegeOrPrivilegeGroup',
|
|
|
|
|
+ JSON.stringify(param),
|
|
|
{
|
|
{
|
|
|
emulateJSON:true
|
|
emulateJSON:true
|
|
|
},
|
|
},
|
|
@@ -62,19 +104,29 @@
|
|
|
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
|
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
|
|
|
if(res.status == 200){
|
|
if(res.status == 200){
|
|
|
//关闭model
|
|
//关闭model
|
|
|
- vc.component.listNoAddPrivilege();
|
|
|
|
|
- vc.component.$emit('privilege_loadPrivilege',vc.component.addPrivilegeInfo._currentPgId);
|
|
|
|
|
|
|
+ $('#addStaffPrivilegeModel').modal('hide');
|
|
|
|
|
+ vc.emit('staffPrivilege','_loadStaffPrivileges',{
|
|
|
|
|
+ staffId:vc.component.addStaffPrivilegeInfo._currentUserId
|
|
|
|
|
+ });
|
|
|
return ;
|
|
return ;
|
|
|
}
|
|
}
|
|
|
- vc.component.addPrivilegeInfo.errorInfo = json;
|
|
|
|
|
|
|
+ vc.component.addStaffPrivilegeInfo.errorInfo = json;
|
|
|
},
|
|
},
|
|
|
function(errInfo,error){
|
|
function(errInfo,error){
|
|
|
console.log('请求失败处理');
|
|
console.log('请求失败处理');
|
|
|
|
|
|
|
|
- vc.component.addPrivilegeInfo.errorInfo = errInfo;
|
|
|
|
|
|
|
+ vc.component.addStaffPrivilegeInfo.errorInfo = errInfo;
|
|
|
});
|
|
});
|
|
|
|
|
+ },
|
|
|
|
|
+ userAddPrivilegeGroup:function(_pgId){
|
|
|
|
|
+ console.log("需要添加权限:",_pgId);
|
|
|
|
|
+ vc.component.addStaffPrivilege(_pgId,1)
|
|
|
|
|
+ },
|
|
|
|
|
+ userAddPrivilege:function(_pId){
|
|
|
|
|
+ console.log("需要添加权限:",_pId);
|
|
|
|
|
+ vc.component.addStaffPrivilege(_pId,2)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
-})(window.vc);
|
|
|
|
|
|
|
+})(window.vc,window.vc.component);
|