You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

164 lines
4.6 KiB

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<%@include file="/wdk/theme/je/module/public/common.jsp"%>
<!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
<%
String menu_code = request.getParameter("menucode");
WDK.writeButton(out, su, menu_code);
%>
<title>角色授权</title>
<style>
/*双树要修改的样式*/
.layout_twotree * {
box-sizing: border-box;
}
.table-col {
float: left;
}
.action-btns .btn {
display: block;
}
</style>
</head>
<body>
<div class="easyui-layout" data-options="fit:true">
<div data-options="region:'north',border:false,collapsed:false" class="page-title" style="overflow:hidden">
<div class="page-toolbar" style="border:0;">
<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'fa fa-save'" id="save">保存</a>
<a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'fa fa-close'" id="cancel">取消</a>
</div>
</div>
<div data-options="region:'center',border:false,collapsed:false">
<div id="layout_twotree" class="layout_twotree" style="height:100%;"></div>
</div>
</div>
</body>
<script type="text/javascript">
var param = $.getURLParam('param');
var jparam = $.str2json($.urlparam_decode(param));
var _actionflag = jparam.queryParams.actionflag;
var _app_uuid = jparam.queryParams.app_uuid;
var _selected_id = jparam.queryParams.selected_id;
var wid = $.getURLParam("wid");
var _accid = $.getSessionUser().account_id;
$(function(){
$.twotree({
id:'layout_twotree'
,srclabel:'可授权功能列表'
,destlabel:'已授权功能列表'
,srcurl:'wdk?action=wdk.pub&method=call_service&ajaxparam='+new Date().getTime()
,srcQueryParams:{
_SRVNAME:'service.usr.authorization'
,_SRVMETHOD:'queryUnRightById'
,_DATA:$.json2str({
op_account_uuid:_accid
,app_uuid:_app_uuid
,role_uuid:_selected_id
,resultfields:''
,orderfields:''
})
,_RSTYPE:'tree'
,_RSFIELD:'resultset'
,_RSPARAM:$.json2str({
idField:'resource_uuid'
,textField:'resource_name'
,parentField:'parent_uuid'
,attrs:'func_type_scode'
})
}
,desturl:'wdk?action=wdk.pub&method=call_service&ajaxparam='+new Date().getTime()
,destQueryParams:{
_SRVNAME:'service.usr.authorization'
,_SRVMETHOD:'queryRightById'
,_DATA:$.json2str({
op_account_uuid:_accid
,app_uuid:_app_uuid
,role_uuid:_selected_id
,resultfields:''
,orderfields:''
})
,_RSTYPE:'tree'
,_RSFIELD:'resultset'
,_RSPARAM:$.json2str({
idField:'resource_uuid'
,textField:'resource_name'
,parentField:'parent_uuid'
,attrs:'func_type_scode'
})
}
,onBeforeLoad:function(){
var rtreeObj = $.fn.zTree.getZTreeObj("layout_twotree_ltree");
if(rtreeObj){
$.wait_open();
}
}
,onLoadSuccess:function(){
var rtreeObj = $.fn.zTree.getZTreeObj("layout_twotree_rtree");
if(rtreeObj){
$.wait_close();
rtreeObj.expandAll(true);
}
}
});
$('#save').on("click", function(e){
//获取右边树的所有选中节点ID
var nodes = $.twotree_getNode({id:'layout_twotree',srcordest:'dest'});
$.wait_open('应用授权中...');
var rolefunc = [];
$.each(nodes, function (i, node) {
var obj = {};
obj.func_uuid = node.id;
obj.func_type_scode = node.attributes.func_type_scode;
rolefunc.push(obj);
});
var _data = {
op_account_uuid:_accid
,role_uuid:_selected_id
,rolefunc_info:rolefunc
};
var dataParam = {
_SRVNAME:'service.usr.authorization'
,_SRVMETHOD:'setRoleRight'
,_DATA:$.json2str(_data)
};
$.cuajax({
url:'wdk?action=wdk.pub&method=call_service&ajaxparam='+new Date().getTime(),
method:"post",
timeout:WDK_Timeout,
data:dataParam,
success:function(result) {
$.wait_close();
//返回值字符串转json
var jres = $.str2json(result);
if(jres.code=="1"){ //操作成功
closewin(jres.code);
}else{
alert(jres.desc);
}
},
error:function(result){
$.wait_close();
alert('网络错误!result='+result);
}
});
});
$('#cancel').on("click", function(e){
closewin();
});
// 关闭模态框
function closewin(){
$.closeWin(wid);
}
});
</script>
</html>