asset.blade.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. @extends('admin/layout')
  2. @section('content')
  3. <body class="gray-bg">
  4. <div class="wrapper wrapper-content animated fadeInRight">
  5. <div class="row">
  6. <div class="col-sm-12">
  7. <div class="ibox float-e-margins">
  8. <div class="ibox-content">
  9. <form class="row" id="searchForm">
  10. <div class="col-md-2">
  11. <div class="input-group">
  12. <span class="input-group-btn">
  13. <button type="button" class="btn btn-md btn-primary" onclick="units.save(0)"
  14. style="margin-left: 10px"> <span class="glyphicon glyphicon-plus"></span> 添加</button>
  15. <button type="button" class="btn btn-md btn-danger" onclick="units.delete()"
  16. style="margin-left: 10px"><span
  17. class="glyphicon glyphicon-remove"></span> 删除</button>
  18. </span>
  19. </div>
  20. </div>
  21. <div class="col-md-6 pull-right">
  22. <div class="input-group">
  23. <select name="type_id" id="" class="form-control" title="">
  24. <option value="">请选择资源类型</option>
  25. @foreach($assetTypes as $item)
  26. <option value="{{$item->id}}">{{$item->title}}</option>
  27. @endforeach
  28. </select>
  29. <span class="input-group-btn">
  30. <button type="button" class="btn btn-md btn-primary"
  31. onclick="units.search()"> 搜索</button>
  32. <button type="reset" class="btn btn-md btn-primary" style="margin-left: 10px"
  33. name="resetBtn"> 重置</button> </span>
  34. </div>
  35. </div>
  36. </form>
  37. <hr>
  38. <div class="table-responsive">
  39. <table id="table" class="table table-condensed" data-mobile-responsive="true"></table>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. </div>
  46. </body>
  47. @endsection
  48. @section('footer')
  49. <script>
  50. var units = {
  51. getIdsBySelections: function () {
  52. var selections = $("#table").bootstrapTable('getSelections');
  53. var ids = [];
  54. $.each(selections, function (inx, val) {
  55. ids.push(val.id);
  56. });
  57. return ids;
  58. },
  59. save: function (id) {
  60. layer.open({
  61. type: 2,
  62. content: ['/admin/school/assets/' + id],
  63. area: ['60%', '60%'],
  64. title: '保存'
  65. });
  66. },
  67. search: function () {
  68. tips.selectPage();
  69. },
  70. delete: function () {
  71. var ids = units.getIdsBySelections();
  72. if (ids.length === 0) {
  73. layer.alert('请先选择您所要操作的对象', {icon: 0});
  74. return;
  75. }
  76. layer.confirm('您确定要删除吗?', {icon: 3, title: '删除信息'}, function (index, layero) {
  77. layer.close(index);
  78. tips.ajax({url: '/admin/school/assets', type: 'delete', data: {ids: ids}, tableRefresh: '#table'});
  79. });
  80. }
  81. };
  82. var config = {};
  83. config.url = '/admin/school/assets';
  84. config.columns = [ //字段
  85. {checkbox: true},
  86. {
  87. title: '序号', align: 'center', formatter: function (value, item, index) {
  88. return index + 1;
  89. }
  90. },
  91. {title: '类型', field: 'type_title', align: 'center'},
  92. {
  93. title: '文件名', field: 'original_name', align: 'center',
  94. formatter: function (value, row) {
  95. var str = '';
  96. str += '<a target="_blank" href="{{asset('admin/tool/download?file_url=')}}' + row.file_url + '">' + value + '</a>';
  97. return str;
  98. }
  99. },
  100. // {title: '文件地址', field: 'remark', align: 'center'},
  101. {title: '创建时间', field: 'created_at', align: 'center'},
  102. {
  103. title: '操作', field: 'id', align: 'center',
  104. formatter: function (value, row) {
  105. var str = '';
  106. str += '<button onclick="units.save(' + value + ')" class="btn btn-xs"><span class="glyphicon glyphicon-edit"></span>编辑</button>';
  107. return str;
  108. }
  109. }
  110. ];
  111. tips.bootstrapTable(config);
  112. </script>
  113. @endsection