menu.html 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
  3. <meta charset="utf-8">
  4. <head th:include="include :: header"></head>
  5. <body class="gray-bg">
  6. <div class="container-div">
  7. <div class="row">
  8. <div class="col-sm-12 select-info">
  9. <form id="operlog-form">
  10. <div class="select-list gd">
  11. <ul>
  12. <li>
  13. 菜单名称:<input type="text" name="menuName"/>
  14. </li>
  15. <li>
  16. 菜单状态:<select name="visible" th:with="type=${@dictService.selectDictData('sys_show_hide')}">
  17. <option value="">所有</option>
  18. <option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option>
  19. </select>
  20. </li>
  21. <li>
  22. <a class="btn btn-primary btn-rounded btn-sm" onclick="$.treeTable.search($('form').attr('id'))"><i class="fa fa-search"></i>&nbsp;搜索</a>
  23. </li>
  24. </ul>
  25. </div>
  26. </form>
  27. </div>
  28. <div class="btn-group hidden-xs" id="toolbar" role="group">
  29. <a class="btn btn-outline btn-success btn-rounded" onclick="$.operate.add(0)" shiro:hasPermission="system:menu:add">
  30. <i class="fa fa-plus"></i> 新增
  31. </a>
  32. </div>
  33. <div class="col-sm-12 select-info table-striped">
  34. <table id="bootstrap-table" data-mobile-responsive="true"></table>
  35. </div>
  36. </div>
  37. </div>
  38. <div th:include="include :: footer"></div>
  39. <script th:inline="javascript">
  40. var addFlag = [[${@permissionService.hasPermi('system:menu:add')}]];
  41. var editFlag = [[${@permissionService.hasPermi('system:menu:edit')}]];
  42. var removeFlag = [[${@permissionService.hasPermi('system:menu:remove')}]];
  43. var prefix = ctx + "system/menu"
  44. window.onload = function() {
  45. loading();
  46. };
  47. function loading() {
  48. var options = {
  49. id: "menuId",
  50. parentId: "parentId",
  51. expandAll: false,
  52. url: prefix + "/list",
  53. createUrl: prefix + "/add/{id}",
  54. updateUrl: prefix + "/edit/{id}",
  55. removeUrl: prefix + "/remove/{id}",
  56. modalName: "菜单",
  57. columns: [{
  58. title: '菜单名称',
  59. field: 'menuName',
  60. width: '20%',
  61. formatter: function(row, index) {
  62. if (row.icon == null || row == "") {
  63. return row.menuName;
  64. } else {
  65. return '<i class="' + row.icon + '"></i> <span class="nav-label">' + row.menuName + '</span>';
  66. }
  67. }
  68. },
  69. {
  70. field: 'orderNum',
  71. title: '排序',
  72. width: '10%',
  73. align: "center"
  74. },
  75. {
  76. field: 'url',
  77. title: '请求地址',
  78. width: '15%',
  79. align: "center"
  80. },
  81. {
  82. title: '类型',
  83. field: 'menuType',
  84. width: '10%',
  85. align: "center",
  86. formatter: function(item, index) {
  87. if (item.menuType == 'M') {
  88. return '<span class="label label-success">目录</span>';
  89. }
  90. else if (item.menuType == 'C') {
  91. return '<span class="label label-primary">菜单</span>';
  92. }
  93. else if (item.menuType == 'F') {
  94. return '<span class="label label-warning">按钮</span>';
  95. }
  96. }
  97. },
  98. {
  99. field: 'visible',
  100. title: '可见',
  101. width: '10%',
  102. align: "center",
  103. formatter: function(row, index) {
  104. if (row.visible == 0) {
  105. return '<span class="badge badge-primary">显示</span>';
  106. } else if (row.visible == 1) {
  107. return '<span class="badge badge-danger">隐藏</span>';
  108. }
  109. }
  110. },
  111. {
  112. field: 'perms',
  113. title: '权限标识',
  114. width: '15%',
  115. align: "center",
  116. },
  117. {
  118. title: '操作',
  119. width: '20%',
  120. align: "center",
  121. formatter: function(row, index) {
  122. var actions = [];
  123. actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.menuId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
  124. actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="#" onclick="$.operate.add(\'' + row.menuId + '\')"><i class="fa fa-plus"></i>新增</a> ');
  125. actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="remove(\'' + row.menuId + '\')"><i class="fa fa-remove"></i>删除</a>');
  126. return actions.join('');
  127. }
  128. }]
  129. };
  130. $.treeTable.init(options);
  131. }
  132. function remove(id) {
  133. $.modal.confirm("确定删除该条" + $.table._option.modalName + "信息吗?", function() {
  134. $.ajax({
  135. type : 'post',
  136. url: prefix + "/remove/" + id,
  137. success : function(result) {
  138. if (result.code == web_status.SUCCESS) {
  139. $.modal.alertSuccess(result.msg);
  140. $.treeTable.refresh();
  141. } else {
  142. $.modal.alertError(result.msg);
  143. }
  144. }
  145. });
  146. });
  147. }
  148. </script>
  149. </body>
  150. </html>