groupList.blade.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. @extends('admin.layouts')
  2. @section('css')
  3. <link href="/assets/global/plugins/datatables/datatables.min.css" rel="stylesheet" type="text/css" />
  4. <link href="/assets/global/plugins/datatables/plugins/bootstrap/datatables.bootstrap.css" rel="stylesheet" type="text/css" />
  5. @endsection
  6. @section('content')
  7. <!-- BEGIN CONTENT BODY -->
  8. <div class="page-content" style="padding-top:0;">
  9. <!-- BEGIN PAGE BASE CONTENT -->
  10. <div class="row">
  11. <div class="col-md-12">
  12. <!-- BEGIN EXAMPLE TABLE PORTLET-->
  13. <div class="portlet light bordered">
  14. <div class="portlet-title">
  15. <div class="caption font-dark">
  16. <span class="caption-subject bold uppercase"> 节点分组 </span>
  17. </div>
  18. <div class="actions">
  19. <div class="btn-group">
  20. <button class="btn sbold blue" onclick="addGroup()"> 添加分组 </button>
  21. </div>
  22. </div>
  23. </div>
  24. <div class="portlet-body">
  25. <div class="table-scrollable table-scrollable-borderless">
  26. <table class="table table-hover table-light">
  27. <thead>
  28. <tr>
  29. <th> # </th>
  30. <th> 分组名称 </th>
  31. <th> 分组级别 </th>
  32. <th style="text-align: center;"> 操作 </th>
  33. </tr>
  34. </thead>
  35. <tbody>
  36. @if($groupList->isEmpty())
  37. <tr>
  38. <td colspan="3" style="text-align: center;">暂无数据</td>
  39. </tr>
  40. @else
  41. @foreach($groupList as $group)
  42. <tr class="odd gradeX">
  43. <td> {{$group->id}} </td>
  44. <td> {{$group->name}} </td>
  45. <td> {{$levelMap[$group->level]}} </td>
  46. <td style="text-align: center;">
  47. <button type="button" class="btn btn-sm blue btn-outline" onclick="editGroup('{{$group->id}}')"> 编辑 </button>
  48. <button type="button" class="btn btn-sm red btn-outline" onclick="delGroup('{{$group->id}}')"> 删除 </button>
  49. </td>
  50. </tr>
  51. @endforeach
  52. @endif
  53. </tbody>
  54. </table>
  55. </div>
  56. <div class="row">
  57. <div class="col-md-4 col-sm-4">
  58. <div class="dataTables_info" role="status" aria-live="polite">共 {{$groupList->total()}} 个节点分组</div>
  59. </div>
  60. <div class="col-md-8 col-sm-8">
  61. <div class="dataTables_paginate paging_bootstrap_full_number pull-right">
  62. {{$groupList->links()}}
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. </div>
  68. <!-- END EXAMPLE TABLE PORTLET-->
  69. </div>
  70. </div>
  71. <!-- END PAGE BASE CONTENT -->
  72. </div>
  73. <!-- END CONTENT BODY -->
  74. @endsection
  75. @section('script')
  76. <script type="text/javascript">
  77. // 添加节点分组
  78. function addGroup() {
  79. window.location.href = '{{url('admin/addGroup')}}';
  80. }
  81. // 编辑节点分组
  82. function editGroup(id) {
  83. window.location.href = '{{url('admin/editGroup?id=')}}' + id + '&page=' + '{{Request::get('page', 1)}}';
  84. }
  85. // 删除节点分组
  86. function delGroup(id) {
  87. layer.confirm('确定删除分组?', {icon: 2, title:'警告'}, function(index) {
  88. $.post("{{url('admin/delGroup')}}", {id:id, _token:'{{csrf_token()}}'}, function(ret) {
  89. layer.msg(ret.message, {time:1000}, function() {
  90. if (ret.status == 'success') {
  91. window.location.reload();
  92. }
  93. });
  94. });
  95. layer.close(index);
  96. });
  97. }
  98. </script>
  99. @endsection