loglist.html 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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" lay-filter="LAY-worder-loglist-search">
  4. <div class="layui-form-item">
  5. <div class="layui-inline">
  6. <label class="layui-form-label">招聘订单</label>
  7. <div class="layui-input-block">
  8. <select name="worderid" lay-search>
  9. <option value="">全部订单(可搜索)</option>
  10. {volist name="worderlist" id="vo"}
  11. <option value="{$vo['id']}">{$vo['title']}</option>
  12. {/volist}
  13. </select>
  14. </div>
  15. </div>
  16. <div class="layui-inline">
  17. <button class="layui-btn" lay-submit lay-filter="LAY-worder-loglist-search-btn">
  18. <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
  19. </button>
  20. <button class="layui-btn" lay-submit lay-filter="LAY-worder-loglist-export-btn">
  21. 导出
  22. </button>
  23. </div>
  24. </div>
  25. </div>
  26. <div class="layui-card-body">
  27. <div style="padding-bottom: 10px;">
  28. <button class="layui-btn layuiadmin-btn" data-type="batchdel">删除</button>
  29. </div>
  30. <table id="LAY-worder-loglist-table" lay-filter="LAY-worder-loglist-table"></table>
  31. <script type="text/html" id="setTpl">
  32. <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
  33. </script>
  34. </div>
  35. </div>
  36. </div>
  37. <script>
  38. layui.config({
  39. base: '/static/echoui/' //静态资源所在路径
  40. }).extend({
  41. index: 'lib/index' //主入口模块
  42. }).use(['index', 'form', 'set', 'table', 'selectN', 'selectM'], function() {
  43. var $ = layui.$,
  44. setter = layui.setter,
  45. admin = layui.admin,
  46. form = layui.form,
  47. table = layui.table,
  48. selectN = layui.selectN,
  49. selectM = layui.selectM;
  50. form.render();
  51. table.render({
  52. elem: '#LAY-worder-loglist-table',
  53. url: setter.baseWorkerUrl + 'worder/listlog',
  54. cols: [
  55. [
  56. { type: 'checkbox', fixed: 'left' },
  57. { field: 'id', width: 80, title: '表ID', sort: true },
  58. { field: 'wordertitle', title: '订单标题', templet: '<div>{{d.worder.title||""}}</div>' },
  59. { field: 'getworkertitle', title: '接单公司', templet: '<div>{{d.getWorker.title||""}}</div>' },
  60. { field: 'getworkerrealname', title: '负责人', templet: '<div>{{d.getWorker.realname||""}}</div>' },
  61. { field: 'getworkertitle', title: '负责人电话', templet: '<div>{{d.getWorker.mobile||""}}</div>' },
  62. { field: 'createtime', title: '接单时间', width: 170 },
  63. { title: '操作', width: 100, align: 'center', fixed: 'right', toolbar: '#setTpl' }
  64. ]
  65. ],
  66. page: true,
  67. limit: 50,
  68. cellMinWidth: 200,
  69. text: '对不起,加载出现异常!'
  70. });
  71. form.on('submit(LAY-worder-loglist-search-btn)', function(data) {
  72. table.reload('LAY-worder-loglist-table', {
  73. where: data.field,
  74. page: {
  75. curr: 1
  76. }
  77. });
  78. });
  79. form.on('submit(LAY-worder-loglist-export-btn)', function(data) {
  80. var url = setter.baseWorkerUrl + 'worder/exportlog?';
  81. for (var item in data.field) {
  82. url = url + '&' + item + '=' + data.field[item];
  83. }
  84. window.location.href = url;
  85. });
  86. table.on('edit(LAY-worder-loglist-table)', function(obj) {
  87. var id = obj.data.id,
  88. field = obj.field,
  89. value = obj.value;
  90. admin.req({
  91. url: setter.baseWorkerUrl + 'worder/fieldlog',
  92. data: { id: id, field: field, value: value },
  93. done: function(res) {
  94. layer.msg('修改成功');
  95. layui.table.reload('LAY-worder-loglist-table');
  96. }
  97. });
  98. });
  99. var active = {
  100. batchdel: function() {
  101. var checkStatus = table.checkStatus('LAY-worder-loglist-table'),
  102. checkData = checkStatus.data; //得到选中的数据
  103. if (checkData.length === 0) {
  104. return layer.msg('请选择数据');
  105. }
  106. var idarr = [];
  107. for (var i = 0; i < checkData.length; i++) {
  108. idarr.push(checkData[i].id);
  109. }
  110. layer.confirm('确定删除此报名记录吗?', function(index) {
  111. admin.req({
  112. url: setter.baseWorkerUrl + 'worder/dellog',
  113. data: {
  114. idarr: idarr
  115. },
  116. done: function(res) {
  117. table.reload('LAY-worder-loglist-table');
  118. layer.msg('已删除');
  119. }
  120. });
  121. layer.close(index);
  122. });
  123. }
  124. };
  125. table.on('tool(LAY-worder-loglist-table)', function(obj) {
  126. var data = obj.data;
  127. if (obj.event === 'del') {
  128. layer.confirm('确定删除此报名记录吗?', function(index) {
  129. admin.req({
  130. url: setter.baseWorkerUrl + 'worder/dellog',
  131. data: {
  132. idarr: [data.id]
  133. },
  134. done: function(res) {
  135. obj.del();
  136. layer.msg('已删除');
  137. }
  138. });
  139. layer.close(index);
  140. });
  141. } else if (obj.event === 'pic') {
  142. layer.photos({
  143. photos: '#pic' + data.id,
  144. anim: 5,
  145. });
  146. }
  147. });
  148. $('.layui-btn.layuiadmin-btn').on('click', function() {
  149. var type = $(this).data('type');
  150. active[type] ? active[type].call(this) : '';
  151. });
  152. });
  153. </script>