<%@page import="com.noblelift.imp.platform.module.portal.source.SessionUser"%> <%@page import="org.wdk.WDK"%> <%@page import="org.wdk.WDKConstant"%> <%@page import="org.wdk.WDKCore"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; String WDK_ROOT = WDKCore.WDK_ROOT; SessionUser su = (SessionUser)WDK.getSessionUser(request, response); WDK.writeSessionUser(out, su); %> <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- 上述3个meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! --> <title>用户管理-关联角色</title> <base href="<%=basePath%>" target="_self"> <script type="text/javascript" src="<%=WDK_ROOT%>/theme/je/core/js/wdk.js"></script> <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;"> <label style="float: left;" id="appname"></label> <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 _wid = $.getURLParam('wid'); var jparam = $.str2json($.urlparam_decode(param)); var _account_uuid = jparam.queryParams.account_uuid; var _manage_unit_uuid = jparam.queryParams.manage_unit_uuid; var _depart_uuid = jparam.queryParams.depart_uuid; $(function(){ //注册应用系统选择控件 /* $.combobox({ id : 'app_uuid' ,infinity:true ,queryParams:{ _SRVNAME:'service.usr.authorization' ,_SRVMETHOD:'queryAuthedAppListByAccID' ,_DATA:$.json2str({ op_account_uuid:$.getSessionUser().account_id ,manage_unit_uuid:$.getSessionUser().manageunituuid ,account_uuid:_account_uuid ,resultfields:'' ,orderfields:'' }) ,_RSTYPE:'combobox' ,_RSFIELD:'resultset' ,_RSPARAM:$.json2str({ idField:'resource_uuid' ,textField:'resource_name' }) } }); */ $('#appname').html('应用系统:'+$.getSessionUser().appname); //注册双树控件 $.twotree({ id:'layout_twotree' ,srclabel:'可授权角色列表' ,destlabel:'已授权角色列表' ,srcurl:'wdk?action=wdk.pub&method=call_service&ajaxparam='+new Date().getTime() ,srcQueryParams:{ _SRVNAME:'service.usr.authorization' ,_SRVMETHOD:'queryUnAuthedRoleListByAccID' ,_DATA:$.json2str({ op_account_uuid:$.getSessionUser().account_id ,manage_unit_uuid:_manage_unit_uuid ,org_uuid:_depart_uuid ,account_uuid:_account_uuid ,app_uuid:$.getSessionUser().appuuid ,resultfields:'' ,orderfields:'' }) ,_RSTYPE:'tree' ,_RSFIELD:'resultset' ,_RSPARAM:$.json2str({ idField:'role_uuid' ,textField:'role_name' ,parentField:'app_uuid' }) } ,desturl:'wdk?action=wdk.pub&method=call_service&ajaxparam='+new Date().getTime() ,destQueryParams:{ _SRVNAME:'service.usr.authorization' ,_SRVMETHOD:'queryAuthedRoleListByAccID' ,_DATA:$.json2str({ op_account_uuid:$.getSessionUser().account_id ,manage_unit_uuid:_manage_unit_uuid ,org_uuid:_depart_uuid ,account_uuid:_account_uuid ,app_uuid:$.getSessionUser().appuuid ,resultfields:'' ,orderfields:'' }) ,_RSTYPE:'tree' ,_RSFIELD:'resultset' ,_RSPARAM:$.json2str({ idField:'role_uuid' ,textField:'role_name' ,parentField:'app_uuid' }) } ,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() { //获取右边树的所有选中节点ID var nodes = $.twotree_getNode({id:'layout_twotree',srcordest:'dest'}); $.wait_open('关联角色中...'); if(!nodes){ nodes = new Array(); } var infos = new Array(); nodes.forEach(function(node){ if(node.parentTId){ var info = new Object(); info.role_uuid = node.id; infos.push(info); } }); $.cuajax({ url:'wdk?action=wdk.pub&method=call_service&ajaxparam='+new Date().getTime(), method:"post", timeout:WDK_Timeout, data:{ _SRVNAME:'service.usr.authorization' ,_SRVMETHOD:'assignRoleToAcc' ,_DATA:$.json2str({ op_account_uuid:$.getSessionUser().account_id, manage_unit_uuid:_manage_unit_uuid, account_uuid:_account_uuid, org_uuid:_depart_uuid, roleaccount_info:infos }) }, 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(v){ $.setWinReturn(_wid,v); $.closeWin(_wid); } </script> </html>