groupList.blade.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. @extends('admin.layouts')
  2. @section('css')
  3. <link rel="stylesheet" href="/assets/global/vendor/bootstrap-table/bootstrap-table.min.css">
  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. <button class="btn btn-primary" onclick="addGroup()"><i class="icon wb-plus"></i>添加分组</button>
  12. </div>
  13. </div>
  14. <div class="panel-body">
  15. <table class="text-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. <button class="btn btn-primary" onclick="editGroup('{{$group->id}}')"><i class="icon wb-edit"></i></button>
  38. <button class="btn btn-danger" onclick="delGroup('{{$group->id}}')"><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-md-4 col-sm-4">
  50. 共 {{$groupList->total()}} 个节点分组
  51. </div>
  52. <div class="col-md-8 col-sm-8">
  53. <div class="Page navigation float-right">
  54. {{ $groupList->links() }}
  55. </div>
  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"></script>
  64. <script src="/assets/global/vendor/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js"></script>
  65. <script type="text/javascript">
  66. // 添加节点分组
  67. function addGroup() {
  68. window.location.href = '/admin/addGroup';
  69. }
  70. // 编辑节点分组
  71. function editGroup(id) {
  72. window.location.href = '/admin/editGroup/' + id;
  73. }
  74. // 删除节点分组
  75. function delGroup(id) {
  76. swal.fire({
  77. title: '警告',
  78. text: '确定删除分组?',
  79. type: 'warning',
  80. showCancelButton: true,
  81. cancelButtonText: '{{trans('home.ticket_close')}}',
  82. confirmButtonText: '{{trans('home.ticket_confirm')}}',
  83. }).then((result) => {
  84. if (result.value) {
  85. $.post("/admin/delGroup/" + id, {_token: '{{csrf_token()}}'}, function (ret) {
  86. if (ret.status === 'success') {
  87. swal.fire({title: ret.message, type: 'success', timer: 1000, showConfirmButton: false})
  88. .then(() => window.location.reload())
  89. } else {
  90. swal.fire({title: ret.message, type: "error"}).then(() => window.location.reload())
  91. }
  92. });
  93. }
  94. });
  95. }
  96. </script>
  97. @endsection