截流自动化的商城平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. {layout name="layout1" /}
  2. <style>
  3. .layui-table-cell {
  4. font-size: 14px;
  5. padding: 0 5px;
  6. height: auto;
  7. overflow: visible;
  8. text-overflow: inherit;
  9. white-space: normal;
  10. word-break: break-all;
  11. }
  12. .goods-content > div:not(:last-of-type) {
  13. border-bottom: 1px solid #DCDCDC;
  14. }
  15. .goods-data::after {
  16. display: block;
  17. content: '';
  18. clear: both;
  19. }
  20. .goods_name_hide {
  21. overflow: hidden;
  22. white-space: nowrap;
  23. text-overflow: ellipsis;
  24. }
  25. </style>
  26. <div class="wrapper">
  27. <div class="layui-card">
  28. <div class="layui-card-body">
  29. <div class="layui-collapse like-layui-collapse" lay-accordion="" style="border:1px dashed #c4c4c4">
  30. <div class="layui-colla-item">
  31. <h2 class="layui-colla-title like-layui-colla-title" style="background-color: #fff">操作提示</h2>
  32. <div class="layui-colla-content layui-show">
  33. <p>*记录管理后台系统日志,可用于排查事故原因</p>
  34. </div>
  35. </div>
  36. </div>
  37. <div class="layui-form" style="margin-top:15px;">
  38. <div class="layui-form-item">
  39. <div class="layui-row">
  40. <div class="layui-inline">
  41. <label class="layui-form-label">管理员:</label>
  42. <div class="layui-input-block">
  43. <input type="text" name="account" id="account" placeholder="请输入搜索内容"
  44. autocomplete="off" class="layui-input">
  45. </div>
  46. </div>
  47. <div class="layui-inline">
  48. <label class="layui-form-label">访问链接:</label>
  49. <div class="layui-input-block">
  50. <input type="text" name="uri" id="uri" placeholder="请输入搜索内容"
  51. autocomplete="off" class="layui-input">
  52. </div>
  53. </div>
  54. <div class="layui-inline">
  55. <label class="layui-form-label">访问方式:</label>
  56. <div class="layui-input-block">
  57. <select name="type" id="type">
  58. <option value="">全部</option>
  59. <option value="GET">GET</option>
  60. <option value="POST">POST</option>
  61. </select>
  62. </div>
  63. </div>
  64. <div class="layui-inline">
  65. <label class="layui-form-label">来源ip:</label>
  66. <div class="layui-input-block">
  67. <input type="text" name="ip" id="ip" placeholder="请输入搜索内容"
  68. autocomplete="off" class="layui-input">
  69. </div>
  70. </div>
  71. </div>
  72. <div class="layui-row">
  73. <div class="layui-inline">
  74. <label class="layui-form-label">日志时间:</label>
  75. <div class="layui-input-inline">
  76. <div class="layui-input-inline">
  77. <input type="text" name="start_time" class="layui-input" id="start_time"
  78. placeholder="" autocomplete="off">
  79. </div>
  80. </div>
  81. <div class="layui-input-inline" style="margin-right: 5px;width: 20px;">
  82. <label class="layui-form-mid">至</label>
  83. </div>
  84. <div class="layui-input-inline">
  85. <input type="text" name="end_time" class="layui-input" id="end_time"
  86. placeholder="" autocomplete="off">
  87. </div>
  88. </div>
  89. <div class="layui-inline">
  90. <div class="layui-btn-group">
  91. <button type="button" id="today" day="1" class="layui-btn layui-btn-primary day">今天</button>
  92. <button type="button" day="-1" class="layui-btn layui-btn-primary day">昨天</button>
  93. <button type="button" day="7" class="layui-btn layui-btn-primary day">最近7天</button>
  94. <button type="button" day="30" class="layui-btn layui-btn-primary day">最近30天</button>
  95. </div>
  96. </div>
  97. <div class="layui-inline">
  98. <button class="layui-btn layuiadmin-btn-ad {$view_theme_color}" lay-submit
  99. lay-filter="order-search">查询
  100. </button>
  101. <button class="layui-btn layuiadmin-btn-ad layui-btn-primary " lay-submit
  102. lay-filter="order-clear-search">重置
  103. </button>
  104. </div>
  105. </div>
  106. </div>
  107. </div>
  108. <!--数据表格-->
  109. <table id="order-lists" lay-filter="order-lists"></table>
  110. </div>
  111. </div>
  112. </div>
  113. <script>
  114. layui.config({
  115. version:"{$front_version}",
  116. base: '/static/lib/' //静态资源所在路径
  117. }).use(['table', 'laydate'], function () {
  118. var $ = layui.$
  119. , form = layui.form
  120. , table = layui.table
  121. , element = layui.element
  122. , laydate = layui.laydate;
  123. //监听搜索
  124. form.on('submit(order-search)', function (data) {
  125. var field = data.field;
  126. //执行重载
  127. table.reload('order-lists', {
  128. where: field
  129. });
  130. });
  131. //清空查询
  132. form.on('submit(order-clear-search)', function () {
  133. $('#account').val('');
  134. $('#uri').val('');
  135. $('#ip').val('');
  136. $('#start_time').val('');
  137. $('#end_time').val('');
  138. $('#type').val('');
  139. form.render('select');
  140. $('.day').removeClass('layui-btn-normal');
  141. $('.day').removeClass('layui-btn-primary');
  142. $('.day').addClass('layui-btn-primary');
  143. //刷新列表
  144. table.reload('order-lists', {
  145. where: []
  146. });
  147. });
  148. //日期时间范围
  149. laydate.render({
  150. elem: '#start_time'
  151. , type: 'datetime'
  152. ,theme: '#1E9FFF'
  153. });
  154. laydate.render({
  155. elem: '#end_time'
  156. , type: 'datetime'
  157. ,theme: '#1E9FFF'
  158. });
  159. $('.day').click(function(){
  160. $('.day').removeClass('layui-btn-normal');
  161. $('.day').removeClass('layui-btn-primary');
  162. $('.day').addClass('layui-btn-primary');
  163. $(this).removeClass('layui-btn-primary');
  164. $(this).addClass('layui-btn-normal');
  165. var day = $(this).attr('day');
  166. switch (day) {
  167. case '-1':
  168. $('#start_time').val('{$yesterday[0]}');
  169. $('#end_time').val('{$yesterday[1]}');
  170. break;
  171. case '1':
  172. $('#start_time').val('{$today[0]}');
  173. $('#end_time').val('{$today[1]}');
  174. break;
  175. case '7':
  176. $('#start_time').val('{$days_ago7[0]}');
  177. $('#end_time').val('{$days_ago7[1]}');
  178. break;
  179. case '30':
  180. $('#start_time').val('{$days_ago30[0]}');
  181. $('#end_time').val('{$days_ago30[1]}');
  182. break;
  183. }
  184. });
  185. //获取列表
  186. getList();
  187. function getList() {
  188. table.render({
  189. limit:20,
  190. elem: '#order-lists'
  191. , url: '{:url("system.log/lists")}'
  192. , cols: [[
  193. {field: 'id', title: '记录ID', width: 60, align: 'center'}
  194. , {field: 'account', title: '管理员', align: 'center', width: 80}
  195. , {field: 'uri', title: '访问链接', align: 'center', width: 200}
  196. , {field: 'type', title: '访问方式', align: 'center', width: 80}
  197. , {field: 'param', title: '访问参数', align: 'left', width: 200}
  198. , {field: 'ip', title: '来源', align: 'center', width: 110}
  199. , {fixed: 'right', field: 'create_time', title: '日志时间', align: 'center', width: 160}
  200. ]]
  201. , page: true
  202. , text: {none: '暂无数据!'}
  203. , parseData: function (res) { //将原始数据解析成 table 组件所规定的数据
  204. return {
  205. "code": res.code,
  206. "msg": res.msg,
  207. "count": res.data.count, //解析数据长度
  208. "data": res.data.lists, //解析数据列表
  209. };
  210. },
  211. response: {
  212. statusCode: 1
  213. }
  214. ,done: function(res, curr, count){
  215. // 解决操作栏因为内容过多换行问题
  216. $(".layui-table-main tr").each(function (index, val) {
  217. $($(".layui-table-fixed-l .layui-table-body tbody tr")[index]).height($(val).height());
  218. $($(".layui-table-fixed-r .layui-table-body tbody tr")[index]).height($(val).height());
  219. });
  220. }
  221. });
  222. }
  223. });
  224. </script>