fbrokerlist.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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-broker-fbrokerlist-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. <input type="text" name="keywords" placeholder="请输入" autocomplete="off" class="layui-input">
  9. </div>
  10. </div>
  11. <div class="layui-inline">
  12. <label class="layui-form-label">状态</label>
  13. <div class="layui-input-block">
  14. <select name="status">
  15. <option value="">全部状态</option>
  16. <option value="1">待处理</option>
  17. <option value="2">处理中</option>
  18. <option value="3">已处理</option>
  19. </select>
  20. </div>
  21. </div>
  22. <div class="layui-inline">
  23. <button class="layui-btn" lay-submit lay-filter="LAY-broker-fbrokerlist-btn">
  24. <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
  25. </button>
  26. </div>
  27. </div>
  28. </div>
  29. <div class="layui-card-body">
  30. <div style="padding-bottom: 10px;">
  31. <button class="layui-btn layuiadmin-btn" data-type="batchdel">删除</button>
  32. </div>
  33. <table id="LAY-broker-fbrokerlist-table" lay-filter="LAY-broker-fbrokerlist-table"></table>
  34. <script type="text/html" id="setTpl">
  35. <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
  36. <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
  37. </script>
  38. </div>
  39. </div>
  40. </div>
  41. <script>
  42. layui.config({
  43. base: '/static/echoui/' //静态资源所在路径
  44. }).extend({
  45. index: 'lib/index' //主入口模块
  46. }).use(['index', 'form', 'set', 'table'], function() {
  47. var $ = layui.$,
  48. setter = layui.setter,
  49. admin = layui.admin,
  50. form = layui.form,
  51. table = layui.table;
  52. form.render();
  53. table.render({
  54. elem: '#LAY-broker-fbrokerlist-table',
  55. url: setter.baseAdminUrl + 'broker/listfbroker',
  56. cols: [
  57. [
  58. { type: 'checkbox', fixed: 'left' },
  59. { field: 'id', width: 80, title: '表ID', sort: true },
  60. { field: 'realname', width: 150, title: '姓名', edit: 'text' },
  61. { field: 'mobile', width: 150, title: '手机号', edit: 'text' },
  62. { field: 'address', minWidth: 250, title: '现住地址', edit: 'text' },
  63. { field: 'idcard', minWidth: 200, title: '身份证号', edit: 'text' },
  64. { field: 'recommender', width: 150, title: '推荐人', edit: 'text' },
  65. { field: 'remark', minWidth: 250, title: '备注', edit: 'text' },
  66. { field: 'status_text', title: '状态', minWidth: 80, align: 'center' },
  67. { field: 'createtime', title: '创建时间', width: 170 },
  68. { title: '操作', width: 150, align: 'center', fixed: 'right', toolbar: '#setTpl' }
  69. ]
  70. ],
  71. page: true,
  72. limit: 50,
  73. cellMinWidth: 150,
  74. text: '对不起,加载出现异常!'
  75. });
  76. form.on('submit(LAY-broker-fbrokerlist-btn)', function(data) {
  77. table.reload('LAY-broker-fbrokerlist-table', {
  78. where: data.field,
  79. page: {
  80. curr: 1
  81. }
  82. });
  83. });
  84. table.on('edit(LAY-broker-fbrokerlist-table)', function(obj) {
  85. var id = obj.data.id,
  86. field = obj.field,
  87. value = obj.value;
  88. admin.req({
  89. url: setter.baseAdminUrl + 'broker/fieldfbroker',
  90. data: { id: id, field: field, value: value },
  91. done: function(res) {
  92. layer.msg('修改成功');
  93. layui.table.reload('LAY-broker-fbrokerlist-table');
  94. }
  95. });
  96. });
  97. var active = {
  98. batchdel: function() {
  99. var checkStatus = table.checkStatus('LAY-broker-fbrokerlist-table'),
  100. checkData = checkStatus.data; //得到选中的数据
  101. if (checkData.length === 0) {
  102. return layer.msg('请选择数据');
  103. }
  104. var idarr = [];
  105. for (var i = 0; i < checkData.length; i++) {
  106. idarr.push(checkData[i].id);
  107. }
  108. layer.confirm('确定删除此申请记录吗?', function(index) {
  109. admin.req({
  110. url: setter.baseAdminUrl + 'broker/delfbroker',
  111. data: {
  112. idarr: idarr
  113. },
  114. done: function(res) {
  115. table.reload('LAY-broker-fbrokerlist-table');
  116. layer.msg('已删除');
  117. }
  118. });
  119. layer.close(index);
  120. });
  121. },
  122. add: function() {
  123. var index = layer.open({
  124. type: 2,
  125. title: '添加申请记录',
  126. content: 'fbrokerform.html?id=0',
  127. maxmin: true,
  128. area: ['750px', '480px']
  129. });
  130. layer.full(index);
  131. }
  132. };
  133. table.on('tool(LAY-broker-fbrokerlist-table)', function(obj) {
  134. var data = obj.data;
  135. if (obj.event === 'del') {
  136. layer.confirm('确定删除此申请记录吗?', function(index) {
  137. admin.req({
  138. url: setter.baseAdminUrl + 'broker/delfbroker',
  139. data: {
  140. idarr: [data.id]
  141. },
  142. done: function(res) {
  143. obj.del();
  144. layer.msg('已删除');
  145. }
  146. });
  147. layer.close(index);
  148. });
  149. } else if (obj.event === 'edit') {
  150. var index = layer.open({
  151. type: 2,
  152. title: '编辑申请记录',
  153. content: 'fbrokerform.html?id=' + data.id,
  154. maxmin: true,
  155. area: ['750px', '480px']
  156. });
  157. layer.full(index);
  158. }
  159. });
  160. $('.layui-btn.layuiadmin-btn').on('click', function() {
  161. var type = $(this).data('type');
  162. active[type] ? active[type].call(this) : '';
  163. });
  164. });
  165. </script>