index.blade.php 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. @extends('layouts.admin.app')
  2. @section('plug-css')
  3. <link href="{{ asset('js/bootstrap-table/dist/bootstrap-table.css') }}" rel="stylesheet">
  4. @endsection
  5. @section('crumbs')
  6. <ol class="breadcrumb crumbs">
  7. <li><a href="{{ route('admin.index') }}#">后台导航</a></li>
  8. <li><a href="{{ route('admin.role.index') }}">后台角色首页</a></li>
  9. <li class="active">角色列表</li>
  10. </ol>
  11. @endsection
  12. @section('content')
  13. <form id="searchForm" class="form-inline">
  14. {{-- <div class="">--}}
  15. {{-- <div class="form-group">--}}
  16. {{-- <label for="name" class="label-css"> ID:</label>--}}
  17. {{-- <input class="form-control" type="text" name="id">--}}
  18. {{-- </div>--}}
  19. {{-- &ensp;&ensp;--}}
  20. {{-- <button type="button" class="btn btn-primary">查询</button>--}}
  21. {{-- </div>--}}
  22. </form>
  23. <hr class="hr-css">
  24. <div>
  25. <div id="toolbar">
  26. <div class="columns columns-left btn-group pull-left">
  27. <a class="createForm" data-url="{{ route('admin.role.store') }}" data-title="create">
  28. <button class="btn btn-default" type="button">
  29. <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>&ensp;新增角色
  30. </button>
  31. </a>
  32. {{-- <a>--}}
  33. {{-- <button id="deleteAll" data-url="{{ route('admin.role.destroys') }}" class="btn btn-default" type="button">--}}
  34. {{-- <span class="glyphicon glyphicon-trash" aria-hidden="true"></span>&ensp;删除--}}
  35. {{-- </button>--}}
  36. {{-- </a>--}}
  37. </div>
  38. </div>
  39. <table id="ContentTable"></table>
  40. </div>
  41. @endsection
  42. @section('plug-js')
  43. <script src="{{ asset('js/bootstrap-table/dist/bootstrap-table.js') }}"></script>
  44. <script src="{{ asset('js/bootstrap-table/dist/locale/bootstrap-table-zh-CN.js') }}"></script>
  45. <script src="{{ asset('js/jquery-validation1.16/dist/jquery.validate.min.js') }}"></script>
  46. <script src="{{ asset('js/jquery-validation1.16/dist/additional-methods.min.js') }}"></script>
  47. <script src="{{ asset('js/jquery-validation1.16/src/localization/messages_zh.js') }}"></script>
  48. @endsection
  49. @section('scripts')
  50. <script>
  51. $(function(){
  52. BootStrapInit.init('tableRole','ContentTable',{
  53. searchForm: 'searchForm', // 表单搜索id 省略默认 'searchForm'
  54. url: "{{ route('admin.role.ajax.index') }}",
  55. method: 'post',
  56. toolbar: '#toolbar',
  57. idField: '', // 指定主键列
  58. uniqueId: "id", // 这里需要指定当前查询表唯一主键字段
  59. columns: [
  60. {
  61. checkbox: true,
  62. align: 'center',
  63. valign: 'middle'
  64. },
  65. {
  66. field: 'name',
  67. title: '角色名称',
  68. align: 'center',
  69. valign: 'middle'
  70. },
  71. {
  72. field: 'status',
  73. title: '状态',
  74. align: 'center',
  75. valign: 'middle',
  76. sortable: true,
  77. formatter:yesOrNoTwo,
  78. bool_data:{
  79. 'class' : 'cursor',
  80. // 'url' : 'javascript:;',
  81. 'table' : 'roles'
  82. // 'pk' : 'id' // 主键名称不写默认id主键
  83. }
  84. },
  85. {
  86. field: 'created_at',
  87. title: '创建时间',
  88. align: 'center',
  89. valign: 'middle'
  90. },
  91. {
  92. field: 'updated_at',
  93. title: '更新时间',
  94. align: 'center',
  95. valign: 'middle'
  96. },
  97. {
  98. pkId: 'id', // 当前主键id 兼容排序 field='id' 默认值id
  99. title: '操作',
  100. align: 'center',
  101. valign: 'middle',
  102. width: '185px',
  103. formatter:operateFormatter,
  104. btn_group:[
  105. {
  106. 'name' : '编辑',
  107. 'class' : 'btn-primary createForm',
  108. 'url' : 'javascript:;',
  109. 'skip' : 'skip',
  110. 'confirm_url': '{{ route('admin.role.edit', ['id'=>'-val-'])}}'
  111. },
  112. {
  113. 'name' : '权限管理',
  114. 'class' : 'btn-warning createForm',
  115. 'url' : 'javascript:;',
  116. 'skip' : 'skip',
  117. 'areaWidth' : '60%',
  118. 'areaHeight' : '80%',
  119. 'confirm_url': '{{ route('admin.role.permission', ['id'=>'-val-'])}}'
  120. },
  121. {
  122. 'name' : '删除',
  123. 'class' : 'btn-danger deleteBtn',
  124. 'url' : 'javascript:;',
  125. 'skip' : 'skip',
  126. 'confirm_url': '{{ route('admin.role.destroy', ['id'=>'-val-'])}}'
  127. }
  128. ]
  129. }
  130. ]
  131. });
  132. });
  133. </script>
  134. @endsection