index.html 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. {extend name='admin@main'}
  2. {block name="button"}
  3. {if auth("add")}
  4. <button data-modal='{:url("add")}' style="background-color: #DC2219" data-title="添加分类" class='layui-btn layui-btn-sm'>添加</button>
  5. {/if}
  6. {/block}
  7. <style>
  8. .color-desc {
  9. color: #999 !important;
  10. }
  11. </style>
  12. {block name="content"}
  13. <div class="think-box-shadow">
  14. <table class="layui-table margin-top-10">
  15. {notempty name='list'}
  16. <thead>
  17. <tr>
  18. <th class='text-left nowrap'>分类名称</th>
  19. <th class="text-center">状态</th>
  20. <th class="text-center">添加时间</th>
  21. <th class="text-center">操作</th>
  22. </tr>
  23. </thead>
  24. {/notempty}
  25. <tbody>
  26. {foreach $list as $key=>$vo}
  27. <tr>
  28. <td class='text-left nowrap' style="font-size: 13px;"
  29. onclick='if($(".tr_{$vo.id}").hasClass("t")){$(".tr_{$vo.id}").removeClass("t").show()}else{$(".tr_{$vo.id}").addClass("t").hide();$(".ptr_{$vo.id}").addClass("t").hide()}'>
  30. {$vo.title|default=''}
  31. {if count($vo['children']) > 0}
  32. <i class="layui-icon layui-icon-triangle-r margin-right-5"></i>
  33. {/if}
  34. </td>
  35. <td class='text-center nowrap'>
  36. {eq name='vo.status' value='0'}<span class="layui-badge">已禁用</span>{else}<span class="layui-badge layui-bg-green">使用中</span>{/eq}<br>
  37. </td>
  38. <td class='text-center nowrap'>{$vo.create_at|format_datetime}</td>
  39. <td class='text-center nowrap'>
  40. {if auth("add")}
  41. <span class="text-explode">|</span>
  42. <a class="layui-btn layui-btn-sm" style="background-color: #DC2219" data-title="添加" data-modal='{:url("add")}?pid={$vo.id}'>添 加</a>
  43. {/if}
  44. {if auth("edit")}
  45. <a data-dbclick class="layui-btn layui-btn-sm" style="background-color:#FFB822 " data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
  46. {/if}
  47. {if $vo.status eq 1 and auth("forbid")}
  48. <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('forbid')}" data-value="id#{$vo.id};status#0" data-csrf="{:systoken('forbid')}">禁 用</a>
  49. {elseif auth("resume")}
  50. <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('resume')}" data-value="id#{$vo.id};status#1" data-csrf="{:systoken('resume')}">启 用</a>
  51. {/if}
  52. {if auth("remove")}
  53. <a class="layui-btn layui-btn-sm layui-btn-danger" style="background-color: #5AD729" data-confirm="确定要删除数据吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}">删 除</a>
  54. {/if}
  55. </td>
  56. </tr>
  57. {foreach $vo['children'] as $k=>$v}
  58. <!-- <tr class="t tr_{$vo.id}" style="display: none">-->
  59. <tr class="t tr_{$vo.id}" >
  60. <td class='text-left nowrap' style="font-size: 13px;"
  61. onclick='if($(".tr_{$v.id}").hasClass("t")){$(".tr_{$v.id}").removeClass("t").show()}else{$(".tr_{$v.id}").addClass("t").hide()}'>
  62. <span class="color-desc" style="margin-left: 15px; margin-right: 10px">|-</span>
  63. {$v.title|default=''}
  64. {if count($v['children']) > 0}
  65. <i class="layui-icon layui-icon-triangle-r margin-right-5"></i>
  66. {/if}
  67. </td>
  68. <td class='text-center nowrap'>
  69. {eq name='v.status' value='0'}<span class="layui-badge">已禁用</span>{else}<span class="layui-badge layui-bg-green">使用中</span>{/eq}<br>
  70. </td>
  71. <td class='text-center nowrap'>{$v.create_at|format_datetime}</td>
  72. <td class='text-center nowrap'>
  73. {if auth("add")}
  74. <span class="text-explode">|</span>
  75. <a class="layui-btn layui-btn-sm layui-bg-red" data-title="添加" data-modal='{:url("add")}?pid={$v.id}'>添 加</a>
  76. {/if}
  77. {if auth("edit")}
  78. <a data-dbclick class="layui-btn layui-btn-sm" data-modal='{:url("edit")}?id={$v.id}&pid={$v.id}'>编 辑</a>
  79. {/if}
  80. {if $v.status eq 1 and auth("forbid")}
  81. <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('forbid')}" data-value="id#{$v.id};status#0" data-csrf="{:systoken('forbid')}">禁 用</a>
  82. {elseif auth("resume")}
  83. <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('resume')}" data-value="id#{$v.id};status#1" data-csrf="{:systoken('resume')}">启 用</a>
  84. {/if}
  85. {if auth("remove")}
  86. <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除数据吗?" data-action="{:url('remove')}" data-value="id#{$v.id}">删 除</a>
  87. {/if}
  88. </td>
  89. {foreach $v['children'] as $ck=>$cv}
  90. <tr class="t ptr_{$vo.id} tr_{$v.id}" >
  91. <td>
  92. <span class="color-desc" style="margin-left: 15px; margin-right: 10px">|- </span>
  93. <span class="color-desc" style="margin-left: 15px; margin-right: 10px;">|- </span>
  94. {$cv.title|default=''}
  95. </td>
  96. <td class='text-center nowrap'>
  97. {eq name='cv.status' value='0'}<span class="layui-badge">已禁用</span>{else}<span class="layui-badge layui-bg-green">使用中</span>{/eq}<br>
  98. </td>
  99. <td class='text-center nowrap'>{$cv.create_at|format_datetime}</td>
  100. <td class='text-center nowrap'>
  101. {if auth("add")}
  102. <span class="text-explode">|</span>
  103. <a class="layui-btn layui-btn-sm layui-btn-disabled">添 加</a>
  104. {/if}
  105. {if auth("edit")}
  106. <a data-dbclick class="layui-btn layui-btn-sm" data-modal='{:url("edit")}?id={$cv.id}&pid={$cv.id}'>编 辑</a>
  107. {/if}
  108. {if $cv.status eq 1 and auth("forbid")}
  109. <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('forbid')}" data-value="id#{$cv.id};status#0" >禁 用</a>
  110. {elseif auth("resume")}
  111. <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('resume')}" data-value="id#{$cv.id};status#1" >启 用</a>
  112. {/if}
  113. {if auth("remove")}
  114. <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除数据吗?" data-action="{:url('remove')}" data-value="id#{$cv.id}">删 除</a>
  115. {/if}
  116. </td>
  117. {/foreach}
  118. {/foreach}
  119. {/foreach}
  120. </tbody>
  121. </table>
  122. {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
  123. </div>
  124. {/block}