forked from github/dataease
Merge remote-tracking branch 'origin/main' into main
This commit is contained in:
commit
91fdee6e49
@ -26,6 +26,7 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@ -82,23 +83,27 @@ public class SysUserService {
|
||||
|
||||
/**
|
||||
* 修改用户密码清楚缓存
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@CacheEvict(value = AuthConstants.USER_CACHE_NAME, key = "'user' + #request.userId")
|
||||
@Transactional
|
||||
public int update(SysUserCreateRequest request) {
|
||||
if (StringUtils.isEmpty(request.getPassword())) {
|
||||
request.setPassword(null);
|
||||
}
|
||||
SysUser user = BeanUtils.copyBean(new SysUser(), request);
|
||||
long now = System.currentTimeMillis();
|
||||
user.setUpdateTime(now);
|
||||
deleteUserRoles(user.getUserId());//先删除用户角色关联
|
||||
saveUserRoles(user.getUserId(), request.getRoleIds());//再插入角色关联
|
||||
return sysUserMapper.updateByPrimaryKey(user);
|
||||
|
||||
return sysUserMapper.updateByPrimaryKeySelective(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户修改个人信息
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@ -123,6 +128,7 @@ public class SysUserService {
|
||||
|
||||
/**
|
||||
* 修改用户密码清楚缓存
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@ -151,9 +157,9 @@ public class SysUserService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除用户角色关联
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@ -165,6 +171,7 @@ public class SysUserService {
|
||||
|
||||
/**
|
||||
* 保存用户角色关联
|
||||
*
|
||||
* @param userId
|
||||
* @param roleIds
|
||||
*/
|
||||
|
@ -100,7 +100,8 @@ export default {
|
||||
button: 'Button',
|
||||
man: 'Man',
|
||||
woman: 'Woman',
|
||||
nick_name: 'Nick Name',
|
||||
nick_name: 'Name',
|
||||
confirmPassword: 'Confirm Password',
|
||||
upload: 'Upload',
|
||||
cover: 'Cover',
|
||||
not_cover: 'Not Cover',
|
||||
|
@ -99,7 +99,8 @@ export default {
|
||||
gender: '性別',
|
||||
man: '男',
|
||||
woman: '女',
|
||||
nick_name: '暱稱',
|
||||
nick_name: '姓名',
|
||||
confirmPassword: '確認密碼',
|
||||
upload: '上傳',
|
||||
cover: '覆蓋',
|
||||
not_cover: '不覆蓋',
|
||||
|
@ -100,7 +100,8 @@ export default {
|
||||
gender: '性别',
|
||||
man: '男',
|
||||
woman: '女',
|
||||
nick_name: '昵称',
|
||||
nick_name: '姓名',
|
||||
confirmPassword: '确认密码',
|
||||
upload: '上传',
|
||||
cover: '覆盖',
|
||||
not_cover: '不覆盖',
|
||||
@ -402,7 +403,7 @@ export default {
|
||||
special_characters_are_not_supported: '不支持特殊字符',
|
||||
mobile_number_format_is_incorrect: '手机号码格式不正确',
|
||||
email_format_is_incorrect: '邮箱格式不正确',
|
||||
password_format_is_incorrect: '有效密码:6-30位,英文大小写字母+数字+特殊字符(可选)',
|
||||
password_format_is_incorrect: '有效密码:8-30位,英文大小写字母+数字+特殊字符(可选)',
|
||||
old_password: '旧密码',
|
||||
new_password: '新密码',
|
||||
repeat_password: '确认密码',
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<layout-content :header="formType=='add' ? $t('user.create') : $t('user.modify')" back-name="system-user">
|
||||
<el-form ref="createUserForm" :model="form" :rules="rule" size="small" label-width="auto" label-position="right">
|
||||
<el-form-item :label="$t('commons.name')" prop="username">
|
||||
<el-form-item label="ID" prop="username">
|
||||
<el-input v-model="form.username" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('commons.phone')" prop="phone">
|
||||
@ -13,6 +13,12 @@
|
||||
<el-form-item :label="$t('commons.email')" prop="email">
|
||||
<el-input v-model="form.email" />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="formType !== 'modify'" :label="$t('commons.password')" prop="password">
|
||||
<el-input v-model="form.password" autocomplete="off" show-password />
|
||||
</el-form-item>
|
||||
<el-form-item v-if="formType !== 'modify'" :label="$t('commons.confirmPassword')" prop="confirmPassword">
|
||||
<el-input v-model="form.confirmPassword" autocomplete="off" show-password />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('commons.gender')">
|
||||
<el-radio-group v-model="form.gender" style="width: 178px">
|
||||
@ -127,6 +133,10 @@ export default {
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
confirmPassword: [
|
||||
{ required: true, message: this.$t('user.input_password'), trigger: 'blur' },
|
||||
{ required: true, validator: this.repeatValidator, trigger: 'blur' }
|
||||
],
|
||||
newPassword: [
|
||||
{ required: true, message: this.$t('user.input_password'), trigger: 'blur' },
|
||||
{
|
||||
@ -158,6 +168,13 @@ export default {
|
||||
this.initRoles()
|
||||
},
|
||||
methods: {
|
||||
repeatValidator(rule, value, callback) {
|
||||
if (value !== this.form.password) {
|
||||
callback(new Error(this.$t('member.inconsistent_passwords')))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
},
|
||||
create() {
|
||||
this.depts = null
|
||||
this.formType = 'add'
|
||||
@ -169,6 +186,7 @@ export default {
|
||||
this.formType = 'modify'
|
||||
this.dialogVisible = true
|
||||
this.form = Object.assign({}, row)
|
||||
this.form.password = ''
|
||||
if (this.form.deptId === 0) {
|
||||
this.form.deptId = null
|
||||
}
|
||||
|
@ -125,7 +125,7 @@
|
||||
:rules="rule"
|
||||
class="demo-ruleForm"
|
||||
>
|
||||
<el-form-item :label="$t('member.new_password')" prop="newpassword">
|
||||
<el-form-item :label="$t('member.new_password')" prop="newPassword">
|
||||
<el-input v-model="ruleForm.newPassword" type="password" autocomplete="off" show-password />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
|
@ -37,7 +37,13 @@ export default {
|
||||
{ required: true, message: this.$t('user.input_password'), trigger: 'blur' }
|
||||
],
|
||||
newPwd: [
|
||||
{ required: true, message: this.$t('user.input_password'), trigger: 'blur' }
|
||||
{ required: true, message: this.$t('user.input_password'), trigger: 'blur' },
|
||||
{
|
||||
required: true,
|
||||
pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[^]{8,30}$/,
|
||||
message: this.$t('member.password_format_is_incorrect'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
repeatPwd: [
|
||||
{ required: true, message: this.$t('user.input_password'), trigger: 'blur' },
|
||||
|
@ -2,7 +2,7 @@
|
||||
<layout-content header="个人信息">
|
||||
<div>
|
||||
<el-form ref="createUserForm" :disabled="formType !== 'modify'" :model="form" :rules="rule" size="small" label-width="auto" label-position="right">
|
||||
<el-form-item :label="$t('commons.user')" prop="username">
|
||||
<el-form-item label="ID" prop="username">
|
||||
<el-input v-model="form.username" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('commons.phone')" prop="phone">
|
||||
|
Loading…
Reference in New Issue
Block a user