5fef07bfbe9bb50dd48481651a43c348cb6494df.svn-base 6.7 KB

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