tree.html.vm 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
  3. <head>
  4. <th:block th:include="include :: header('${functionName}树选择')" />
  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. #set($treeId = "${className}?." + $treeCode)
  13. #set($treeName = "${className}?." + $treeName)
  14. <input id="treeId" name="treeId" type="hidden" th:value="${${treeId}}"/>
  15. <input id="treeName" name="treeName" type="hidden" th:value="${${treeName}}"/>
  16. <div class="wrapper"><div class="treeShowHideButton" onclick="$.tree.toggleSearch();">
  17. <label id="btnShow" title="显示搜索" style="display:none;">︾</label>
  18. <label id="btnHide" title="隐藏搜索">︽</label>
  19. </div>
  20. <div class="treeSearchInput" id="search">
  21. <label for="keyword">关键字:</label><input type="text" class="empty" id="keyword" maxlength="50">
  22. <button class="btn" id="btn" onclick="$.tree.searchNode()"> 搜索 </button>
  23. </div>
  24. <div class="treeExpandCollapse">
  25. <a href="#" onclick="$.tree.expand()">展开</a> /
  26. <a href="#" onclick="$.tree.collapse()">折叠</a>
  27. </div>
  28. <div id="tree" class="ztree treeselect"></div>
  29. </div>
  30. <th:block th:include="include :: footer" />
  31. <th:block th:include="include :: ztree-js" />
  32. <script th:inline="javascript">
  33. $(function() {
  34. var url = ctx + "${moduleName}/${businessName}/treeData";
  35. var options = {
  36. url: url,
  37. expandLevel: 2,
  38. onClick : zOnClick
  39. };
  40. $.tree.init(options);
  41. });
  42. function zOnClick(event, treeId, treeNode) {
  43. var treeId = treeNode.id;
  44. var treeName = treeNode.name;
  45. $("#treeId").val(treeId);
  46. $("#treeName").val(treeName);
  47. }
  48. </script>
  49. </body>
  50. </html>