|  |  |  | 
|---|
|  |  |  | <i class="layui-icon"></i> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | <div class="layui-btn layui-btn-sm layui-btn-primary table-action action-more" | 
|---|
|  |  |  | shiro:hasAnyPermissions="user:add,user:update,user:password:reset,user:export"> | 
|---|
|  |  |  | shiro:hasAnyPermissions="agent:add,agent:edit"> | 
|---|
|  |  |  | <i class="layui-icon"></i> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | </div> | 
|---|
|  |  |  | 
|---|
|  |  |  | <script type="text/html" id="certify-status"> | 
|---|
|  |  |  | {{# | 
|---|
|  |  |  | var certifyStatus = { | 
|---|
|  |  |  | 0: {title: '未通过', color: 'red'}, | 
|---|
|  |  |  | 1: {title: '审核中', color: 'blue'}, | 
|---|
|  |  |  | 0: {title: '未实名', color: 'blue'}, | 
|---|
|  |  |  | 1: {title: '未实名', color: 'blue'}, | 
|---|
|  |  |  | 2: {title: '审核通过', color: 'green'}, | 
|---|
|  |  |  | 3: {title: '未实名', color: 'cyan'} | 
|---|
|  |  |  | 3: {title: '未实名', color: 'blue'} | 
|---|
|  |  |  | }[d.certifyStatus]; | 
|---|
|  |  |  | }} | 
|---|
|  |  |  | <span class="layui-badge febs-tag-{{certifyStatus.color}}">{{ certifyStatus.title }}</span> | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- 表格操作栏 start --> | 
|---|
|  |  |  | <script type="text/html" id="user-option"> | 
|---|
|  |  |  | <span shiro:lacksPermission="agent:view,agent:edit,agent:del"> | 
|---|
|  |  |  | <span shiro:lacksPermission="agent:edit,agent:del"> | 
|---|
|  |  |  | <span class="layui-badge-dot febs-bg-orange"></span> 无权限 | 
|---|
|  |  |  | </span> | 
|---|
|  |  |  | <a lay-event="detail" shiro:hasPermission="agent:view"><i | 
|---|
|  |  |  | class="layui-icon febs-edit-area febs-green"></i></a> | 
|---|
|  |  |  | <a lay-event="edit" shiro:hasPermission="agent:edit"><i | 
|---|
|  |  |  | class="layui-icon febs-edit-area febs-blue"></i></a> | 
|---|
|  |  |  | <a lay-event="del" shiro:hasPermission="agent:del"><i class="layui-icon febs-edit-area febs-red"></i></a> | 
|---|
|  |  |  | <a lay-event="reset" title="重置密码" shiro:hasPermission="agent:password:reset"><i class="layui-icon febs-edit-area febs-blue"></i></a> | 
|---|
|  |  |  | <a lay-event="edit" title="编辑" shiro:hasPermission="agent:edit"><i class="layui-icon febs-edit-area febs-blue"></i></a> | 
|---|
|  |  |  | <a lay-event="del" title="删除" shiro:hasPermission="agent:del"><i class="layui-icon febs-edit-area febs-red"></i></a> | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  | <!-- 表格操作栏 end --> | 
|---|
|  |  |  | <script data-th-inline="none" type="text/javascript"> | 
|---|
|  |  |  | 
|---|
|  |  |  | febs = layui.febs, | 
|---|
|  |  |  | form = layui.form, | 
|---|
|  |  |  | table = layui.table, | 
|---|
|  |  |  | treeSelect = layui.treeSelect, | 
|---|
|  |  |  | dropdown = layui.dropdown, | 
|---|
|  |  |  | $view = $('#febs-user'), | 
|---|
|  |  |  | $query = $view.find('#query'), | 
|---|
|  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (name === 'reset') { | 
|---|
|  |  |  | if (!checkStatus.data.length) { | 
|---|
|  |  |  | febs.alert.warn('请选择需要重置密码的用户'); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | var usernames = []; | 
|---|
|  |  |  | layui.each(checkStatus.data, function (key, item) { | 
|---|
|  |  |  | usernames.push(item.username) | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | febs.post(ctx + 'user/password/reset/' + usernames.join(','), null, function () { | 
|---|
|  |  |  | febs.alert.success('所选用户密码已重置为1234qwer'); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // if (name === 'reset') { | 
|---|
|  |  |  | //     if (!checkStatus.data.length) { | 
|---|
|  |  |  | //         febs.alert.warn('请选择需要重置密码的用户'); | 
|---|
|  |  |  | //     } else { | 
|---|
|  |  |  | //         var usernames = []; | 
|---|
|  |  |  | //         layui.each(checkStatus.data, function (key, item) { | 
|---|
|  |  |  | //             usernames.push(item.username) | 
|---|
|  |  |  | //         }); | 
|---|
|  |  |  | //         febs.post(ctx + 'user/password/reset/' + usernames.join(','), null, function () { | 
|---|
|  |  |  | //             febs.alert.success('所选用户密码已重置为1234qwer'); | 
|---|
|  |  |  | //         }); | 
|---|
|  |  |  | //     } | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | options: [{ | 
|---|
|  |  |  | name: 'add', | 
|---|
|  |  |  | 
|---|
|  |  |  | name: 'delete', | 
|---|
|  |  |  | title: '删除代理商', | 
|---|
|  |  |  | perms: 'agent:del' | 
|---|
|  |  |  | }, { | 
|---|
|  |  |  | name: 'reset', | 
|---|
|  |  |  | title: '密码重置', | 
|---|
|  |  |  | perms: 'agent:password:reset' | 
|---|
|  |  |  | }] | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 下拉框选择器 | 
|---|
|  |  |  | treeSelect.render({ | 
|---|
|  |  |  | elem: $view.find('#dept'), | 
|---|
|  |  |  | type: 'get', | 
|---|
|  |  |  | data: ctx + 'dept/select/tree', | 
|---|
|  |  |  | placeholder: '请选择', | 
|---|
|  |  |  | search: false | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 初始化表格操作栏各个按钮功能 | 
|---|
|  |  |  | table.on('tool(userTable)', function (obj) { | 
|---|
|  |  |  | var data = obj.data, | 
|---|
|  |  |  | layEvent = obj.event; | 
|---|
|  |  |  | if (layEvent === 'detail') { | 
|---|
|  |  |  | febs.modal.view('用户信息', 'system/user/detail/' + data.username, { | 
|---|
|  |  |  | area: $(window).width() <= 750 ? '95%' : '660px' | 
|---|
|  |  |  | if (layEvent === 'reset') { | 
|---|
|  |  |  | febs.modal.confirm('重置密码', '确定重置该用户密码?', function () { | 
|---|
|  |  |  | febs.post(ctx + 'agent/reset/' + data.id, null, function () { | 
|---|
|  |  |  | febs.alert.success('所选用户密码已重置为1234qwer'); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (layEvent === 'del') { | 
|---|
|  |  |  | febs.modal.confirm('删除用户', '确定删除该用户?', function () { | 
|---|
|  |  |  | deleteUsers(data.userId); | 
|---|
|  |  |  | deleteUsers(data.id); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (layEvent === 'edit') { | 
|---|
|  |  |  | febs.modal.open('修改用户', 'system/user/update/' + data.username, { | 
|---|
|  |  |  | febs.modal.open('修改用户', '/agent/agentEdit/' + data.id, { | 
|---|
|  |  |  | area: $(window).width() <= 750 ? '90%' : '50%', | 
|---|
|  |  |  | offset: '30px', | 
|---|
|  |  |  | btn: ['提交', '取消'], | 
|---|
|  |  |  | 
|---|
|  |  |  | // 刷新按钮 | 
|---|
|  |  |  | $reset.on('click', function () { | 
|---|
|  |  |  | $searchForm[0].reset(); | 
|---|
|  |  |  | treeSelect.revokeNode('dept'); | 
|---|
|  |  |  | sortObject.type = 'null'; | 
|---|
|  |  |  | createTimeTo = null; | 
|---|
|  |  |  | createTimeFrom = null; | 
|---|
|  |  |  | 
|---|
|  |  |  | {field: 'name', title: '代理姓名', minWidth: 100, align: 'center'}, | 
|---|
|  |  |  | {field: 'account', title: '代理账号', minWidth: 100, align: 'center'}, | 
|---|
|  |  |  | {field: 'inviteId', title: '代理UID', minWidth: 100, align: 'center'}, | 
|---|
|  |  |  | {field: 'phone', title: '手机号', minWidth: 100, align: 'center'}, | 
|---|
|  |  |  | {field: 'email', title: '邮箱', minWidth: 100, align: 'center'}, | 
|---|
|  |  |  | {field: 'referId', title: '上级UID', minWidth: 100, align: 'center'}, | 
|---|
|  |  |  | {field: 'telphone', title: '联系方式', minWidth: 130, align: 'center'}, | 
|---|
|  |  |  | // {field: 'email', title: '邮箱', minWidth: 180, align: 'center'}, | 
|---|
|  |  |  | {field: 'refererId', title: '上级UID', minWidth: 100, align: 'center'}, | 
|---|
|  |  |  | {title: '是否实名', templet: '#certify-status', minWidth: 100, align: 'center'}, | 
|---|
|  |  |  | {field: 'childCnt', title: '发展代理数', minWidth: 100, align: 'center'}, | 
|---|
|  |  |  | {field: 'chargeTotal', title: '充值总额', minWidth: 100, align: 'center'}, | 
|---|
|  |  |  | 
|---|
|  |  |  | febs.alert.warn('所选用户包含当前登录用户,无法删除'); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | febs.get(ctx + 'user/delete/' + userIds, null, function () { | 
|---|
|  |  |  | febs.get(ctx + 'agent/del/' + userIds, null, function () { | 
|---|
|  |  |  | febs.alert.success('删除用户成功'); | 
|---|
|  |  |  | $query.click(); | 
|---|
|  |  |  | }); | 
|---|