index.blade.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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.blockItem.index') }}">后台BlockItem首页</a></li>
  9. <li class="active">BlockItem列表</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.blockItem.store') }}" data-title="create">
  28. <button class="btn btn-default" type="button">
  29. <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>&ensp;新增BlockItem
  30. </button>
  31. </a>
  32. <a>
  33. <button id="deleteAll" data-url="{{ route('admin.blockItem.destroys',['is_del'=>1]) }}" 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('tableBlockItem','ContentTable',{
  53. searchForm: 'searchForm', // 表单搜索id 省略默认 'searchForm'
  54. url: "{{ route('admin.blockItem.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: 'id',
  67. title: 'ID',
  68. align: 'center',
  69. valign: 'middle',
  70. sortable: true
  71. },
  72. {
  73. field: 'image',
  74. title: 'Image',
  75. align: 'center',
  76. valign: 'middle',
  77. formatter:thumbFormatter
  78. },
  79. // {
  80. // field: 'link',
  81. // title: '链接',
  82. // align: 'center',
  83. // valign: 'middle'
  84. // },
  85. {
  86. field: 'status',
  87. title: '显示',
  88. align: 'center',
  89. valign: 'middle',
  90. sortable: true,
  91. formatter:yesOrNo,
  92. bool_data:{
  93. 'class' : 'cursor',
  94. // 'url' : 'javascript:;',
  95. 'table' : 'blockItems'
  96. // 'pk' : 'id' // 主键名称不写默认id主键
  97. }
  98. },
  99. {
  100. field: 'sort',
  101. title: '排序',
  102. align: 'center',
  103. valign: 'middle',
  104. sortable: true,
  105. formatter:inputData,
  106. input_data: {
  107. // 'class' : 'cursor', // 当前样式
  108. // 'url' : 'javascript', // url存在 及请求指定地址修改数据
  109. 'table' : 'blockItems' // url为空时采用,
  110. // 'pk' : 'id' // 默认修改主键名称 不写 默认id为主键
  111. }
  112. },
  113. {
  114. field: 'created_at',
  115. title: '创建时间',
  116. align: 'center',
  117. valign: 'middle',
  118. sortable: true
  119. },
  120. {
  121. field: 'updated_at',
  122. title: '更新时间',
  123. align: 'center',
  124. valign: 'middle',
  125. sortable: true
  126. },
  127. {
  128. pkId: 'id', // 当前主键id 兼容排序 field='id' 默认值id
  129. title: '操作',
  130. align: 'center',
  131. valign: 'middle',
  132. width: '185px',
  133. formatter:operateFormatter,
  134. btn_group:[
  135. {
  136. 'name' : '编辑',
  137. 'class' : 'btn-primary createForm',
  138. 'url' : 'javascript:;',
  139. 'confirm_url': '{{ route('admin.blockItem.edit', ['id'=>'-val-'])}}'
  140. },
  141. {
  142. 'name' : '删除',
  143. 'class' : 'btn-danger deleteBtn', // class标签 deleteBtn删除 layer弹出框
  144. 'url' : 'javascript:;',
  145. 'confirm_url': '{{ route('admin.blockItem.destroy', ['id'=>'-val-','is_del'=>1])}}' // 选择按钮
  146. }
  147. ]
  148. }
  149. ]
  150. });
  151. });
  152. </script>
  153. @endsection