index.html 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. {extend name="layout/content" /} {block name="header"}
  2. <title>菜单列表</title>
  3. <link rel="stylesheet" href="/static/js/treeTable/treeTable.css">
  4. <style>
  5. .x-body>.toolWrap {
  6. float: right;
  7. margin-bottom: 10px;
  8. }
  9. form>.toolWrap {
  10. float: left;
  11. margin-bottom: 10px;
  12. }
  13. .layui-table th {
  14. text-align: center !important;
  15. }
  16. .layui-table td:nth-of-type(1),
  17. .layui-table td:nth-of-type(3) {
  18. text-align: left !important;
  19. }
  20. </style>
  21. {/block} {block name="content"}
  22. <div class="x-body">
  23. <div class="toolWrap">
  24. {if(authUI('admin/menu/add'))}
  25. <a href="{:url('add')}" class="layui-btn layui-btn-radius">
  26. <i class="layui-icon">&#xe654;</i>添加菜单</a>
  27. {/if}
  28. </div>
  29. <form action="{:url('index')}" method="post">
  30. <div class="toolWrap">
  31. <button class="layui-btn" lay-submit lay-filter="formDemo">排序</button>
  32. </div>
  33. <table class="layui-table" id="menus-table">
  34. <thead>
  35. <tr>
  36. <th>排序</th>
  37. <th>ID</th>
  38. <th>名称</th>
  39. <th>规则</th>
  40. <th>状态</th>
  41. <th>操作</th>
  42. </tr>
  43. </thead>
  44. <tbody>
  45. {$category}
  46. </tbody>
  47. </table>
  48. </form>
  49. </div>
  50. {/block} {block name="footer"}
  51. <script src="/static/js/treeTable/treeTable.js"></script>
  52. <script>
  53. $(document).ready(function () {
  54. $("#menus-table").treeTable({
  55. indent: 20
  56. });
  57. // 为操作里的a标签添加样式
  58. $('td a').each(function (index, item) {
  59. if (item.innerHTML == '添加子菜单') {
  60. $(item).addClass("layui-btn layui-btn-normal")
  61. }
  62. if (item.innerHTML == '编辑') {
  63. $(item).addClass("layui-btn")
  64. }
  65. if (item.innerHTML == ' 删除 ') {
  66. $(item).addClass("layui-btn layui-btn-danger")
  67. }
  68. })
  69. });
  70. </script>
  71. {/block}