operate_log.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. {include file="public/header" /}
  2. <body>
  3. <div class="layui-fluid">
  4. <div class="layui-card">
  5. <div class="layui-form layui-card-header layuiadmin-card-header-auto">
  6. <div class="layui-form-item">
  7. <div class="layui-inline">
  8. <div class="layui-input-inline">
  9. <input type="text" name="start" class="layui-input" onfocus="wk.lay_date(this);" placeholder="开始日期">
  10. </div>
  11. <div class="layui-form-mid">
  12. -
  13. </div>
  14. <div class="layui-input-inline">
  15. <input type="text" name="end" class="layui-input" onfocus="wk.lay_date(this);" placeholder="结束日期">
  16. </div>
  17. </div>
  18. <div class="layui-inline">
  19. <div class="layui-input-inline">
  20. <select name="key" lay-search="">
  21. <option value="">选择管理员</option>
  22. {volist name="search_user" id="v"}
  23. <option value="{$key}" {if condition="$val eq $key"}selected{/if}>{$v}</option>
  24. {/volist}
  25. </select>
  26. </div>
  27. </div>
  28. <div class="layui-inline">
  29. <div class="layui-input-inline">
  30. <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
  31. <button class="layui-btn layui-btn-normal" id="empty" lay-submit="" lay-filter="LAY-search">重置</button>
  32. </div>
  33. </div>
  34. </div>
  35. <div>
  36. <button class="layui-btn layui-btn-danger layuiBtn" data-type="getCheckData" >
  37. <i class="fa fa-trash-o"></i> 批量删除
  38. </button>
  39. </div>
  40. </div>
  41. <div class="layui-card-body">
  42. <table id="LAY-table-manage" lay-filter="LAY-table-manage"></table>
  43. <!--操作模板-->
  44. <script type="text/html" id="opeBar">
  45. <a class="layui-btn layui-btn-danger layui-btn-xs" title="删除" onclick="wk.confirm('{{d.log_id}}','{:url('del_log')}')"><i class="fa fa-trash-o"></i></a>
  46. </script>
  47. <!--状态模板-->
  48. <script type="text/html" id="staBar">
  49. {{# if(d.status==200){ }}
  50. <span class="layui-badge layui-bg-green">操作成功</span>
  51. {{# }else{ }}
  52. <span class="layui-badge">操作失败</span>
  53. {{# } }}
  54. </script>
  55. </div>
  56. </div>
  57. </div>
  58. {include file="public/footer" /}
  59. <script>
  60. layui.use(['index', 'table'], function () {
  61. var $ = layui.$
  62. , form = layui.form
  63. , table = layui.table
  64. table.render({
  65. elem: '#LAY-table-manage'
  66. , url: '{:url("Log/operate_log")}'
  67. ,response: {
  68. statusCode: 220 //成功的状态码,默认:0
  69. }
  70. , page: true
  71. , even: false //开启隔行背景
  72. , size: 'lg' //sm小尺寸的表格 lg大尺寸
  73. // ,width:100
  74. , autoSort: false
  75. , height: "full-220"
  76. , cellMinWidth: 150
  77. , limits: [10, 20, 30, 40, 50]
  78. , limit: "{:config('pages')}"
  79. , loading: true
  80. , id: 'LAY-table'
  81. , cols: [[
  82. {type: 'checkbox', fixed: 'left',}
  83. , {type:'numbers', width: 80, title: '序号'}
  84. , {field: 'admin_id', width: 80, title: '用户ID', align: 'center'}
  85. , {field: 'admin_name', width: '', title: '操作用户', align: 'center', templet: '#imgTpl'}
  86. , {field: 'description', width: 300, title: '描述', align: 'center', templet: '#titleTpl'}
  87. , {field: 'ip', width: '', title: '操作IP', align: 'center'}
  88. , {field: 'ipaddr', width: '', title: '地址', align: 'center'}
  89. , {field: 'add_time', width: 170, title: '操作时间', sort: true, align: 'center',templet:"<div>{{layui.util.toDateString(d.add_time*1000,'yyyy年MM月dd日')}}</div>"}
  90. , {field: 'status',fixed: 'right', width: 100, title: '状态', align: 'center', templet: '#staBar'}
  91. , {fixed: 'right', width: 60, title: '操作', align: 'center', toolbar: '#opeBar'}
  92. ]]
  93. });
  94. //事件
  95. var active = {
  96. getCheckData: function(){
  97. //批量删除
  98. wk.batchDel(getIds(),"{:url('batchDelLog')}");
  99. }
  100. };
  101. $('.layuiBtn').on('click', function () {
  102. var type = $(this).data('type');
  103. active[type] ? active[type].call(this) : '';
  104. });
  105. var getIds = function () {
  106. var ids = [];
  107. var checkStatus = table.checkStatus('LAY-table')
  108. ,data = checkStatus.data;
  109. $.each(data,function(index,item){
  110. ids.push(item['log_id'])
  111. });
  112. return ids;
  113. }
  114. });
  115. </script>
  116. </body>
  117. </html>