log.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <div class="layui-fluid">
  2. <div class="layui-card">
  3. <div class="layui-form layui-form-pane layui-card-header layuiadmin-card-header-auto">
  4. <div class="layui-inline">
  5. <label class="layui-form-label">状态</label>
  6. <div class="layui-input-block">
  7. <select name="status">
  8. <option value="">全部状态</option>
  9. {volist name="status_list" id="v"}
  10. <option value="{$key}">{$v}</option>
  11. {/volist}
  12. </select>
  13. </div>
  14. </div>
  15. <div class="layui-inline">
  16. <button class="layui-btn" lay-submit lay-filter="{$lay_btn}">
  17. <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
  18. </button>
  19. </div>
  20. </div>
  21. <div class="layui-card-body">
  22. <table id="{$lay_table}" lay-filter="{$lay_table}"></table>
  23. </div>
  24. </div>
  25. </div>
  26. <script>
  27. layui.use(['index', 'form', 'set', 'table'], function () {
  28. const $ = layui.$;
  29. const admin = layui.admin;
  30. const form = layui.form;
  31. const table = layui.table;
  32. form.render();
  33. table.render({
  34. elem: '#{$lay_table}',
  35. url: "{:url('sms/listLog')}",
  36. cols: [
  37. [
  38. {field: 'id', width: 80,title: 'ID'},
  39. {field: 'token', width: 160, title: 'token'},
  40. {field: 'ip', width: 120, title: 'ip'},
  41. {field: 'content', title: '内容'},
  42. {field: 'create_time', width: 160, title: '发送时间'},
  43. {field: 'status_text', width: 120, title: '状态'},
  44. {field: 'error', width: 160,title: '错误提示'},
  45. ]
  46. ],
  47. page: true,
  48. limit: 50,
  49. cellMinWidth: 150,
  50. text: '对不起,加载出现异常!'
  51. });
  52. //监听搜索
  53. form.on('submit({$lay_btn})', function (data) {
  54. table.reload('{$lay_table}', {
  55. where: data.field,
  56. page: {
  57. curr: 1
  58. }
  59. });
  60. });
  61. //事件
  62. const active = {
  63. add: function () {
  64. const index = layer.open({
  65. type: 2,
  66. title: '添加授权',
  67. content: "{:url('sms/authForm')}",
  68. maxmin: true,
  69. area: ['550px', '550px']
  70. });
  71. layer.full(index);
  72. },
  73. };
  74. //监听工具条
  75. table.on('tool({$lay_table})', function (obj) {
  76. const data = obj.data;
  77. if (obj.event === 'del') {
  78. layer.confirm('确定删除此授权吗?', function (index) {
  79. admin.req({
  80. url: "{:url('sms/delAuth')}",
  81. data: {
  82. id: data.id
  83. },
  84. done: function (res) {
  85. obj.del();
  86. layer.msg('已删除');
  87. }
  88. });
  89. layer.close(index);
  90. });
  91. } else if (obj.event === 'edit') {
  92. const index = layer.open({
  93. type: 2,
  94. title: '编辑授权',
  95. content: "{:url('sms/authForm')}?id=" + data.id,
  96. maxmin: true,
  97. area: ['550px', '550px']
  98. });
  99. layer.full(index);
  100. }
  101. });
  102. $('.layui-btn.layuiadmin-btn').on('click', function () {
  103. const type = $(this).data('type');
  104. active[type] ? active[type].call(this) : '';
  105. });
  106. });
  107. </script>