Нет описания

permissionindex.blade.php 8.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. @extends('admin/master')
  2. @section('content')
  3. <body>
  4. @if(session('info'))
  5. <div class="Huialert Huialert-info" onclick="$(this).remove()" id="info">
  6. {{session('info')}}
  7. </div>
  8. @endif
  9. <div class="page-container">
  10. <div class="cl pd-5 bg-1 bk-gray mt-20">
  11. <span class="l"><a class="btn btn-primary radius" onclick="permission_add('新增权限')" href="javascript:;"><i class="Hui-iconfont">&#xe600;</i> 新增权限</a>&nbsp;</span>
  12. <span class="l"><a class="btn btn-primary radius" onclick="role_add('新增角色')" href="javascript:;"><i class="Hui-iconfont">&#xe600;</i> 新增角色</a></span>
  13. </div><br>
  14. <input type="hidden" id="type" value="{{$type}}"/>
  15. <div id="tab_demo" class="HuiTab">
  16. <div class="tabBar clearfix">
  17. <span onclick="permission()" href="javascript:;">权限</span>
  18. <span onclick="role()" href="javascript:;">角色</span>
  19. </div>
  20. <div class="tabCon" id="tabCon1">
  21. <div class="mt-20">
  22. <table class="table table-border table-bordered table-bg table-hover">
  23. <thead>
  24. <tr class="text-c">
  25. <th width="20%">名称</th>
  26. <th width="20%">说明</th>
  27. <th width="20%">创建时间</th>
  28. <th width="20%">更新时间</th>
  29. <th width="20%">操作</th>
  30. </tr>
  31. </thead>
  32. <tbody>
  33. @if($permissions)
  34. @foreach($permissions as $permission)
  35. <tr class="text-c" style=" text-align:center;">
  36. <td>{{$permission['name']}}</td>
  37. <td>{{$permission['description']}}</td>
  38. <td>{{date('Y-m-d H:i:s',$permission['create_time'])}}</td>
  39. <td>{{$permission['update_time']}}</td>
  40. <td class="f-14 product-brand-manage">
  41. <a style="text-decoration:none" onClick='permission_edit("编辑权限","{{$permission['id']}}")' href="javascript:;" title="编辑权限"><span class="btn btn-primary radius">编辑</span></a> <a style="text-decoration:none" class="ml-5" onClick="permission_del(this, '{{$permission['id']}}')" href="javascript:;" title="删除"><span class="btn btn-danger radius">删除</span></a>
  42. </td>
  43. </tr>
  44. @endforeach
  45. @endif
  46. </tbody>
  47. </table>
  48. </div>
  49. <div id="page1" class="page_div"></div>
  50. </div>
  51. <div class="tabCon" id="tabCon2">
  52. <div class="mt-20">
  53. <table class="table table-border table-bordered table-bg table-hover">
  54. <thead>
  55. <tr class="text-c" style=" text-align:center;">
  56. <th width="25%">名称</th>
  57. <th width="25%">创建时间</th>
  58. <th width="25%">更新时间</th>
  59. <th width="25%">操作</th>
  60. </tr>
  61. </thead>
  62. <tbody>
  63. @if($roles)
  64. @foreach($roles as $role)
  65. <tr class="text-c" style=" text-align:center;">
  66. <td>{{$role['name']}}</td>
  67. <td>{{date('Y-m-d H:i:s',$role['create_time'])}}</td>
  68. <td>{{$role['update_time']}}</td>
  69. <td class="f-14 product-brand-manage">
  70. <a style="text-decoration:none" onClick='role_edit("编辑角色","{{$role['name']}}")' href="javascript:;" title="编辑角色"><span class="btn btn-primary radius">编辑</span></a> <a style="text-decoration:none" class="ml-5" onClick="role_del(this, '{{$role['name']}}')" href="javascript:;" title="删除"><span class="btn btn-danger radius">删除</span></a>
  71. </td>
  72. </tr>
  73. @endforeach
  74. @endif
  75. </tbody>
  76. </table>
  77. </div>
  78. <div id="page2" class="page_div"></div>
  79. </div>
  80. </div>
  81. </div>
  82. <!--_footer 作为公共模版分离出去-->
  83. <script type="text/javascript" src="/admin/lib/jquery/1.9.1/jquery.min.js"></script>
  84. <script type="text/javascript" src="/admin/lib/layer/2.4/layer.js"></script>
  85. <script type="text/javascript" src="/admin/static/h-ui/js/H-ui.min.js"></script>
  86. <script type="text/javascript" src="/admin/static/h-ui.admin/js/H-ui.admin.js"></script>
  87. <script type="text/javascript" src="/admin/lib/page/paging.js"></script>
  88. <!--/_footer 作为公共模版分离出去-->
  89. <script type="text/javascript">
  90. $(function(){
  91. setTimeout("$('#info').hide()",3000);
  92. //0-权限 1-角色
  93. var type = $("#type").val();
  94. if(type){
  95. if(type==2){
  96. $.Huitab("#tab_demo .tabBar span","#tab_demo .tabCon","current","click","1");
  97. $("#page2").paging({
  98. pageNo :{{$page}},
  99. totalPage:{{$pages2}},
  100. totalSize:{{$count2}},
  101. callback: function(num) {
  102. location.href='index?page='+num+'&type=2';
  103. }
  104. })
  105. }
  106. if(type==1){
  107. $.Huitab("#tab_demo .tabBar span","#tab_demo .tabCon","current","click","0");
  108. $("#page1").paging({
  109. pageNo :{{$page}},
  110. totalPage:{{$pages1}},
  111. totalSize:{{$count1}},
  112. callback: function(num) {
  113. location.href='index?page='+num+'&type=1';
  114. }
  115. })
  116. }
  117. }else{
  118. $.Huitab("#tab_demo .tabBar span","#tab_demo .tabCon","current","click","0");
  119. $("#page1").paging({
  120. pageNo :{{$page}},
  121. totalPage:{{$pages1}},
  122. totalSize:{{$count1}},
  123. callback: function(num) {
  124. location.href='index?page='+num+'&type=1';
  125. }
  126. })
  127. }
  128. });
  129. /*从permission选项卡(切换页码后)切到role*/
  130. function role(){
  131. location.href='index?page=1&type=2';
  132. }
  133. /*从role选项卡(切换页码后)切到permission*/
  134. function permission(){
  135. location.href='index?page=1&type=1';
  136. }
  137. /*权限-创建*/
  138. function permission_add(title){
  139. location.href = '/admin/permission/create';
  140. }
  141. /*角色-创建*/
  142. function role_add(title){
  143. location.href = '/admin/role/create';
  144. }
  145. /*权限-编辑*/
  146. function permission_edit(title,id){
  147. location.href = "/admin/permission/edit/"+id;
  148. }
  149. /*角色-编辑*/
  150. function role_edit(title,name){
  151. location.href = "/admin/role/edit/"+name;
  152. }
  153. /*角色-删除*/
  154. function role_del(obj,name){
  155. layer.confirm('确认要删除吗?',function(index){
  156. layer.msg('请不要搞事情!!!',{icon:1,time:3000});
  157. // $.ajax({
  158. // type: 'GET',
  159. // url: '/admin/role/destory/'+name,
  160. // dataType: 'json',
  161. // success: function(data){
  162. // if(data == 1){
  163. // $(obj).parents("tr").remove();
  164. // layer.msg('已删除!',{icon:1,time:1000});
  165. // }
  166. // }
  167. // });
  168. });
  169. }
  170. /*权限-删除*/
  171. function permission_del(obj,name){
  172. layer.confirm('确认要删除吗?',function(index){
  173. layer.msg('请不要搞事情!!!',{icon:1,time:3000});
  174. // $.ajax({
  175. // type: 'GET',
  176. // url: '/admin/permission/destory/'+name,
  177. // dataType: 'json',
  178. // success: function(data){
  179. // if(data == 1){
  180. // $(obj).parents("tr").remove();
  181. // layer.msg('已删除!',{icon:1,time:1000});
  182. // }
  183. // }
  184. // });
  185. });
  186. }
  187. /*分页1*/
  188. $("#page2").paging({
  189. pageNo :{{$page}},
  190. totalPage:{{$pages2}},
  191. totalSize:{{$count2}},
  192. callback: function(num) {
  193. location.href='index?page='+num+'&type=2';
  194. }
  195. })
  196. </script>
  197. </body>
  198. @endsection