tree.html 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
  3. <head>
  4. <th:block th:include="include :: header('菜单树选择')" />
  5. <th:block th:include="include :: ztree-css" />
  6. </head>
  7. <style>
  8. body{height:auto;font-family: "Microsoft YaHei";}
  9. button{font-family: "SimSun","Helvetica Neue",Helvetica,Arial;}
  10. </style>
  11. <body class="hold-transition box box-main">
  12. <input id="treeId" name="treeId" type="hidden" th:value="${menu.menuId}"/>
  13. <input id="treeName" name="treeName" type="hidden" th:value="${menu.menuName}"/>
  14. <div class="wrapper"><div class="treeShowHideButton" onclick="$.tree.toggleSearch();">
  15. <label id="btnShow" title="显示搜索" style="display:none;">︾</label>
  16. <label id="btnHide" title="隐藏搜索">︽</label>
  17. </div>
  18. <div class="treeSearchInput" id="search">
  19. <label for="keyword">关键字:</label><input type="text" class="empty" id="keyword" maxlength="50">
  20. <button class="btn" id="btn" onclick="$.tree.searchNode()"> 搜索 </button>
  21. </div>
  22. <div class="treeExpandCollapse">
  23. <a href="#" onclick="$.tree.expand()">展开</a> /
  24. <a href="#" onclick="$.tree.collapse()">折叠</a>
  25. </div>
  26. <div id="tree" class="ztree treeselect"></div>
  27. </div>
  28. <th:block th:include="include :: footer" />
  29. <th:block th:include="include :: ztree-js" />
  30. <script th:inline="javascript">
  31. $(function() {
  32. var url = ctx + "system/menu/menuTreeData";
  33. var options = {
  34. url: url,
  35. expandLevel: 1,
  36. onClick : zOnClick
  37. };
  38. $.tree.init(options);
  39. });
  40. function zOnClick(event, treeId, treeNode) {
  41. var treeId = treeNode.id;
  42. var treeName = treeNode.name;
  43. $("#treeId").val(treeId);
  44. $("#treeName").val(treeName);
  45. }
  46. </script>
  47. </body>
  48. </html>