sysUserGradeDialog.jsp 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. <%@page pageEncoding="UTF-8" import="com.hotent.platform.model.system.SysUser"%>
  2. <%@include file="/commons/include/html_doctype.html"%>
  3. <html>
  4. <head>
  5. <title>选择用户 </title>
  6. <%@include file="/commons/include/form.jsp" %>
  7. <f:link href="tree/zTreeStyle.css"></f:link>
  8. <script type="text/javascript" src="${ctx}/js/tree/jquery.ztree.js"></script>
  9. <script type="text/javascript">
  10. var dialog = frameElement.dialog; //调用页面的dialog对象(ligerui对象)
  11. var isSingle=${isSingle};
  12. var org_Tree=null;
  13. var accordion = null;
  14. //树展开层数
  15. var expandDepth = 1;
  16. forbidF5("Chrome");//禁止刷新页面
  17. $(function(){
  18. //布局
  19. $("#defLayout").ligerLayout({
  20. leftWidth: 220,
  21. rightWidth: 170,
  22. bottomHeight :40,
  23. height: '90%',
  24. allowBottomResize:false,
  25. allowLeftCollapse:false,
  26. allowRightCollapse:false,
  27. onHeightChanged: heightChanged,
  28. minLeftWidth:200,
  29. allowLeftResize:false
  30. });
  31. var findStr = '';
  32. //快速查找
  33. $("input.quick-find").bind('keyup',function(){
  34. var str = $(this).val();
  35. if(!str)return;
  36. if(str==findStr)return;
  37. findStr = str;
  38. var tbody = $("#userList"),
  39. firstTr = $('tr.hidden',tbody);
  40. $("tr",tbody).each(function(){
  41. var me = $(this),
  42. span = $('span',me),
  43. spanStr = span.html();
  44. if(!spanStr)return true;
  45. if(spanStr.indexOf(findStr)>-1){
  46. $(this).insertAfter(firstTr);
  47. }
  48. });
  49. });
  50. var height = $(".l-layout-center").height();
  51. $("#leftMemu").ligerAccordion({ height: height-28, speed: null });
  52. accordion = $("#leftMemu").ligerGetAccordionManager();
  53. load_Org_Tree();
  54. heightChanged();
  55. handleSelects();
  56. });
  57. function heightChanged(options){
  58. if(options){
  59. if (accordion && options.middleHeight - 28 > 0){
  60. $("#SEARCH_BY_ROL").height(options.middleHeight - 183);
  61. $("#SEARCH_BY_ORG").height(options.middleHeight - 163);
  62. $("#SEARCH_BY_POS").height(options.middleHeight - 140);
  63. $("#SEARCH_BY_ONL").height(options.middleHeight -163);
  64. accordion.setHeight(options.middleHeight - 28);
  65. }
  66. }else{
  67. var height = $(".l-layout-center").height();
  68. $("#SEARCH_BY_ROL").height(height - 183);
  69. $("#SEARCH_BY_ORG").height(height - 163);
  70. $("#SEARCH_BY_POS").height(height - 140);
  71. $("#SEARCH_BY_ONL").height(height - 163);
  72. }
  73. }
  74. function setCenterTitle(title){
  75. $("#centerTitle").empty();
  76. $("#centerTitle").append(title);
  77. };
  78. function load_Org_Tree(){
  79. var orgId=$("#orgAuth").val();
  80. var setting = {
  81. data: {
  82. key : {
  83. name: "orgName",
  84. title: "orgName"
  85. }
  86. /* simpleData: {
  87. enable: true,
  88. idKey: "orgId",
  89. pIdKey: "orgSupId",
  90. rootPId: -1
  91. } */
  92. },
  93. callback:{
  94. onClick: function(event, treeId, treeNode){
  95. var url="${ctx}/platform/system/sysUser/selector.ht";
  96. var includSub=($("#includSub").attr("checked"))?1:0;
  97. var p="?isSingle=${isSingle}&searchBy=<%=SysUser.SEARCH_BY_ORG%>&orgId="+treeNode.orgId+"&includSub="+includSub+"&path="+treeNode.path;
  98. $("#userListFrame").attr("src",url+p);
  99. setCenterTitle("按组织查找:"+treeNode.orgName);
  100. },
  101. //onAsyncSuccess: orgTreeOnAsyncSuccess
  102. }
  103. };
  104. var url=__ctx + "/platform/system/grade/getOrgJsonByAuthOrgId.ht?orgId="+orgId;
  105. $.post(url,function(result) {
  106. if($.isEmpty(result)) return;
  107. var zNodes=eval("(" +result +")");
  108. org_Tree = $.fn.zTree.init($("#orgTreeId"),setting,zNodes);
  109. if(expandDepth!=0)
  110. {
  111. var nodes = org_Tree.getNodesByFilter(function(node){
  112. return (node.level < expandDepth);
  113. });
  114. if(nodes.length>0){
  115. for(var i=0;i<nodes.length;i++){
  116. org_Tree.expandNode(nodes[i],true,false);
  117. }
  118. }
  119. }else{
  120. org_Tree.expandAll(true);
  121. }
  122. });
  123. };
  124. //判断是否为子结点,以改变图标
  125. function orgTreeOnAsyncSuccess(event, treeId, treeNode, msg) {
  126. if(treeNode){
  127. var children=treeNode.children;
  128. if(children.length==0){
  129. treeNode.isParent=true;
  130. org_Tree = $.fn.zTree.getZTreeObj("SEARCH_BY_ORG");
  131. org_Tree.updateNode(treeNode);
  132. }
  133. }
  134. };
  135. function dellAll() {
  136. $("#sysUserList").empty();
  137. };
  138. function del(obj) {
  139. var tr = $(obj).parents("tr");
  140. $(tr).remove();
  141. };
  142. function add(data) {
  143. var aryTmp=data.split("#");
  144. var userId=aryTmp[0];
  145. var len= $("#user_" + userId).length;
  146. if(len>0) return;
  147. var aryData=['<tr id="user_'+userId+'">',
  148. '<td>',
  149. '<input type="hidden" class="pk" name="userData" value="'+data +'"><span> ',
  150. aryTmp[1],
  151. '</span></td>',
  152. '<td><a onclick="javascript:del(this);" class="link del" ></a> </td>',
  153. '</tr>'];
  154. $("#sysUserList").append(aryData.join(""));
  155. };
  156. function selectMulti(obj) {
  157. if ($(obj).attr("checked") == "checked"){
  158. var data = $(obj).val();
  159. add(data);
  160. }
  161. };
  162. function selectAll(obj) {
  163. var state = $(obj).attr("checked");
  164. var rtn=state == undefined?false:true;
  165. checkAll(rtn);
  166. };
  167. function checkAll(checked) {
  168. $("#userListFrame").contents().find("input[type='checkbox'][class='pk']").each(function() {
  169. $(this).attr("checked", checked);
  170. if (checked) {
  171. var data = $(this).val();
  172. add(data);
  173. }
  174. });
  175. };
  176. function clearUser(){
  177. /* window.returnValue = {
  178. userIds: '',
  179. fullnames: '',
  180. emails: '',
  181. mobiles: ''
  182. };
  183. window.close(); */
  184. var rtn={
  185. userIds: '',
  186. fullnames: '',
  187. emails: '',
  188. mobiles: ''
  189. };
  190. dialog.get("sucCall")(rtn);
  191. dialog.close();
  192. }
  193. function selectUser(){
  194. var chIds;
  195. if(isSingle==true){
  196. chIds = $('#userListFrame').contents().find(":input[name='userData'][checked]");
  197. }else{
  198. chIds = $("#sysUserList").find(":input[name='userData']");
  199. }
  200. var aryuserIds=new Array();
  201. var aryfullnames=new Array();
  202. var aryemails=new Array();
  203. var arymobiles=new Array();
  204. $.each(chIds,function(i,ch){
  205. var aryTmp=$(ch).val().split("#");
  206. aryuserIds.push(aryTmp[0]);
  207. aryfullnames.push(aryTmp[1]);
  208. aryemails.push(aryTmp[2]);
  209. arymobiles.push(aryTmp[3]);
  210. });
  211. var obj={userIds:aryuserIds.join(","),fullnames:aryfullnames.join(","),
  212. emails:aryemails.join(","),mobiles:arymobiles.join(",")};
  213. try{
  214. dialog.get("sucCall")(obj);
  215. }catch(e){
  216. }
  217. dialog.close();
  218. }
  219. var handleSelects=function(){
  220. var selectUsers =dialog.get("selectUsers");
  221. if(selectUsers.selectUserIds && selectUsers.selectUserNames){
  222. var ids=selectUsers.selectUserIds.split(",");
  223. var names=selectUsers.selectUserNames.split(",");
  224. for(var i=0;i<ids.length;i++){
  225. if(names[i]!=undefined&&names[i]!="undefined"&&names[i]!=null&&names[i]!=""){
  226. add(ids[i]+"#"+names[i]+"##");
  227. }
  228. }
  229. }
  230. }
  231. </script>
  232. <style type="text/css">
  233. .ztree {
  234. overflow: auto;
  235. }
  236. .label {
  237. color: #6F8DC6;
  238. text-align: right;
  239. padding-right: 6px;
  240. padding-left: 0px;
  241. font-weight: bold;
  242. }
  243. .quick-find {
  244. width:35px;
  245. }
  246. html { overflow-x: hidden; }
  247. .l-layout-right{left:511px;}
  248. .l-layout-left, .l-layout-center, .l-layout-right { height:90%;}
  249. .l-accordion-content { height:324px;}
  250. .l-accordion-content .ztree { height:285px;}
  251. </style>
  252. </head>
  253. <body>
  254. <div id="defLayout" style="height:100%;">
  255. <div id="leftMemu" position="left" title="查询条件<input type='checkbox' id='includSub'/>包含子分类" style="overflow: auto; float:left;width: 100%; height:95%">
  256. <div title="授权组" style="overflow: hidden;">
  257. <table border="0" width="100%" class="table-detail">
  258. <tr >
  259. <td style="width:100%;">
  260. <select id="orgAuth" onchange="load_Org_Tree()">
  261. <c:forEach var="orgAuth" items="${orgAuthList}">
  262. <option value="${orgAuth.orgId}" <c:if test="${orgAuth.dimId==1}">selected="selected"</c:if>>${orgAuth.orgName}—[${orgAuth.dimName}]</option>
  263. </c:forEach>
  264. </select>
  265. </td>
  266. </tr>
  267. </table>
  268. <div id="orgTreeId" class='ztree'></div>
  269. </div>
  270. </div>
  271. <c:forEach var="orgAuth" items="${orgAuthList}"> <c:if test="${orgAuth.dimId==1}"><c:set var="mainOrgId" value="${orgAuth.orgId}"></c:set></c:if></c:forEach>
  272. <div position="center">
  273. <div id="centerTitle" class="l-layout-header">全部用户</div>
  274. <iframe id="userListFrame" name="userListFrame" height="95%" width="100%" frameborder="0"
  275. src="${ctx}/platform/system/sysUser/selector.ht?isSingle=${isSingle}&searchBy=<%=SysUser.SEARCH_BY_ORG%>&orgId=${mainOrgId}&includSub=1"></iframe>
  276. </div>
  277. <c:if test="${isSingle==false}">
  278. <div position="right" style="overflow:auto;height:95%;width:170px;" title="<span><a onclick='javascript:dellAll();' class='link del'>清空 </a><input type='text' class='quick-find' title='查找'/></span>">
  279. <table width="145" id="sysUserList" class="table-grid table-list" id="0" cellpadding="1" cellspacing="1">
  280. <tbody id="userList">
  281. <tr class="hidden"></tr>
  282. </tbody>
  283. </table>
  284. </div>
  285. </c:if>
  286. </div>
  287. <div position="bottom" class="bottom" style="margin-top:10px;">
  288. <a href="javascript:;" class="button" onclick="selectUser()" style="margin-right:10px;" ><span class="icon ok"></span><span >选择</span></a>
  289. <a href="javascript:;" class="button" style="margin-left:10px;" onclick="dialog.close()"><span class="icon cancel"></span><span >取消</span></a>
  290. </div>
  291. </body>
  292. </html>