adminlog.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. define(['jquery', 'table', 'form','layui'], function($, Table, Form,layui) {
  2. var Controller = {
  3. index: function() {
  4. Table.init = {
  5. table_elem: '#currentTable',
  6. table_render_id: 'currentTable',
  7. delete_url: "auth.adminlog/deletelog",
  8. detail_url: "auth.adminlog/detail",
  9. };
  10. Table.render({
  11. init: Table.init,
  12. toolbar: ['refresh',
  13. {
  14. text: '删除一个月前日志',
  15. url: Table.init.delete_url,
  16. auth: 'delete',
  17. icon: 'iconfont icon-delete-bin-line',
  18. class: 'layui-btn layui-btn-sm layui-btn-danger btn-ajax',
  19. extend: 'data-refresh="true"',
  20. }
  21. ],
  22. url: 'auth.adminlog/index',
  23. cols: [
  24. [
  25. { field: 'id', width: 80, title: 'ID', sort: true },
  26. { field: 'username', width: 120, title: '用户名' },
  27. { field: 'title', minWidth: 150, title: '标题', searchOp: 'like' },
  28. { field: 'url', minWidth: 180, title: '操作URL' },
  29. { field: 'ip', width: 120, title: 'IP' },
  30. {
  31. field: 'useragent',
  32. width: 120,
  33. title: 'Browser',
  34. templet: function(d) {
  35. return '<span>' + layui.util.escape(d.useragent.split(" ")[0]) + '</span>';
  36. }
  37. },
  38. { field: 'create_time', width: 180, title: '时间', search: 'range' },
  39. {
  40. width: 90,
  41. title: '操作',
  42. templet: Table.formatter.tool,
  43. operat: [
  44. {
  45. text: '详情',
  46. url: Table.init.detail_url,
  47. auth:'detail',
  48. icon: 'iconfont icon-zoom-in-line',
  49. class: 'layui-btn layui-btn-xs layui-btn-normal btn-dialog',
  50. },
  51. ]
  52. }
  53. ]
  54. ],
  55. page: {}
  56. });
  57. Table.api.bindevent();
  58. },
  59. };
  60. return Controller;
  61. });