userlist.html 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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-user-userlist-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="groupsid" lay-search>
  15. <option value="">全部用户组(可搜索)</option>
  16. {volist name="groupslist" id="vo"}
  17. <option value="{$vo.id}">{$vo.title}</option>
  18. {/volist}
  19. </select>
  20. </div>
  21. </div>
  22. <div class="layui-inline">
  23. <label class="layui-form-label">职业顾问</label>
  24. <div class="layui-input-block">
  25. <select name="brokerid" lay-search>
  26. <option value="">全部职业顾问(可搜索)</option>
  27. {volist name="brokerlist" id="vo"}
  28. <option value="{$vo.id}">{$vo.title}</option>
  29. {/volist}
  30. </select>
  31. </div>
  32. </div>
  33. <div class="layui-inline">
  34. <label class="layui-form-label">状态</label>
  35. <div class="layui-input-block">
  36. <select name="status">
  37. <option value="">全部状态</option>
  38. <option value="1">待审核</option>
  39. <option value="2">已通过</option>
  40. <option value="3">未通过</option>
  41. </select>
  42. </div>
  43. </div>
  44. <div class="layui-inline">
  45. <label class="layui-form-label">实名认证</label>
  46. <div class="layui-input-block">
  47. <select name="authstatus">
  48. <option value="">全部认证状态</option>
  49. <option value="1">待认证</option>
  50. <option value="2">待审核</option>
  51. <option value="3">已认证</option>
  52. </select>
  53. </div>
  54. </div>
  55. <div class="layui-inline">
  56. <label class="layui-form-label">跟进状态</label>
  57. <div class="layui-input-block">
  58. <select name="followstatus">
  59. <option value="">全部跟进状态</option>
  60. <option value="1">未跟进</option>
  61. <option value="2">未面试</option>
  62. <option value="3">面试通过</option>
  63. <option value="4">面试未通过</option>
  64. <option value="5">用户放弃</option>
  65. <option value="6">已入职</option>
  66. <option value="7">已离职</option>
  67. </select>
  68. </div>
  69. </div>
  70. <div class="layui-inline">
  71. <button class="layui-btn" lay-submit lay-filter="LAY-user-userlist-search-btn">
  72. <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
  73. </button>
  74. <button class="layui-btn" lay-submit lay-filter="LAY-user-userlist-export-btn">
  75. 导出
  76. </button>
  77. </div>
  78. </div>
  79. </div>
  80. <div class="layui-card-body">
  81. <div style="padding-bottom: 10px;">
  82. <button class="layui-btn layuiadmin-btn" data-type="add">添加</button>
  83. </div>
  84. <table id="LAY-user-userlist-table" lay-filter="LAY-user-userlist-table"></table>
  85. <script type="text/html" id="avatarTpl">
  86. {{# if(d.avatar != ''){ }}
  87. <div id="pic{{d.id}}" lay-event="pic">
  88. <img style="width: 100%; height: 100%;" src="{{d.avatar}}">
  89. </div>
  90. {{# } }}
  91. </script>
  92. <script type="text/html" id="groupsidTpl">
  93. {{d.groupsid == 0 ? '' : d.userGroups.title}}
  94. </script>
  95. <script type="text/html" id="brokeridTpl">
  96. {{d.brokerid == 0 ? '' : d.broker.title}}
  97. </script>
  98. <script type="text/html" id="setTpl">
  99. <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="auths"><i class="layui-icon layui-icon-rate-half"></i>授权</a>
  100. <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="follow"><i class="layui-icon layui-icon-engine"></i>跟进</a>
  101. <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
  102. </script>
  103. </div>
  104. </div>
  105. </div>
  106. <script>
  107. layui.config({
  108. base: '/static/echoui/' //静态资源所在路径
  109. }).extend({
  110. index: 'lib/index' //主入口模块
  111. }).use(['index', 'form', 'set', 'table'], function() {
  112. var $ = layui.$,
  113. setter = layui.setter,
  114. admin = layui.admin,
  115. form = layui.form,
  116. table = layui.table;
  117. form.render();
  118. table.render({
  119. elem: '#LAY-user-userlist-table',
  120. url: setter.baseAgentUrl + 'user/listuser',
  121. cols: [
  122. [
  123. { type: 'checkbox', fixed: 'left' },
  124. { field: 'id', width: 80, title: '表ID', sort: true },
  125. { field: 'avatar', width: 60, title: '头像', templet: '#avatarTpl' },
  126. { field: 'nickname', title: '昵称', edit: 'text' },
  127. { field: 'realname', title: '姓名', edit: 'text' },
  128. { field: 'mobile', title: '手机号' },
  129. { field: 'status_text', title: '状态', minWidth: 100, align: 'center' },
  130. { field: 'isvip_text', title: '是否VIP', minWidth: 100, align: 'center' },
  131. { field: 'authstatus_text', title: '实名认证', minWidth: 100, align: 'center' },
  132. { field: 'groupsid', title: '用户组', templet: '#groupsidTpl' },
  133. { field: 'brokerid', title: '职业顾问', templet: '#brokeridTpl' },
  134. { field: 'createtime', title: '注册时间', width: 170, sort: true },
  135. { field: 'followstatus_text', title: '跟进状态', minWidth: 150, align: 'center' },
  136. { title: '操作', minWidth: 220, align: 'center', fixed: 'right', toolbar: '#setTpl' }
  137. ]
  138. ],
  139. page: true,
  140. limit: 50,
  141. cellMinWidth: 200,
  142. text: '对不起,加载出现异常!'
  143. });
  144. form.on('submit(LAY-user-userlist-search-btn)', function(data) {
  145. table.reload('LAY-user-userlist-table', {
  146. where: data.field,
  147. page: {
  148. curr: 1
  149. }
  150. });
  151. });
  152. form.on('submit(LAY-user-userlist-export-btn)', function(data) {
  153. var url = setter.baseAgentUrl + 'user/exportuser?';
  154. for (var item in data.field) {
  155. url = url + '&' + item + '=' + data.field[item];
  156. }
  157. window.location.href = url;
  158. });
  159. //监听单元格编辑
  160. table.on('edit(LAY-user-userlist-table)', function(obj) {
  161. var id = obj.data.id,
  162. field = obj.field,
  163. value = obj.value;
  164. admin.req({
  165. url: setter.baseAgentUrl + 'user/fielduser',
  166. data: { id: id, field: field, value: value },
  167. done: function(res) {
  168. layer.msg('修改成功');
  169. layui.table.reload('LAY-user-userlist-table');
  170. }
  171. });
  172. });
  173. var active = {
  174. add: function() {
  175. var index = layer.open({
  176. type: 2,
  177. title: '添加用户',
  178. content: 'userform.html?id=0',
  179. maxmin: true,
  180. area: ['550px', '550px']
  181. });
  182. layer.full(index);
  183. }
  184. };
  185. table.on('tool(LAY-user-userlist-table)', function(obj) {
  186. var data = obj.data;
  187. if (obj.event === 'auths') {
  188. var index = layer.open({
  189. type: 2,
  190. title: '用户【' + data.nickname + '】授权列表',
  191. content: 'authslist.html?userid=' + data.id,
  192. maxmin: true,
  193. area: ['750px', '550px']
  194. });
  195. layer.full(index);
  196. } else if (obj.event === 'follow') {
  197. var index = layer.open({
  198. type: 2,
  199. title: '用户【' + data.nickname + ' - ' + data.mobile + '】跟进记录',
  200. content: 'follow.html?userid=' + data.id,
  201. maxmin: true,
  202. area: ['750px', '550px']
  203. });
  204. layer.full(index);
  205. } else if (obj.event === 'edit') {
  206. var index = layer.open({
  207. type: 2,
  208. title: '编辑用户',
  209. content: 'userform.html?id=' + data.id,
  210. maxmin: true,
  211. area: ['550px', '550px']
  212. });
  213. layer.full(index);
  214. } else if (obj.event === 'pic') {
  215. layer.photos({
  216. photos: '#pic' + data.id,
  217. anim: 5,
  218. });
  219. }
  220. });
  221. $('.layui-btn.layuiadmin-btn').on('click', function() {
  222. var type = $(this).data('type');
  223. active[type] ? active[type].call(this) : '';
  224. });
  225. });
  226. </script>
  227. </body>
  228. </html>