index.blade.php 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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 class="active">轮播列表</li>
  9. </ol>
  10. @endsection
  11. @section('content')
  12. <form id="searchForm" class="form-inline">
  13. <div class="">
  14. <div class="form-group">
  15. <label for="name" class="label-css"> 轮播标题:</label>
  16. <input class="form-control" type="text" name="title">
  17. </div>
  18. <div class="form-group">
  19. <label for="level_id" class="label-css"> 显示状态:</label>
  20. <select class="form-control" name="show" style="margin-top: -8px;">
  21. <option value="">全部</option>
  22. <option value="0">关闭</option>
  23. <option value="1">开启</option>
  24. </select>
  25. </div>
  26. &ensp;&ensp;
  27. <button type="button" class="btn btn-primary">查询</button>
  28. </div>
  29. </form>
  30. <hr class="hr-css">
  31. <div>
  32. <div id="toolbar">
  33. <div class="columns columns-left btn-group pull-left">
  34. <a class="createForm" data-url="{{ route('admin.banner.store') }}" data-title="create">
  35. <button class="btn btn-default" type="button">
  36. <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>&ensp;新增轮播
  37. </button>
  38. </a>
  39. </div>
  40. </div>
  41. <table id="ContentTable"></table>
  42. </div>
  43. @endsection
  44. @section('plug-js')
  45. <script src="{{ asset('js/bootstrap-table/dist/bootstrap-table.js') }}"></script>
  46. <script src="{{ asset('js/bootstrap-table/dist/locale/bootstrap-table-zh-CN.js') }}"></script>
  47. <script src="{{ asset('js/jquery-validation1.16/dist/jquery.validate.min.js') }}"></script>
  48. <script src="{{ asset('js/jquery-validation1.16/dist/additional-methods.min.js') }}"></script>
  49. <script src="{{ asset('js/jquery-validation1.16/src/localization/messages_zh.js') }}"></script>
  50. @endsection
  51. @section('scripts')
  52. <script>
  53. $(function(){
  54. BootStrapInit.init('tableBanner','ContentTable',{
  55. searchForm: 'searchForm', // 表单搜索id 省略默认 'searchForm'
  56. url: "{{ route('admin.banner.ajax.index') }}",
  57. method: 'post',
  58. toolbar: '#toolbar',
  59. idField: '', // 指定主键列
  60. uniqueId: "id", // 这里需要指定当前查询表唯一主键字段
  61. columns: [
  62. {
  63. checkbox: true,
  64. align: 'center',
  65. valign: 'middle'
  66. },
  67. {
  68. field: 'id',
  69. title: 'ID',
  70. align: 'center',
  71. valign: 'middle',
  72. },
  73. {
  74. field: 'title',
  75. title: '标题',
  76. align: 'center',
  77. valign: 'middle',
  78. },
  79. {
  80. field: 'image',
  81. title: '轮播图片',
  82. align: 'center',
  83. valign: 'middle',
  84. formatter:thumbFormatter
  85. },
  86. {
  87. field: 'show',
  88. title: '显示',
  89. align: 'center',
  90. valign: 'middle',
  91. formatter:yesOrNo,
  92. bool_data:{
  93. 'class' : 'cursor',
  94. // 'url' : 'javascript:;',
  95. 'table' : 'banners'
  96. // 'pk' : 'id' // 主键名称不写默认id主键
  97. }
  98. },
  99. {
  100. field: 'sort',
  101. title: '排序',
  102. align: 'center',
  103. valign: 'middle',
  104. formatter:inputData,
  105. input_data: {
  106. // 'url' : 'javascript', // url存在 及请求指定地址修改数据
  107. 'table' : 'banners' // url为空时采用,
  108. // 'pk' : 'id' // 默认修改主键名称 不写 默认id为主键
  109. }
  110. },
  111. {
  112. field: 'created_at',
  113. title: '创建时间',
  114. align: 'center',
  115. valign: 'middle',
  116. },
  117. {
  118. field: 'updated_at',
  119. title: '更新时间',
  120. align: 'center',
  121. valign: 'middle',
  122. },
  123. {
  124. pkId: 'id', // 当前主键id 兼容排序 field='id' 默认值id
  125. title: '操作',
  126. align: 'center',
  127. valign: 'middle',
  128. width: '185px',
  129. formatter:operateFormatter,
  130. btn_group:[
  131. {
  132. 'name' : '编辑',
  133. 'class' : 'btn-primary createForm',
  134. 'url' : 'javascript:;',
  135. 'confirm_url': '{{ route('admin.banner.edit', ['id'=>'-val-'])}}'
  136. },
  137. {
  138. 'name' : '删除',
  139. 'class' : 'btn-danger deleteBtn', // class标签 deleteBtn删除 layer弹出框
  140. 'url' : 'javascript:;',
  141. 'confirm_url': '{{ route('admin.banner.destroy', ['id'=>'-val-'])}}' // 选择按钮
  142. }
  143. ]
  144. }
  145. ]
  146. });
  147. });
  148. </script>
  149. @endsection