roleSet-old.jsp 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <%@include file="/context/mytags.jsp"%>
  3. <script type="text/javascript">
  4. $(function() {
  5. $('#functionid').tree(
  6. {
  7. checkbox : true,
  8. url : 'roleController.do?setAuthority&roleId=${roleId}',
  9. onLoadSuccess : function(node) {
  10. expandAll();
  11. },
  12. onClick : function(node) {
  13. var isRoot = $('#functionid').tree('getChildren',node.target);
  14. if (isRoot == '') {
  15. var roleId = $("#rid").val();
  16. $('#operationListpanel').panel(
  17. "refresh",
  18. "roleController.do?operationListForFunction&functionId="+ node.id + "&roleId=" + roleId);
  19. $('#dataRuleListpanel').panel(
  20. "refresh",
  21. "roleController.do?dataRuleListForFunction&functionId="+ node.id + "&roleId=" + roleId);
  22. } else {
  23. }
  24. }
  25. });
  26. $("#functionListPanel").panel({
  27. title : '<t:mutiLang langKey="menu.list"/>',
  28. tools : [ {
  29. iconCls : 'icon-save',
  30. handler : function() {
  31. mysubmit();
  32. }
  33. } ]
  34. });
  35. $("#operationListpanel").panel({
  36. title : '<t:mutiLang langKey="operate.manage"/>',
  37. tools : [ {
  38. iconCls : 'icon-save',
  39. handler : function() {
  40. submitOperation();
  41. }
  42. } ]
  43. });
  44. $("#dataRuleListpanel").panel({
  45. title : '数据规则权限',
  46. tools : [ {
  47. iconCls : 'icon-save',
  48. handler : function() {
  49. submitDataRule();
  50. }
  51. } ]
  52. });
  53. });
  54. function mysubmit() {
  55. var roleId = $("#rid").val();
  56. var s = GetNode();
  57. doSubmit("roleController.do?updateAuthority&rolefunctions=" + s
  58. + "&roleId=" + roleId);
  59. }
  60. function GetNode() {
  61. var node = $('#functionid').tree('getChecked');
  62. var cnodes = '';
  63. var pnodes = '';
  64. var pnode = null; //保存上一步所选父节点
  65. for ( var i = 0; i < node.length; i++) {
  66. if ($('#functionid').tree('isLeaf', node[i].target)) {
  67. cnodes += node[i].id + ',';
  68. pnode = $('#functionid').tree('getParent', node[i].target); //获取当前节点的父节点
  69. while (pnode != null) {//添加全部父节点
  70. pnodes += pnode.id + ',';
  71. pnode = $('#functionid').tree('getParent', pnode.target);
  72. }
  73. }
  74. }
  75. cnodes = cnodes.substring(0, cnodes.length - 1);
  76. pnodes = pnodes.substring(0, pnodes.length - 1);
  77. return cnodes + "," + pnodes;
  78. };
  79. function expandAll() {
  80. var node = $('#functionid').tree('getSelected');
  81. if (node) {
  82. $('#functionid').tree('expandAll', node.target);
  83. } else {
  84. $('#functionid').tree('expandAll');
  85. }
  86. }
  87. function selecrAll() {
  88. var node = $('#functionid').tree('getRoots');
  89. for ( var i = 0; i < node.length; i++) {
  90. var childrenNode = $('#functionid').tree('getChildren',
  91. node[i].target);
  92. for ( var j = 0; j < childrenNode.length; j++) {
  93. $('#functionid').tree("check", childrenNode[j].target);
  94. }
  95. }
  96. }
  97. function reset() {
  98. $('#functionid').tree('reload');
  99. }
  100. $('#selecrAllBtn').linkbutton({});
  101. $('#resetBtn').linkbutton({});
  102. </script>
  103. <div class="easyui-layout" fit="true">
  104. <div region="center" style="padding: 1px;">
  105. <div class="easyui-panel" style="padding: 1px;" fit="true" border="false" id="functionListPanel">
  106. <input type="hidden" name="roleId" value="${roleId}" id="rid">
  107. <a id="selecrAllBtn" onclick="selecrAll();"><t:mutiLang langKey="select.all" /></a>
  108. <a id="resetBtn" onclick="reset();"><t:mutiLang langKey="common.reset" /></a>
  109. <ul id="functionid"></ul>
  110. </div>
  111. </div>
  112. <div region="east" style="width: 300px; overflow: hidden;" split="true">
  113. <div class="easyui-layout" fit="true">
  114. <div region="center" style="padding: 1px; border: 0px;">
  115. <div class="easyui-panel" style="padding: 1px;" fit="true" border="false" id="operationListpanel"></div>
  116. </div>
  117. <div region="east" style="width: 150px; overflow: hidden;" split="true">
  118. <div class="easyui-panel" style="padding: 1px;" fit="true" border="false" id="dataRuleListpanel"></div>
  119. </div>
  120. </div>
  121. </div>
  122. </div>