| | |
| | | |
| | | // 获取所有角色 |
| | | layer.load(2); |
| | | admin.req('api-user/allRoles', {}, function (data) { |
| | | admin.req('api-user/findByMap', {}, function (data) { |
| | | layer.closeAll('loading'); |
| | | if (0 == data.code) { |
| | | // 渲染多选下拉框 |
| | |
| | | formSelects.value('roleId', rds); |
| | | } |
| | | } else { |
| | | layer.msg('获取角色失败', {icon: 2, time: 500}); |
| | | layer.msg('获取角色失败', {icon: 2, time: 2000}); |
| | | } |
| | | }, 'GET'); |
| | | |
| | | // 表单提交事件 |
| | | form.on('submit(user-form-submit)', function (data) { |
| | | layer.load(2); |
| | | var datadto= data.field |
| | | admin.req('api-user/users/saveOrUpdate', JSON.stringify(data.field), function (data) { |
| | | layer.closeAll('loading'); |
| | | if (data.code == 0) { |
| | | layer.msg(data.msg, {icon: 1, time: 500}); |
| | | if (data.code == 0) { |
| | | if(datadto.id==null||datadto.id==''){ |
| | | layer.alert("用户添加成功,默认密码为:"+data.data.password); |
| | | } |
| | | admin.finishPopupCenter(); |
| | | } else { |
| | | layer.msg(data.msg, {icon: 2, time: 500}); |
| | | layer.msg(data.msg, {icon: 2, time: 2000}); |
| | | } |
| | | }, "POST"); |
| | | return false; |