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.

169 lines
4.8 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" style="background: #fff;">
<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:'queryUnAuthedAccTreeByRoleID'
,_DATA:$.json2str({
op_account_uuid:_accid
,app_uuid:_app_uuid
,role_uuid:_selected_id
,resultfields:''
,orderfields:''
})
,_RSTYPE:'tree'
,_RSFIELD:'resultset'
,_RSPARAM:$.json2str({
idField:'id'
,textField:'account_name'
,parentField:'pid'
,attrs:'account_uuid,depart_uuid,account_type'
})
}
,desturl:'wdk?action=wdk.pub&method=call_service&ajaxparam='+new Date().getTime()
,destQueryParams:{
_SRVNAME:'service.usr.authorization'
,_SRVMETHOD:'queryAuthedAccTreeByRoleID'
,_DATA:$.json2str({
op_account_uuid:_accid
,app_uuid:_app_uuid
,role_uuid:_selected_id
,resultfields:''
,orderfields:''
})
,_RSTYPE:'tree'
,_RSFIELD:'resultset'
,_RSPARAM:$.json2str({
idField:'id'
,textField:'account_name'
,parentField:'pid'
,attrs:'account_uuid,depart_uuid,account_type'
})
}
,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 param = new Array();
for(var i=0;i<nodes.length;i++){
var node = nodes[i];
if(node.attributes.account_type === "acc"){
param.push(node);
}
}
var roleaccount = [];
$.each(param, function (i, node) {
var obj = {};
obj.account_uuid = node.attributes.account_uuid;
obj.org_uuid = node.attributes.depart_uuid;
roleaccount.push(obj);
});
var _data = {
op_account_uuid:_accid
,role_uuid:_selected_id
,roleaccount_info:roleaccount
};
var dataParam = {
_SRVNAME:'service.usr.authorization'
,_SRVMETHOD:'assignAccToRole'
,_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>