index.html 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <article class="cl pd-20">
  2. <div class="cl pd-5 bg-1 bk-gray">
  3. <span class="l">
  4. <a href="javascript:;" onclick="del_all()" class="btn btn-danger radius">
  5. <i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>
  6. <a class="btn btn-primary radius" href="javascript:save(0);">
  7. <i class="Hui-iconfont">&#xe600;</i> 添加角色</a>
  8. </span>
  9. <span class="r">共有数据:<strong>{$list|count}</strong> 条</span>
  10. </div>
  11. <div class="mt-10">
  12. <table class="table table-border table-bordered table-hover table-bg">
  13. <thead>
  14. <tr>
  15. <th scope="col" colspan="6">角色管理</th>
  16. </tr>
  17. <tr class="text-c">
  18. <th width="25">
  19. <input type="checkbox" value="" name="">
  20. </th>
  21. <th width="40px">ID</th>
  22. <th width="120px">角色名称</th>
  23. <th>权限(menu_ids)</th>
  24. <th width="160px">备注</th>
  25. <th width="80px">操作</th>
  26. </tr>
  27. </thead>
  28. <tbody>
  29. {foreach $list as $val}
  30. <tr class="text-c">
  31. <td>
  32. <input type="checkbox" value="{$val.roleid}" name="checkbox[]">
  33. </td>
  34. <td>{$val.roleid}</td>
  35. <td>{$val.name}</td>
  36. <td>{$val.permissions}</td>
  37. <td>{$val.remark}</td>
  38. <td class="f-14">
  39. <a title="编辑" href="javascript:save({$val.roleid});" style="text-decoration:none">
  40. <i class="Hui-iconfont">&#xe6df;</i>
  41. </a>
  42. <a title="删除" href="javascript:;" onclick="del(this,'{$val.roleid}')" class="ml-5"
  43. style="text-decoration:none">
  44. <i class="Hui-iconfont">&#xe6e2;</i>
  45. </a>
  46. </td>
  47. </tr>
  48. {/foreach}
  49. </tbody>
  50. </table>
  51. </div>
  52. </article>
  53. <!--请在下方写此页面业务相关的脚本-->
  54. <script type="text/javascript">
  55. function save(id) {
  56. var title = id==0 ? '添加角色' : '修改角色'
  57. var url = "{:url('save')}" + "?_layer=true&id=" + id
  58. layer_show(title, url, 800, 700);
  59. }
  60. // 删除条目
  61. function del(obj, id) {
  62. layer.confirm('确认要删除吗?', function (index) {
  63. $.post('delete', {
  64. 'id': id
  65. }, function (data) {
  66. if (data.code == 1) {
  67. $(obj).parents("tr").remove();
  68. layer.msg(data.msg, {
  69. icon: 1,
  70. time: 1000
  71. });
  72. } else {
  73. layer.msg(data.msg, {
  74. icon: 5,
  75. time: 2000
  76. });
  77. return false;
  78. }
  79. }, 'json');
  80. });
  81. }
  82. // 批量删除
  83. function del_all() {
  84. var checkbox = $('.text-c input[name="checkbox[]"]');
  85. var ids = new Array();
  86. checkbox.each(function (x) {
  87. if (this.checked)
  88. ids.push(this.value);
  89. })
  90. console.log(ids);
  91. layer.confirm('确认要删除吗?', function (index) {
  92. $.post('delete', {
  93. 'id': ids
  94. }, function (data) {
  95. if (data.code == 1) {
  96. layer.msg(data.msg, {
  97. icon: 1,
  98. time: 1000
  99. });
  100. checkbox.each(function (x) {
  101. if (this.checked)
  102. $(this).parents("tr").remove();
  103. })
  104. } else {
  105. layer.msg(data.msg, {
  106. icon: 5,
  107. time: 1000
  108. });
  109. }
  110. }, 'json')
  111. });
  112. }
  113. </script>
  114. <!--请在上方写此页面业务相关的脚本-->