nodeRoleSet.jsp 3.8 KB

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