123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- @extends('admin/master')
- @section('content')
- <body>
- @if(session('info'))
- <div class="Huialert Huialert-info" onclick="$(this).remove()" id="info">
- {{session('info')}}
- </div>
- @endif
- <div class="page-container">
- <div class="cl pd-5 bg-1 bk-gray mt-20">
- <span class="l"><a class="btn btn-primary radius" onclick="permission_add('新增权限')" href="javascript:;"><i class="Hui-iconfont"></i> 新增权限</a> </span>
- <span class="l"><a class="btn btn-primary radius" onclick="role_add('新增角色')" href="javascript:;"><i class="Hui-iconfont"></i> 新增角色</a></span>
- </div><br>
- <input type="hidden" id="type" value="{{$type}}"/>
- <div id="tab_demo" class="HuiTab">
- <div class="tabBar clearfix">
- <span onclick="permission()" href="javascript:;">权限</span>
- <span onclick="role()" href="javascript:;">角色</span>
- </div>
- <div class="tabCon" id="tabCon1">
- <div class="mt-20">
- <table class="table table-border table-bordered table-bg table-hover">
- <thead>
- <tr class="text-c">
- <th width="20%">名称</th>
- <th width="20%">说明</th>
- <th width="20%">创建时间</th>
- <th width="20%">更新时间</th>
- <th width="20%">操作</th>
- </tr>
- </thead>
- <tbody>
- @if($permissions)
- @foreach($permissions as $permission)
- <tr class="text-c" style=" text-align:center;">
- <td>{{$permission['name']}}</td>
- <td>{{$permission['description']}}</td>
- <td>{{date('Y-m-d H:i:s',$permission['create_time'])}}</td>
- <td>{{$permission['update_time']}}</td>
- <td class="f-14 product-brand-manage">
- <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>
- </td>
- </tr>
- @endforeach
- @endif
- </tbody>
- </table>
- </div>
- <div id="page1" class="page_div"></div>
- </div>
- <div class="tabCon" id="tabCon2">
- <div class="mt-20">
- <table class="table table-border table-bordered table-bg table-hover">
- <thead>
- <tr class="text-c" style=" text-align:center;">
- <th width="25%">名称</th>
- <th width="25%">创建时间</th>
- <th width="25%">更新时间</th>
- <th width="25%">操作</th>
- </tr>
- </thead>
- <tbody>
- @if($roles)
- @foreach($roles as $role)
- <tr class="text-c" style=" text-align:center;">
- <td>{{$role['name']}}</td>
- <td>{{date('Y-m-d H:i:s',$role['create_time'])}}</td>
- <td>{{$role['update_time']}}</td>
- <td class="f-14 product-brand-manage">
- <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>
- </td>
- </tr>
- @endforeach
- @endif
- </tbody>
- </table>
- </div>
- <div id="page2" class="page_div"></div>
- </div>
- </div>
- </div>
- <!--_footer 作为公共模版分离出去-->
- <script type="text/javascript" src="/admin/lib/jquery/1.9.1/jquery.min.js"></script>
- <script type="text/javascript" src="/admin/lib/layer/2.4/layer.js"></script>
- <script type="text/javascript" src="/admin/static/h-ui/js/H-ui.min.js"></script>
- <script type="text/javascript" src="/admin/static/h-ui.admin/js/H-ui.admin.js"></script>
- <script type="text/javascript" src="/admin/lib/page/paging.js"></script>
- <!--/_footer 作为公共模版分离出去-->
- <script type="text/javascript">
- $(function(){
- setTimeout("$('#info').hide()",3000);
- //0-权限 1-角色
- var type = $("#type").val();
- if(type){
- if(type==2){
- $.Huitab("#tab_demo .tabBar span","#tab_demo .tabCon","current","click","1");
- $("#page2").paging({
- pageNo :{{$page}},
- totalPage:{{$pages2}},
- totalSize:{{$count2}},
- callback: function(num) {
- location.href='index?page='+num+'&type=2';
- }
- })
- }
- if(type==1){
- $.Huitab("#tab_demo .tabBar span","#tab_demo .tabCon","current","click","0");
- $("#page1").paging({
- pageNo :{{$page}},
- totalPage:{{$pages1}},
- totalSize:{{$count1}},
- callback: function(num) {
- location.href='index?page='+num+'&type=1';
- }
- })
- }
- }else{
- $.Huitab("#tab_demo .tabBar span","#tab_demo .tabCon","current","click","0");
- $("#page1").paging({
- pageNo :{{$page}},
- totalPage:{{$pages1}},
- totalSize:{{$count1}},
- callback: function(num) {
- location.href='index?page='+num+'&type=1';
- }
- })
- }
- });
- /*从permission选项卡(切换页码后)切到role*/
- function role(){
- location.href='index?page=1&type=2';
- }
- /*从role选项卡(切换页码后)切到permission*/
- function permission(){
- location.href='index?page=1&type=1';
- }
- /*权限-创建*/
- function permission_add(title){
- location.href = '/admin/permission/create';
- }
- /*角色-创建*/
- function role_add(title){
- location.href = '/admin/role/create';
- }
- /*权限-编辑*/
- function permission_edit(title,id){
- location.href = "/admin/permission/edit/"+id;
- }
- /*角色-编辑*/
- function role_edit(title,name){
- location.href = "/admin/role/edit/"+name;
- }
- /*角色-删除*/
- function role_del(obj,name){
- layer.confirm('确认要删除吗?',function(index){
- layer.msg('请不要搞事情!!!',{icon:1,time:3000});
- // $.ajax({
- // type: 'GET',
- // url: '/admin/role/destory/'+name,
- // dataType: 'json',
- // success: function(data){
- // if(data == 1){
- // $(obj).parents("tr").remove();
- // layer.msg('已删除!',{icon:1,time:1000});
- // }
- // }
- // });
- });
- }
- /*权限-删除*/
- function permission_del(obj,name){
- layer.confirm('确认要删除吗?',function(index){
- layer.msg('请不要搞事情!!!',{icon:1,time:3000});
- // $.ajax({
- // type: 'GET',
- // url: '/admin/permission/destory/'+name,
- // dataType: 'json',
- // success: function(data){
- // if(data == 1){
- // $(obj).parents("tr").remove();
- // layer.msg('已删除!',{icon:1,time:1000});
- // }
- // }
- // });
- });
- }
- /*分页1*/
- $("#page2").paging({
- pageNo :{{$page}},
- totalPage:{{$pages2}},
- totalSize:{{$count2}},
- callback: function(num) {
- location.href='index?page='+num+'&type=2';
- }
- })
- </script>
- </body>
- @endsection
|