bootstrap_table_tree.blade.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. @extends('layouts.admin.app')
  2. @section('plug-css')
  3. {{-- bootstrap-table --}}
  4. <link href="{{ asset('js/bootstrap-table/dist/bootstrap-table.css') }}" rel="stylesheet">
  5. @endsection
  6. {{-- 后台导航栏 面包屑 --}}
  7. @section('crumbs')
  8. <ol class="breadcrumb crumbs">
  9. <li><a href="{{ route('admin.index') }}#">后台导航</a></li>
  10. <li><a href="{{ route('admin.index') }}">后台首页</a></li>
  11. <li class="active">全局配置</li>
  12. </ol>
  13. @endsection
  14. {{-- 文本内容 --}}
  15. @section('content')
  16. <form id="searchForm" class="form-inline">
  17. <div class="">
  18. <div class="form-group">
  19. <label for="name" class="label-css">名称</label>
  20. <input class="form-control" type="text" id="name" name="key">
  21. </div>
  22. <div class="form-group">
  23. <label for="value" class="label-css">配置值</label>
  24. <input class="form-control" type="text" id="valueOne" name="value">
  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 href="javascript:;">
  35. <button class="btn btn-default" type="button">
  36. <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>&ensp;新增
  37. </button>
  38. </a>
  39. <a>
  40. <button id="deleteAll" data-url="{{ route('config.destroys') }}" class="btn btn-default" type="button">
  41. <span class="glyphicon glyphicon-trash" aria-hidden="true"></span>&ensp;删除
  42. </button>
  43. </a>
  44. </div>
  45. </div>
  46. {{-- table --}}
  47. <table id="ContentTable"></table>
  48. </div>
  49. @endsection
  50. {{-- 插件引入js --}}
  51. @section('plug-js')
  52. {{-- bootstrap-table插件 --}}
  53. <script src="{{ asset('js/bootstrap-table/dist/bootstrap-table.js') }}"></script>
  54. <script src="{{ asset('js/bootstrap-table/dist/locale/bootstrap-table-zh-CN.js') }}"></script>
  55. <script src="{{ asset('js/bootstrap-table-treeView/src/bootstrap-table-treeview.js') }}"></script>
  56. @endsection
  57. {{-- javaScript --}}
  58. @section('scripts')
  59. <script>
  60. $(function(){
  61. BootStrapInit.init('tableView','ContentTable',{
  62. searchForm: 'searchForm', //> 表单搜索id 省略默认 'searchForm'
  63. url: "{{ route('/tree/ajax') }}",
  64. method: 'post',
  65. toolbar: '#toolbar',
  66. idField: '', //指定主键列
  67. uniqueId: "id",
  68. treeView: true,
  69. treeId: "id",
  70. treeField: "name",//展示树的字段
  71. columns: [
  72. {
  73. checkbox: true,
  74. align: 'center',
  75. valign: 'middle'
  76. },
  77. {
  78. field: 'name',
  79. title: '名称',
  80. align: 'left',
  81. valign: 'middle',
  82. width: '185px'
  83. },
  84. {
  85. pkId: 'id', //> 当前主键id 兼容排序 field='id' 默认值id
  86. title: '操作',
  87. align: 'center',
  88. valign: 'middle',
  89. width: '185px',
  90. formatter:operateFormatter,
  91. btn_group:[
  92. {
  93. 'name' : '编辑',
  94. 'class' : 'btn-primary',
  95. 'url' : '{{ route('admin.index', ['key'=>'-val-'])}}'
  96. },
  97. {
  98. 'name' : '删除',
  99. 'class' : 'btn-danger deleteBtn', //> class标签 deleteBtn删除 layer弹出框
  100. 'url' : 'javascript:;',
  101. 'confirm_url': '{{ route('config.destroy', ['key'=>'-val-'])}}' //> 选择按钮
  102. }
  103. ]
  104. }
  105. ]});
  106. });
  107. </script>
  108. @endsection