groupList.blade.php 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. @extends('admin.layouts')
  2. @section('css')
  3. <link href="/assets/global/vendor/bootstrap-table/bootstrap-table.min.css" type="text/css" rel="stylesheet">
  4. @endsection
  5. @section('content')
  6. <div class="page-content container-fluid">
  7. <div class="panel">
  8. <div class="panel-heading">
  9. <h3 class="panel-title">节点分组</h3>
  10. <div class="panel-actions">
  11. <a href="/admin/addGroup" class="btn btn-primary"><i class="icon wb-plus"></i>添加分组</a>
  12. </div>
  13. </div>
  14. <div class="panel-body">
  15. <table class="text-md-center" data-toggle="table" data-mobile-responsive="true">
  16. <thead class="thead-default">
  17. <tr>
  18. <th> #</th>
  19. <th> 分组名称</th>
  20. <th> 分组级别</th>
  21. <th> 操作</th>
  22. </tr>
  23. </thead>
  24. <tbody>
  25. @if($groupList->isEmpty())
  26. <tr>
  27. <td colspan="4">暂无数据</td>
  28. </tr>
  29. @else
  30. @foreach($groupList as $group)
  31. <tr>
  32. <td> {{$group->id}} </td>
  33. <td> {{$group->name}} </td>
  34. <td> {{$levelMap[$group->level]}} </td>
  35. <td>
  36. <div class="btn-group">
  37. <a href="/admin/editGroup/{{$group->id}}" class="btn btn-primary"><i class="icon wb-edit"></i></a>
  38. <button class="btn btn-danger" onclick="delGroup('{{$group->id}}','{{$group->name}}')"><i class="icon wb-trash"></i></button>
  39. </div>
  40. </td>
  41. </tr>
  42. @endforeach
  43. @endif
  44. </tbody>
  45. </table>
  46. </div>
  47. <div class="panel-footer">
  48. <div class="row">
  49. <div class="col-sm-4">
  50. 共 <code>{{$groupList->total()}}</code> 个节点分组
  51. </div>
  52. <div class="col-sm-8">
  53. <nav class="Page navigation float-right">
  54. {{$groupList->links()}}
  55. </nav>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. @endsection
  62. @section('script')
  63. <script src="/assets/global/vendor/bootstrap-table/bootstrap-table.min.js" type="text/javascript"></script>
  64. <script src="/assets/global/vendor/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js" type="text/javascript"></script>
  65. <script type="text/javascript">
  66. // 删除节点分组
  67. function delGroup(id, name) {
  68. swal.fire({
  69. title: '警告',
  70. text: '确定删除分组 【' + name + '】 ?',
  71. type: 'warning',
  72. showCancelButton: true,
  73. cancelButtonText: '{{trans('home.ticket_close')}}',
  74. confirmButtonText: '{{trans('home.ticket_confirm')}}',
  75. }).then((result) => {
  76. if (result.value) {
  77. $.post("/admin/delGroup/" + id, {_token: '{{csrf_token()}}'}, function (ret) {
  78. if (ret.status === 'success') {
  79. swal.fire({title: ret.message, type: 'success', timer: 1000, showConfirmButton: false})
  80. .then(() => window.location.reload())
  81. } else {
  82. swal.fire({title: ret.message, type: "error"}).then(() => window.location.reload())
  83. }
  84. });
  85. }
  86. });
  87. }
  88. </script>
  89. @endsection