index.blade.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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="menu_name">
  17. </div>
  18. &ensp;&ensp;
  19. <button type="button" class="btn btn-primary">查询</button>
  20. </div>
  21. </form>
  22. <hr class="hr-css">
  23. <div>
  24. <div id="toolbar">
  25. <div class="columns columns-left btn-group pull-left">
  26. <a class="createForm" data-url="{{ route('admin.menu.store',['p_id'=>request()->input('p_id','0'),'level'=>0]) }}" data-title="create">
  27. <button class="btn btn-default" type="button">
  28. <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>&ensp;新增菜单
  29. </button>
  30. </a>
  31. </div>
  32. </div>
  33. <table id="ContentTable"></table>
  34. </div>
  35. @endsection
  36. @section('plug-js')
  37. <script src="{{ asset('js/bootstrap-table/dist/bootstrap-table.js') }}"></script>
  38. <script src="{{ asset('js/bootstrap-table/dist/locale/bootstrap-table-zh-CN.js') }}"></script>
  39. <script src="{{ asset('js/jquery-validation1.16/dist/jquery.validate.min.js') }}"></script>
  40. <script src="{{ asset('js/jquery-validation1.16/dist/additional-methods.min.js') }}"></script>
  41. <script src="{{ asset('js/jquery-validation1.16/src/localization/messages_zh.js') }}"></script>
  42. @endsection
  43. @section('scripts')
  44. <script>
  45. $(function(){
  46. BootStrapInit.init('tableMenu','ContentTable',{
  47. searchForm: 'searchForm', // 表单搜索id 省略默认 'searchForm'
  48. url: "{{ route('admin.menu.ajax.index',['p_id'=>request()->input('p_id','0')]) }}",
  49. method: 'post',
  50. toolbar: '#toolbar',
  51. idField: '', // 指定主键列
  52. uniqueId: "id", // 这里需要指定当前查询表唯一主键字段
  53. columns: [
  54. {
  55. checkbox: true,
  56. align: 'center',
  57. valign: 'middle'
  58. },
  59. {
  60. field: 'id',
  61. title: 'ID',
  62. align: 'center',
  63. valign: 'middle',
  64. },
  65. {
  66. field: 'menu_name',
  67. title: '菜单名称',
  68. align: 'center',
  69. valign: 'middle',
  70. },
  71. {
  72. field: 'level',
  73. title: '层级',
  74. align: 'center',
  75. valign: 'middle',
  76. },
  77. {
  78. field: 'sort',
  79. title: '排序',
  80. align: 'center',
  81. valign: 'middle',
  82. formatter:inputData,
  83. input_data: {
  84. 'table' : 'menus' // url为空时采用,
  85. }
  86. },
  87. {
  88. field: 'created_at',
  89. title: '创建时间',
  90. align: 'center',
  91. valign: 'middle',
  92. },
  93. {
  94. field: 'updated_at',
  95. title: '更新时间',
  96. align: 'center',
  97. valign: 'middle',
  98. },
  99. {
  100. pkId: 'id', // 当前主键id 兼容排序 field='id' 默认值id
  101. title: '操作',
  102. align: 'center',
  103. valign: 'middle',
  104. width: '230px',
  105. formatter:operateFormatter,
  106. btn_group:[
  107. {
  108. 'name' : '编辑',
  109. 'class' : 'btn-primary createForm',
  110. 'url' : 'javascript:;',
  111. 'confirm_url': '{{ route('admin.menu.edit', ['id'=>'-val-'])}}'
  112. },
  113. {
  114. 'name' : '新增下级',
  115. 'class' : 'btn-danger createForm', // class标签 deleteBtn删除 layer弹出框
  116. 'url' : 'javascript:;',
  117. 'skip' : 'skip',
  118. 'confirm_url': '{{ route('admin.menu.store', ['p_id'=>'-val-','level'=>request()->input('level','0')+1])}}' // 选择按钮
  119. },
  120. {
  121. 'name' : '查看下级',
  122. 'class' : 'btn-primary',
  123. 'skip' : 'skip',
  124. 'url' : '{{ route('admin.menu.index', ['p_id'=>'-val-','level'=>request()->input('level','0')+1])}}'
  125. },
  126. ]
  127. }
  128. ]
  129. });
  130. });
  131. </script>
  132. @endsection