diff --git a/yanzhu-api/yanzhu-api-system/src/main/java/com/yanzhu/system/api/domain/SysUser.java b/yanzhu-api/yanzhu-api-system/src/main/java/com/yanzhu/system/api/domain/SysUser.java index d569cefe..2dc0adab 100644 --- a/yanzhu-api/yanzhu-api-system/src/main/java/com/yanzhu/system/api/domain/SysUser.java +++ b/yanzhu-api/yanzhu-api-system/src/main/java/com/yanzhu/system/api/domain/SysUser.java @@ -203,7 +203,6 @@ public class SysUser extends BaseEntity } @Xss(message = "用户账号不能包含脚本字符") - @NotBlank(message = "用户账号不能为空") @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符") public String getUserName() { diff --git a/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/controller/SysUserController.java b/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/controller/SysUserController.java index 6b085baf..2298a162 100644 --- a/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/controller/SysUserController.java +++ b/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/controller/SysUserController.java @@ -359,24 +359,11 @@ public class SysUserController extends BaseController { public AjaxResult edit(@Validated @RequestBody SysUser user) { userService.checkUserAllowed(user); userService.checkUserDataScope(user.getUserId()); - if (StringUtils.isNotEmpty(user.getUserName()) && !userService.checkUserNameUnique(user)) { - return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在"); - } else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) { + if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) { return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在"); } else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) { return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在"); } - SysUser where=new SysUser(); - where.setUserName(user.getUserName()); - List list=userService.selectUserList(where); - if(list.size()>1){ - return error("此用户名己存在,修改失败!"); - } - if(list.size()==1){ - if(user.getUserId().intValue()!=list.get(0).getUserId().intValue()){ - return error("此用户名己存在,修改失败!"); - } - } user.setUpdateBy(SecurityUtils.getUsername()); return toAjax(userService.updateUser(user)); } diff --git a/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/service/impl/SysUserServiceImpl.java b/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/service/impl/SysUserServiceImpl.java index 7bba98a3..79946a8d 100644 --- a/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/service/impl/SysUserServiceImpl.java +++ b/yanzhu-modules/yanzhu-system/src/main/java/com/yanzhu/system/service/impl/SysUserServiceImpl.java @@ -374,9 +374,7 @@ public class SysUserServiceImpl implements ISysUserService comWhere.setComId(dept.getComId()); List userComs= userComMapper.selectUserComs(comWhere); if(userComs.size()==0){ - if(isPrjUser) { - userMapper.insertUserCom(user); - } + userMapper.insertUserCom(user); } sysUser.setUserName(user.getUserName()); sysUser.setComId(user.getComId()); @@ -387,9 +385,7 @@ public class SysUserServiceImpl implements ISysUserService sysUser.setUpdateTime(user.getUpdateTime()); sysUser.setPassword(user.getPassword()); rows=userMapper.updateUser(sysUser); - if(isPrjUser) { - userExtService.updateBySysUser(sysUser); - } + userExtService.updateBySysUser(sysUser); }else{//此电话号码未注册 user.setCreateBy(user.getUpdateBy()); user.setCreateTime(user.getUpdateTime()); @@ -398,10 +394,8 @@ public class SysUserServiceImpl implements ISysUserService } rows=userMapper.insertUser(user); user.setIsActive(1l); - if(isPrjUser) { - userMapper.insertUserCom(user); - userExtService.updateBySysUser(user); - } + userMapper.insertUserCom(user); + userExtService.updateBySysUser(user); } //int rows = userMapper.insertUser(user); // 新增用户岗位关联 diff --git a/yanzhu-ui-vue3/src/api/system/user.js b/yanzhu-ui-vue3/src/api/system/user.js index 66abf907..02587732 100644 --- a/yanzhu-ui-vue3/src/api/system/user.js +++ b/yanzhu-ui-vue3/src/api/system/user.js @@ -43,7 +43,7 @@ export function updateUser(data) { method: 'put', data: { userId:data.userId, - userName:data.userName, + nickName:data.nickName, userType:data.userType, workType:data.workType, sex:data.sex, diff --git a/yanzhu-ui-vue3/src/components/ImageUpload/index.vue b/yanzhu-ui-vue3/src/components/ImageUpload/index.vue index 3d4fb6f8..bd7aa483 100644 --- a/yanzhu-ui-vue3/src/components/ImageUpload/index.vue +++ b/yanzhu-ui-vue3/src/components/ImageUpload/index.vue @@ -1,23 +1,12 @@ @@ -68,7 +63,11 @@ const props = defineProps({ // 是否显示提示 isShowTip: { type: Boolean, - default: true + default: true, + }, + previewAll: { + type: Boolean, + default: false, }, }); @@ -85,24 +84,57 @@ const fileList = ref([]); const showTip = computed( () => props.isShowTip && (props.fileType || props.fileSize) ); +const showIndex = ref(0); -watch(() => props.modelValue, val => { - if (val) { - // 首先将值转为数组 - const list = Array.isArray(val) ? val : props.modelValue.split(","); - // 然后将数组转为对象数组 - fileList.value = list.map(item => { - if (typeof item === "string") { - item = { name: item, url: item }; +watch( + () => props.modelValue, + (val) => { + if (val) { + // 首先将值转为数组 + const list = Array.isArray(val) ? val : props.modelValue.split(","); + // 然后将数组转为对象数组 + fileList.value = list.map((item) => { + if (typeof item === "string") { + item = { name: item, url: item }; + } + return item; + }); + } else { + fileList.value = []; + return []; + } + }, + { deep: true, immediate: true } +); + +function doDelete() { + proxy.$confirm("确认删除此图片?", "提示", { + confirmButtonText: "确 认", + cancelButtonText: "取 消" + }).then(() => { + handleDelete(fileList.value[showIndex.value]) + if(fileList.value.length<1){ + dialogVisible.value=false + } + showIndex.value--; + if(showIndex<0){ + showIndex=0; } - return item; - }); - } else { - fileList.value = []; - return []; - } -},{ deep: true, immediate: true }); + + }); +} +function doLeft() { + if (showIndex.value > 1) { + showIndex.value--; + } +} + +function doRight() { + if (showIndex.value < fileList.value.length - 1) { + showIndex.value++; + } +} // 上传前loading加载 function handleBeforeUpload(file) { let isImg = false; @@ -111,7 +143,7 @@ function handleBeforeUpload(file) { if (file.name.lastIndexOf(".") > -1) { fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1); } - isImg = props.fileType.some(type => { + isImg = props.fileType.some((type) => { if (file.type.indexOf(type) > -1) return true; if (fileExtension && fileExtension.indexOf(type) > -1) return true; return false; @@ -157,7 +189,7 @@ function handleUploadSuccess(res, file) { // 删除图片 function handleDelete(file) { - const findex = fileList.value.map(f => f.name).indexOf(file.name); + const findex = fileList.value.map((f) => f.name).indexOf(file.name); if (findex > -1 && uploadList.value.length === number.value) { fileList.value.splice(findex, 1); emit("update:modelValue", listToString(fileList.value)); @@ -168,7 +200,9 @@ function handleDelete(file) { // 上传结束处理 function uploadedSuccessfully() { if (number.value > 0 && uploadList.value.length === number.value) { - fileList.value = fileList.value.filter(f => f.url !== undefined).concat(uploadList.value); + fileList.value = fileList.value + .filter((f) => f.url !== undefined) + .concat(uploadList.value); uploadList.value = []; number.value = 0; emit("update:modelValue", listToString(fileList.value)); @@ -185,6 +219,7 @@ function handleUploadError() { function handlePictureCardPreview(file) { dialogImageUrl.value = file.url; dialogVisible.value = true; + showIndex.value = 0; } // 对象转成指定字符串分隔 @@ -203,6 +238,42 @@ function listToString(list, separator) { + \ No newline at end of file diff --git a/yanzhu-ui-vue3/src/views/system/user/index.vue b/yanzhu-ui-vue3/src/views/system/user/index.vue index ea224895..493912a4 100644 --- a/yanzhu-ui-vue3/src/views/system/user/index.vue +++ b/yanzhu-ui-vue3/src/views/system/user/index.vue @@ -130,7 +130,7 @@ + placeholder="请选择所属部门" check-strictly style="width:100%" @change="v=>handleChangeDept(v)" /> {{ form.dept?.deptName }} @@ -668,10 +668,14 @@ function handleUpdate(row) { } open.value = true; title.value = "修改用户"; - form.password = ""; + form.value.password = ""; data.mode = 'edit' + let oldRoleIds=form.value.roleIds + handleChangeDept(form.value.deptId,()=>{ + form.value.roleIds=oldRoleIds; + }); }); - handleChangeDept(row.deptId); + }; function getWorkType(wt) { @@ -685,10 +689,11 @@ function getWorkType(wt) { } /** 根据单位选择角色 */ -function handleChangeDept(value) { +function handleChangeDept(value,cb) { form.value.roleIds = []; getDeptRole(value).then(response => { roleOptions.value = response.data; + cb && cb(); }); } @@ -716,7 +721,6 @@ function submitForm() { data.loading = true; proxy.$refs["userRef"].validate(valid => { if (valid) { - form.value.userName = form.value.nickName; if (form.value.userId != undefined) { updateUser(form.value).then(response => { proxy.$modal.msgSuccess("修改成功"); diff --git a/yanzhu-ui-vue3/src/views/trouble/problemmodifyDraft/index.vue b/yanzhu-ui-vue3/src/views/trouble/problemmodifyDraft/index.vue index d1e9ca9d..8a529402 100644 --- a/yanzhu-ui-vue3/src/views/trouble/problemmodifyDraft/index.vue +++ b/yanzhu-ui-vue3/src/views/trouble/problemmodifyDraft/index.vue @@ -1,214 +1,16 @@ + \ No newline at end of file diff --git a/yanzhu-ui-vue3/src/views/trouble/problemmodifyDraft/uploadFiles.vue b/yanzhu-ui-vue3/src/views/trouble/problemmodifyDraft/uploadFiles.vue new file mode 100644 index 00000000..e69de29b