新增用户工程问题bug解决和用户绑定登录权限

This commit is contained in:
liang.chao 2025-04-14 15:36:13 +08:00
parent c41ef3ef77
commit 1b7ed4f52c
5 changed files with 24 additions and 23 deletions

View File

@ -226,7 +226,7 @@ public class UserController {
UserDto userDto = userService.getById(data.getData().getId());
List<SelectVo> projects = userService.getProjects(userDto);
userDto.setProjects(projects);
/*String loginType = userDto.getLoginType();
String loginType = userDto.getLoginType();
if (loginType != null && !loginType.isEmpty()){
String[] loginTypeArr = loginType.split(",");
List<Long> loginTypes = new ArrayList<>();
@ -234,7 +234,7 @@ public class UserController {
loginTypes.add(Long.parseLong(type.trim()));
}
userDto.setLoginTypes(loginTypes);
}*/
}
return ServerResponse.createSuccess(userDto);
}catch (Exception e){
log.error(e.toString(),e);

View File

@ -53,7 +53,7 @@ public class UserServiceImpl implements UserService {
if (StringUtils.isNotBlank(project)){
for (String proId : project.split(",")) {
// 新增工程
userDao.saveUserProject(userDto.getId(), proId);
userDao.saveUserProject(user.getId(), proId);
}
}
if (num > 0) {

View File

@ -52,12 +52,12 @@
</if>
</select>
<!--新增用户-->
<insert id="saveUser" parameterType="com.bonus.imgTool.model.SysUser" >
<insert id="saveUser" parameterType="com.bonus.imgTool.model.SysUser" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
insert into sys_user(login_name, user_name,
<if test="userCode != null and userCode != ''">
user_code,
</if>
sex, org_id,login_type, role_id, phone, user_type, state,
sex, org_id,login_type, role_id, user_type, state,
password,
<if test="teamId != null and teamId != ''">
team_id,
@ -67,7 +67,7 @@
<if test="userCode != null and userCode != ''">
#{userCode},
</if>
#{sex}, #{orgId},#{loginType}, #{roleId}, #{phone}, #{userType},
#{sex}, #{orgId},#{loginType}, #{roleId}, #{userType},
#{state},
#{password},
<if test="teamId != null and teamId != ''">

View File

@ -43,7 +43,7 @@ function setParams(params) {
let loginName = $('#loginName').val();
if (loginName) {
if (!(/^1[3456789]\d{9}$/.test(loginName))) {
return layer.alert("请输入正确的手机号", {icon: 2})
return layer.alert("登录账号请输入正确的手机号", {icon: 2})
}
}
if (!validatePassword(data.field.password)) {
@ -287,15 +287,16 @@ function setFormData(data) {
formSelects.value('project', selectedValues);
/*$('#teamId').val(data.teamId)
$('#teamId option[value=' + data.teamId + ']').attr('selected', true)*/
// var arrCB = data.loginTypes;
// for (var j = 0; j < arrCB.length; j++) {
// var cbthis = $("input[name='loginType']");
// for (var i = 0; i < cbthis.length; i++) {
// if (cbthis[i].value == arrCB[j]) {
// cbthis[i].checked = true;
// }
// }
// }
var arrCB = data.loginTypes;
console.log(arrCB+"arrCB");
for (var j = 0; j < arrCB.length; j++) {
var cbthis = $("input[name='loginType']");
for (var i = 0; i < cbthis.length; i++) {
if (cbthis[i].value == arrCB[j]) {
cbthis[i].checked = true;
}
}
}
layui.form.render();
}
}
@ -309,16 +310,16 @@ function saveData(data) {
let loadingMsg = layer.msg('数据上传中,请稍候...', {icon: 16, scrollbar: false, time: 0});
let url = dataUrl + "/users/addTemp";
let params = data.field;
// var arr_box = [];//固定复选框
// $('#cbGuDing input[type=checkbox]:checked').each(function () {
// arr_box.push($(this).val());
// });
var arr_box = [];//固定复选框
$('#cbGuDing input[type=checkbox]:checked').each(function () {
arr_box.push($(this).val());
});
// var arr_pro = [];//固定复选框
// $('#project input[type=checkbox]:checked').each(function () {
// arr_pro.push($(this).val());
// });
// params.loginType = arr_box.join()
params.loginType = arr_box.join()
// params.project = arr_pro.join()
// params.orgId = params.orgId_select_nodeId;
if (params.id != "") {

View File

@ -115,7 +115,7 @@
</div>
</div>-->
<!-- <div class="layui-form-item">
<div class="layui-form-item">
<label class="layui-form-label"><i style="padding: 0 10px;">*</i>登录权限</label>
<div class="layui-input-inline" id="cbGuDing" >
<input type="checkbox" name="loginType" value="1" title="后台" lay-skin="primary" checked>
@ -123,7 +123,7 @@
<input type="checkbox" name="loginType" value="3" title="app" lay-skin="primary">
<input type="hidden" id="loginType" />
</div>
</div>-->
</div>
<div class="layui-form-item" style="margin-top: 2%;" id="pwd">
<label class="layui-form-label"><i style="padding: 0 10px;">*</i>密码</label>