menu.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
  3. <head>
  4. <th:block th:include="include :: header('菜单列表')" />
  5. </head>
  6. <body class="gray-bg">
  7. <div class="container-div">
  8. <div class="row">
  9. <div class="col-sm-12 search-collapse">
  10. <form id="menu-form">
  11. <div class="select-list">
  12. <ul>
  13. <li>
  14. 菜单名称:<input type="text" name="menuName"/>
  15. </li>
  16. <li>
  17. 菜单状态:<select name="visible" th:with="type=${@dict.getType('sys_show_hide')}">
  18. <option value="">所有</option>
  19. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  20. </select>
  21. </li>
  22. <li>
  23. <a class="btn btn-primary btn-rounded btn-sm" onclick="$.treeTable.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
  24. <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
  25. </li>
  26. </ul>
  27. </div>
  28. </form>
  29. </div>
  30. <div class="btn-group-sm" id="toolbar" role="group">
  31. <a class="btn btn-success" onclick="$.operate.add(0)" shiro:hasPermission="system:menu:add">
  32. <i class="fa fa-plus"></i> 新增
  33. </a>
  34. <a class="btn btn-primary" onclick="$.operate.edit()" shiro:hasPermission="system:menu:edit">
  35. <i class="fa fa-edit"></i> 修改
  36. </a>
  37. <a class="btn btn-info" id="expandAllBtn">
  38. <i class="fa fa-exchange"></i> 展开/折叠
  39. </a>
  40. </div>
  41. <div class="col-sm-12 select-table table-striped">
  42. <table id="bootstrap-tree-table"></table>
  43. </div>
  44. </div>
  45. </div>
  46. <th:block th:include="include :: footer" />
  47. <script th:inline="javascript">
  48. var addFlag = [[${@permission.hasPermi('system:menu:add')}]];
  49. var editFlag = [[${@permission.hasPermi('system:menu:edit')}]];
  50. var removeFlag = [[${@permission.hasPermi('system:menu:remove')}]];
  51. var datas = [[${@dict.getType('sys_show_hide')}]];
  52. var prefix = ctx + "system/menu";
  53. $(function() {
  54. var options = {
  55. code: "menuId",
  56. parentCode: "parentId",
  57. uniqueId: "menuId",
  58. expandAll: false,
  59. expandFirst: false,
  60. url: prefix + "/list",
  61. createUrl: prefix + "/add/{id}",
  62. updateUrl: prefix + "/edit/{id}",
  63. removeUrl: prefix + "/remove/{id}",
  64. modalName: "菜单",
  65. columns: [{
  66. field: 'selectItem',
  67. radio: true
  68. },
  69. {
  70. title: '菜单名称',
  71. field: 'menuName',
  72. width: '20',
  73. widthUnit: '%',
  74. formatter: function(value, row, index) {
  75. if ($.common.isEmpty(row.icon)) {
  76. return row.menuName;
  77. } else {
  78. return '<i class="' + row.icon + '"></i> <span class="nav-label">' + row.menuName + '</span>';
  79. }
  80. }
  81. },
  82. {
  83. field: 'orderNum',
  84. title: '排序',
  85. width: '10',
  86. widthUnit: '%',
  87. align: "left"
  88. },
  89. {
  90. field: 'url',
  91. title: '请求地址',
  92. width: '15',
  93. widthUnit: '%',
  94. align: "left",
  95. formatter: function(value, row, index) {
  96. return $.table.tooltip(value);
  97. }
  98. },
  99. {
  100. title: '类型',
  101. field: 'menuType',
  102. width: '10',
  103. widthUnit: '%',
  104. align: "left",
  105. formatter: function(value, item, index) {
  106. if (item.menuType == 'M') {
  107. return '<span class="label label-success">目录</span>';
  108. }
  109. else if (item.menuType == 'C') {
  110. return '<span class="label label-primary">菜单</span>';
  111. }
  112. else if (item.menuType == 'F') {
  113. return '<span class="label label-warning">按钮</span>';
  114. }
  115. }
  116. },
  117. {
  118. field: 'visible',
  119. title: '可见',
  120. width: '10',
  121. widthUnit: '%',
  122. align: "left",
  123. formatter: function(value, row, index) {
  124. if (row.menuType == 'F') {
  125. return '-';
  126. }
  127. return $.table.selectDictLabel(datas, row.visible);
  128. }
  129. },
  130. {
  131. field: 'perms',
  132. title: '权限标识',
  133. width: '15',
  134. widthUnit: '%',
  135. align: "left",
  136. formatter: function(value, row, index) {
  137. return $.table.tooltip(value);
  138. }
  139. },
  140. {
  141. title: '操作',
  142. width: '20',
  143. widthUnit: '%',
  144. align: "left",
  145. formatter: function(value, row, index) {
  146. var actions = [];
  147. actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.menuId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
  148. actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="javascript:void(0)" onclick="$.operate.add(\'' + row.menuId + '\')"><i class="fa fa-plus"></i>新增</a> ');
  149. actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.menuId + '\')"><i class="fa fa-trash"></i>删除</a>');
  150. return actions.join('');
  151. }
  152. }]
  153. };
  154. $.treeTable.init(options);
  155. });
  156. </script>
  157. </body>
  158. </html>