7ba363665a913813c2447294cb257371f811f914.svn-base 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <%
  3. String path = request.getContextPath();
  4. %>
  5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  6. <html xmlns="http://www.w3.org/1999/xhtml">
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  9. <title>基本表格模板</title>
  10. <!--框架必需start-->
  11. <script type="text/javascript" src="<%=path%>/libs/js/jquery.js"></script>
  12. <script type="text/javascript" src="<%=path%>/libs/js/language/cn.js"></script>
  13. <script type="text/javascript" src="<%=path%>/libs/js/framework.js"></script>
  14. <link href="<%=path%>/libs/css/import_basic.css" rel="stylesheet" type="text/css"/>
  15. <link rel="stylesheet" type="text/css" id="skin" prePath="<%=path%>/" scrollerY="false"/>
  16. <link rel="stylesheet" type="text/css" id="customSkin"/>
  17. <!--框架必需end-->
  18. <!--树组件start -->
  19. <script type="text/javascript" src="<%=path%>/libs/js/tree/ztree/ztree.js"></script>
  20. <link href="<%=path%>/libs/js/tree/ztree/ztree.css" rel="stylesheet" type="text/css"/>
  21. <!--树组件end -->
  22. <!-- 树形下拉框start -->
  23. <script type="text/javascript" src="<%=path%>/libs/js/form/selectTree.js"></script>
  24. <!-- 树形下拉框end -->
  25. <!-- 条件过滤器 start -->
  26. <script type="text/javascript" src="<%=path%>/libs/js/form/filter.js"></script>
  27. <!-- 条件过滤器 end -->
  28. </head>
  29. <body>
  30. <table width="100%" >
  31. <tr>
  32. <!--左侧区域start-->
  33. <td class="ver01" >
  34. <div class="box2" overflow="auto" showStatus="false" panelTitle="角色管理">
  35. <div id="cusBoxContent1" style="width:150px;">
  36. <div>
  37. <form>
  38. <table width="100%">
  39. <tr><td>新增角色</td></tr>
  40. <tr><td class="ali02"><input type="text" id="roleName" style="width:120px;"/></td></tr>
  41. <tr><td class="ali02"><input type="button" value="确定" onclick="addTreeNodeHandler()"/>&nbsp;<input type="reset" value="重置"/></td></tr>
  42. </table>
  43. </form>
  44. </div>
  45. <ul id="tree-1" class="ztree"></ul>
  46. </div>
  47. </div>
  48. </td>
  49. <!--左侧区域end-->
  50. <!--右侧区域start-->
  51. <td width="100%" class="ver01" >
  52. <div class="box2" panelTitle="条件过滤" showStatus="false">
  53. <table>
  54. <tr>
  55. <td>按部门筛选:</td>
  56. <td> <div class="selectTree" id="selectTree1"></div></td>
  57. </tr>
  58. </table>
  59. </div>
  60. <div class="box2" panelTitle="为角色分配成员" showStatus="false">
  61. <div id="cusBoxContent2" >
  62. <form>
  63. <table width="100%">
  64. <tr><td>
  65. <div class="filter" id="filter1" groupMode="true" data='{"list":[{"name":"部门1","list":[{"key":"员工1","value":"11"},{"key":"员工2","value":"12"},{"key":"员工3","value":"13"},{"key":"员工2","value":"12"},{"key":"员工3","value":"13"}]},{"name":"部门2","list":[{"key":"员工4","value":"21"},{"key":"员工5","value":"22"},{"key":"员工6","value":"23"}]},{"name":"部门3","list":[{"key":"员工1","value":"11"},{"key":"员工2","value":"12"},{"key":"员工3","value":"13"},{"key":"员工2","value":"12"},{"key":"员工3","value":"13"}]},{"name":"部门4","list":[{"key":"员工4","value":"21"},{"key":"员工5","value":"22"},{"key":"员工6","value":"23"}]}]}'></div>
  66. </td></tr>
  67. <tr><td class="ali02"><input type="button" value="确定"/>&nbsp;<input type="reset" value="重置" onclick="resetForm()"/></td></tr>
  68. </table>
  69. </form>
  70. </div>
  71. </div>
  72. </td>
  73. <!--右侧区域end-->
  74. </tr>
  75. </table>
  76. <script type="text/javascript">
  77. //选择的树节点
  78. var selectTreeNode = null;
  79. //树属性配置
  80. var selectionSetting = {
  81. view: {
  82. selectedMulti: false
  83. },
  84. edit: {
  85. enable: true,
  86. renameTitle:"修改",
  87. removeTitle:"删除"
  88. },
  89. callback: {
  90. //不允许拖拽
  91. beforeDrag: beforeDrag1,
  92. //修改前确认
  93. beforeEditName: beforeEditName1,
  94. //修改完时的处理
  95. beforeRename: beforeRename1,
  96. //修改成功后处理
  97. onRename: onRename1,
  98. //删除前确认
  99. beforeRemove: beforeRemove1
  100. }
  101. };
  102. var nodes1 = [
  103. { id:1, parentId:0, name:"角色列表", open: true,icon:"<%=path%>/libs/icons/list.gif"}
  104. ];
  105. var selectData ={"treeNodes":[
  106. { id:1, parentId:0, name:"中心1", open: true,icon:"<%=path%>/libs/icons/user_group.gif"},
  107. { id:11, parentId:1, name:"部门1",icon:"<%=path%>/libs/icons/user_group.gif"},
  108. { id:12, parentId:1, name:"部门2",icon:"<%=path%>/libs/icons/user_group.gif"},
  109. { id:13, parentId:1, name:"部门3",icon:"<%=path%>/libs/icons/user_group.gif"},
  110. { id:2, parentId:0, name:"中心2", open: true,icon:"<%=path%>/libs/icons/user_group.gif"},
  111. { id:21, parentId:2, name:"部门4",icon:"<%=path%>/libs/icons/user_group.gif"},
  112. { id:22, parentId:2, name:"部门5",icon:"<%=path%>/libs/icons/user_group.gif"},
  113. { id:23, parentId:2, name:"部门6",icon:"<%=path%>/libs/icons/user_group.gif"}
  114. ]};
  115. function initComplete(){
  116. //初始化tree
  117. $.fn.zTree.init($("#tree-1"), selectionSetting, nodes1);
  118. $("#selectTree1").data("data",selectData);
  119. $("#selectTree1").render();
  120. }
  121. function beforeDrag1(treeId, treeNodes) {
  122. return false;
  123. }
  124. //确认是否进入编辑状态
  125. function beforeEditName1(treeId, treeNode) {
  126. if(treeNode.id=="1"){
  127. top.Dialog.alert("根节点不能修改!");
  128. return false;
  129. }
  130. var zTree = $.fn.zTree.getZTreeObj("tree-1");
  131. //选中该节点
  132. zTree.selectNode(treeNode);
  133. zTree.editName(treeNode);
  134. return true;
  135. }
  136. //修改完时处理 不进行后台数据处理
  137. function beforeRename1(treeId, treeNode, newName) {
  138. if (newName.length == 0) {
  139. top.Dialog.alert("节点名称不能为空.");
  140. var zTree = $.fn.zTree.getZTreeObj("tree-1");
  141. setTimeout(function(){zTree.editName(treeNode)}, 10);
  142. return false;
  143. }
  144. return true;
  145. }
  146. //修改成功后处理
  147. function onRename1(event, treeId, treeNode) {
  148. //此处进行ajax后台数据处理
  149. }
  150. //确认是否删除+删除处理
  151. function beforeRemove1(treeId, treeNode) {
  152. if(treeNode.id=="1"){
  153. top.Dialog.alert("根节点不能删除!");
  154. return false;
  155. }
  156. var zTree = $.fn.zTree.getZTreeObj("tree-1");
  157. //选中该节点
  158. zTree.selectNode(treeNode);
  159. top.Dialog.confirm("确认删除 节点 -- " + treeNode.name + " 吗?",function(){
  160. zTree.removeNode(treeNode);
  161. //此处进行ajax后台数据处理
  162. });
  163. return false;
  164. }
  165. //添加树节点
  166. var newCount = 1;
  167. function addTreeNodeHandler(){
  168. var newName=$("#roleName").val();
  169. if(newName==""){
  170. top.Dialog.alert("请输入角色名称!");
  171. return;
  172. }
  173. var zTree = $.fn.zTree.getZTreeObj("tree-1");
  174. var treeNode=zTree.getNodeByParam("id", 1);
  175. if(treeNode){
  176. var newNode;
  177. newNode = zTree.addNodes(treeNode, {id:(100 + newCount), parentId:1, name:newName,icon:"<%=path%>/libs/icons/star.gif"});
  178. }
  179. $("#roleName").val("");
  180. }
  181. function resetForm(){
  182. $("#filter1").render();
  183. }
  184. //高度处理
  185. function customHeightSet(contentHeight){
  186. $("#cusBoxContent1").height(contentHeight-55)
  187. $("#cusBoxContent2").height(contentHeight-140)
  188. }
  189. </script>
  190. </body>
  191. </html>