ztree.html 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>添加管理员</title>
  6. <meta name="renderer" content="webkit">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  8. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  9. <link rel="stylesheet" href="../../static/css/font.css">
  10. <link rel="stylesheet" href="../../static/css/weadmin.css">
  11. <link rel="stylesheet" href="../../static/css/style.css">
  12. <link rel="stylesheet" href="../../static/css/zTreeStyle.css">
  13. <!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
  14. <!--[if lt IE 9]>
  15. <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
  16. <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
  17. <![endif]-->
  18. <style>
  19. .layui-input-inline input, .layui-input-inline textarea{
  20. width: 300px;
  21. }
  22. html{
  23. overflow-y: auto;
  24. }
  25. </style>
  26. </head>
  27. <body>
  28. <div class="weadmin-body">
  29. <ul id="treeDemo" class="ztree"></ul>
  30. </div>
  31. <script src="../../lib/layui/layui.js" charset="utf-8"></script>
  32. <script src="../../static/js/jquery1.7.2.js"></script>
  33. <script src="../../static/js/ztree/jquery.ztree.core.js"></script>
  34. <script src="../../static/js/ztree/jquery.ztree.excheck.js"></script>
  35. <script type="text/javascript">
  36. layui.extend({
  37. admin: '{/}../../static/js/admin'
  38. });
  39. layui.use(['form','layer','admin','jquery'], function(){
  40. var form = layui.form,
  41. admin = layui.admin,
  42. layer = layui.layer,
  43. $=layui.jquery;
  44. form.render();
  45. var setting = {
  46. check: {
  47. enable: true,
  48. chkStyle: "radio",
  49. radioType: "level"
  50. },
  51. data: {
  52. simpleData: {
  53. enable: true
  54. }
  55. }
  56. };
  57. var zNodes =[
  58. { id:1, pId:0, name:"can check 1", open:true},
  59. { id:11, pId:1, name:"can check 1-1", open:true},
  60. { id:111, pId:11, name:"can check 1-1-1"},
  61. { id:112, pId:11, name:"can check 1-1-2"},
  62. { id:12, pId:1, name:"can check 1-2", open:true},
  63. { id:121, pId:12, name:"can check 1-2-1"},
  64. { id:122, pId:12, name:"can check 1-2-2"},
  65. { id:2, pId:0, name:"can check 2", checked:true, open:true},
  66. { id:21, pId:2, name:"can check 2-1"},
  67. { id:22, pId:2, name:"can check 2-2", open:true},
  68. { id:221, pId:22, name:"can check 2-2-1", checked:true},
  69. { id:222, pId:22, name:"can check 2-2-2"},
  70. { id:23, pId:2, name:"can check 2-3"}
  71. ];
  72. $.fn.zTree.init($("#treeDemo"), setting, zNodes);
  73. });
  74. </script>
  75. </body>
  76. </html>