role.blade.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. @extends('base.base')
  2. @section('base')
  3. <!-- 内容区域 -->
  4. <div class="main-panel">
  5. <div class="content-wrapper">
  6. <div class="page-header">
  7. <h3 class="page-title">
  8. <span class="page-title-icon bg-gradient-primary text-white mr-2">
  9. <i class="mdi mdi-wrench"></i>
  10. </span>
  11. {{ __('auto.角色') }}
  12. </h3>
  13. <nav aria-label="breadcrumb">
  14. <ol class="breadcrumb">
  15. <li class="breadcrumb-item"><a href="#">{{ __('auto.系统设置') }}</a></li>
  16. <li class="breadcrumb-item active" aria-current="page">{{ __('auto.角色管理') }}</li>
  17. </ol>
  18. </nav>
  19. </div>
  20. <div class="row">
  21. <div class="col-lg-12 grid-margin stretch-card">
  22. <div class="card">
  23. <div class="card-body">
  24. <h4 class="card-title">{{ __('auto.角色列表') }}</h4>
  25. <p class="card-description">
  26. <button type="button" class="btn btn-sm btn-gradient-success btn-icon-text" onclick="add()">
  27. <i class="mdi mdi-plus btn-icon-prepend"></i>
  28. {{ __('auto.添加角色') }}
  29. </button>
  30. </p>
  31. <table class="table table-bordered">
  32. <thead>
  33. <tr>
  34. <th>{{ __('auto.角色') }}ID</th>
  35. <th>{{ __('auto.角色名称') }}</th>
  36. <th>{{ __('auto.角色描述') }}</th>
  37. <th>{{ __('auto.创建时间') }}</th>
  38. <th>{{ __('auto.更新时间') }}</th>
  39. <th>{{ __('auto.操作') }}</th>
  40. </tr>
  41. </thead>
  42. <tbody>
  43. @foreach($list as $k=>$v)
  44. <tr>
  45. <td>{{ $v->id }}</td>
  46. <td>{{ $v->name }}</td>
  47. <td>{{ $v->description }}</td>
  48. <td>{{ $v->created_at }}</td>
  49. <td>{{ $v->updated_at }}</td>
  50. <td>
  51. <button type="button" class="btn btn-sm btn-gradient-dark btn-icon-text" onclick="update({{ $v->id }})">
  52. {{ __('auto.修改') }}
  53. <i class="mdi mdi-file-check btn-icon-append"></i>
  54. </button>
  55. <button @if($v->id == 1) disabled @endif type="button" class="btn btn-sm btn-gradient-danger btn-icon-text" onclick="del({{ $v->id }})">
  56. <i class="mdi mdi-delete btn-icon-prepend"></i>
  57. {{ __('auto.删除') }}
  58. </button>
  59. </td>
  60. </tr>
  61. @endforeach
  62. </tbody>
  63. </table>
  64. </div>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. <script>
  71. function add(){
  72. var page = layer.open({
  73. type: 2,
  74. title: '{{ __('auto.添加角色') }}',
  75. shadeClose: true,
  76. shade: 0.8,
  77. area: ['70%', '90%'],
  78. content: '/admin/role/add'
  79. });
  80. }
  81. function update(id){
  82. var page = layer.open({
  83. type: 2,
  84. title: '{{ __('auto.修改角色') }}',
  85. shadeClose: true,
  86. shade: 0.8,
  87. area: ['70%', '90%'],
  88. content: '/admin/role/update/'+id
  89. });
  90. }
  91. function del(id){
  92. myConfirm("{{ __('auto.删除操作不可逆,是否继续') }}?",function(){
  93. myRequest("/admin/role/del/"+id,"post",{},function(res){
  94. layer.msg(res.msg)
  95. setTimeout(function(){
  96. window.location.reload();
  97. },1500)
  98. });
  99. });
  100. }
  101. $('.menu-switch').click(function(){
  102. id = $(this).attr('id');
  103. state = $(this).attr('state');
  104. console.log(id)
  105. console.log(state)
  106. if(state == "on"){
  107. $('.pid-'+id).hide();
  108. $(this).attr("state","off")
  109. $(this).removeClass('mdi-menu-down').addClass('mdi-menu-right');
  110. }else{
  111. $('.pid-'+id).show();
  112. $(this).attr("state","on")
  113. $(this).removeClass('mdi-menu-right').addClass('mdi-menu-down');
  114. }
  115. })
  116. </script>
  117. @endsection