index.blade.php 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. @extends('layouts.app')
  2. @section('title')查询-日志@endsection
  3. @section('content')
  4. <div class="container-fluid">
  5. <a class="btn btn-outline-dark" href="{{url('maintenance/syncRedisLogs')}}">同步日志</a>
  6. <div class="card">
  7. <div id="form_div"></div>
  8. <div class="card-body">
  9. @foreach (['danger', 'warning', 'success', 'info'] as $msg)
  10. @if(session()->has($msg))
  11. <div class="flash-message">
  12. <p class="alert alert-{{ $msg }}">
  13. {{ session()->get($msg) }}
  14. </p>
  15. </div>
  16. @endif
  17. @endforeach
  18. <table class="table table-striped table-sm" id="list">
  19. <tr>
  20. <th>ID</th>
  21. <th>用户</th>
  22. <th>类名</th>
  23. <th>方法名</th>
  24. <th>ip</th>
  25. <th>时间</th>
  26. </tr>
  27. <tr v-for="(log,i) in logs" class="hover" style="cursor: pointer;" @click="selectTr===i+1?selectTr=0:selectTr=i+1" :class="selectTr===i+1?'focusing' : ''">
  28. <td class="text-muted">@{{log.id}}<span class="badge badge-danger small pull-right mr-3" v-if="log.mark == 'Y'">异常</span></td>
  29. <td><span v-if="log.user">@{{log.user.name}}</span></td>
  30. <td><a :href="'{{url('maintenance/log')}}/'+log.id" target="_blank">@{{log.class}}</a></td>
  31. <td>@{{log.method}}</td>
  32. <td>@{{log.ip}}</td>
  33. <td class="text-muted">@{{log.created_at}}</td>
  34. </tr>
  35. </table>
  36. @if($logs)
  37. <!--带参分页查询-->
  38. {{$logs->withQueryString()->links()}}
  39. @endif
  40. </div>
  41. </div>
  42. </div>
  43. <style>
  44. .hover:hover {
  45. color: #1f6fb2;
  46. }
  47. </style>
  48. @endsection
  49. @section('lastScript')
  50. <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
  51. <script>
  52. new Vue({
  53. el: "#list",
  54. data: {
  55. logs: {!! json_encode($logs->toArray()['data'])??[] !!},
  56. selectTr:0,
  57. },
  58. mounted: function () {
  59. let data = [
  60. [
  61. {name: 'name', type: 'input', tip: '操作者', placeholder: '操作者'},
  62. {name: 'type',
  63. type: 'select_multiple_select',
  64. tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的类型'],
  65. placeholder: ['类型', '定位或多选类型'],
  66. data: [{'name': 'log', 'value': 'log'},
  67. {'name': 'warning', 'value': 'warning'},
  68. {'name': 'error', 'value': 'error'},
  69. {'name': 'panic', 'value': 'panic'},
  70. {'name': 'fatal', 'value': 'fatal'}],},
  71. {name: 'description', type: 'input', tip: '详情:可在两侧添加百分号(%)进行模糊搜索', placeholder: '详情'},
  72. {name: 'class', type: 'input', tip: '类名:可在两侧添加百分号(%)进行模糊搜索', placeholder: '类名'},
  73. {name: 'method', type: 'input', tip: '方法名:可在两侧添加百分号(%)进行模糊搜索', placeholder: '方法名'},
  74. {name:'created_at_start',type:'dateTime',tip:'选择显示指定日期的起始时间,只选一个或者不选,则查询当天'},
  75. {name:'created_at_end',type:'dateTime',tip:'选择显示指定日期的截止,只选一个或者不选,则查询当天'},
  76. {name:'is_exception',type:'checkbox',tip:'仅显示异常', data: [{name: 'true', value: '仅显示异常'}]}
  77. ]
  78. ];
  79. this.from = new query({
  80. el: '#form_div',
  81. condition: data,
  82. });
  83. this.from.init();
  84. },
  85. });
  86. </script>
  87. @endsection