iconfont
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
dc66bdb40c
commit
88d20acfcf
|
@ -96,6 +96,60 @@ export default {
|
||||||
props: {
|
props: {
|
||||||
userId: { type: String, default: '' }
|
userId: { type: String, default: '' }
|
||||||
},
|
},
|
||||||
|
created() {
|
||||||
|
this.getUserTypeList()
|
||||||
|
if (this.userId !== '') {
|
||||||
|
this.getUserInfo()
|
||||||
|
this.type = 1
|
||||||
|
} else {
|
||||||
|
this.type = 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleSave() {
|
||||||
|
this.$refs.userForm.validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
this.isDisabled = true
|
||||||
|
const selectedUserType = this.userTypeOptions.filter(item => item.Id === this.user.UserTypeId)
|
||||||
|
if (selectedUserType.length > 0) {
|
||||||
|
this.user.UserTypeEnum = selectedUserType[0].UserTypeEnum
|
||||||
|
}
|
||||||
|
this.user.BaseUrl = `${location.protocol}//${location.host}/login`
|
||||||
|
this.user.RouteUrl = `${location.protocol}//${location.host}/email-recompose`
|
||||||
|
if (this.user.Id) {
|
||||||
|
updateUser(this.user).then(res => {
|
||||||
|
this.isDisabled = false
|
||||||
|
this.$message.success('Updated successfully')
|
||||||
|
}).catch(() => { this.isDisabled = false })
|
||||||
|
} else {
|
||||||
|
addUser(this.user).then(res => {
|
||||||
|
this.isDisabled = false
|
||||||
|
this.user.Id = res.Result.Id
|
||||||
|
this.user.UserCode = res.Result.UserCode
|
||||||
|
this.$emit('getUserId', res.Result.Id)
|
||||||
|
this.$message.success('Added successfully')
|
||||||
|
this.$router.push({ path: '/system/user/list' })
|
||||||
|
}).catch(() => { this.isDisabled = false })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getUserTypeList() {
|
||||||
|
getUserTypeListByUserType(0).then(res => {
|
||||||
|
if (res.IsSuccess) {
|
||||||
|
this.userTypeOptions = res.Result
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getUserInfo() {
|
||||||
|
getUser(this.userId).then(res => {
|
||||||
|
this.user = res.Result
|
||||||
|
})
|
||||||
|
},
|
||||||
|
OrgnizationTypeChanged(val) {
|
||||||
|
this.user.OrganizationName = ''
|
||||||
|
}
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
var validatePassword = (rule, value, callback) => {
|
var validatePassword = (rule, value, callback) => {
|
||||||
var lang = zzSessionStorage.getItem('lang')?zzSessionStorage.getItem('lang'):'zh'
|
var lang = zzSessionStorage.getItem('lang')?zzSessionStorage.getItem('lang'):'zh'
|
||||||
|
@ -103,7 +157,7 @@ export default {
|
||||||
var reg1 = /^[a-zA-Z0-9_]{4,16}$/; //密码必须是8位以上、必须含有字母、数字、特殊符号
|
var reg1 = /^[a-zA-Z0-9_]{4,16}$/; //密码必须是8位以上、必须含有字母、数字、特殊符号
|
||||||
console.log(!reg1.test(value))
|
console.log(!reg1.test(value))
|
||||||
if (!reg1.test(value)) {
|
if (!reg1.test(value)) {
|
||||||
callback(lang==='zh' ? new Error("1)新建账号,用户名字符长度最小为4个字符,最大为16个字符,只可使用字母、数字、下划线;") : new Error('Passwords must have: 1) 8 - 32 characters; 2) At least 1 number; 3) At least 1 uppercase letter; 4) At least 1 lowercase letter; 5) At least 1 special character (~!-@#$%^&*_+?) '))
|
callback(lang==='zh' ? new Error("1)新建账号,用户名字符长度最小为4个字符,最大为16个字符,只可使用字母、数字、下划线;") : new Error('For a new account, the username must have:1) At least 4 characters;2) At most 16 characters;3)Only letters, numbers, and underscores are allowed.'))
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
|
@ -175,60 +229,6 @@ export default {
|
||||||
isDisabled: false,
|
isDisabled: false,
|
||||||
type: 0 // 1为编辑,0为新增
|
type: 0 // 1为编辑,0为新增
|
||||||
}
|
}
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.getUserTypeList()
|
|
||||||
if (this.userId !== '') {
|
|
||||||
this.getUserInfo()
|
|
||||||
this.type = 1
|
|
||||||
} else {
|
|
||||||
this.type = 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
handleSave() {
|
|
||||||
this.$refs.userForm.validate(valid => {
|
|
||||||
if (valid) {
|
|
||||||
this.isDisabled = true
|
|
||||||
const selectedUserType = this.userTypeOptions.filter(item => item.Id === this.user.UserTypeId)
|
|
||||||
if (selectedUserType.length > 0) {
|
|
||||||
this.user.UserTypeEnum = selectedUserType[0].UserTypeEnum
|
|
||||||
}
|
|
||||||
this.user.BaseUrl = `${location.protocol}//${location.host}/login`
|
|
||||||
this.user.RouteUrl = `${location.protocol}//${location.host}/email-recompose`
|
|
||||||
if (this.user.Id) {
|
|
||||||
updateUser(this.user).then(res => {
|
|
||||||
this.isDisabled = false
|
|
||||||
this.$message.success('Updated successfully')
|
|
||||||
}).catch(() => { this.isDisabled = false })
|
|
||||||
} else {
|
|
||||||
addUser(this.user).then(res => {
|
|
||||||
this.isDisabled = false
|
|
||||||
this.user.Id = res.Result.Id
|
|
||||||
this.user.UserCode = res.Result.UserCode
|
|
||||||
this.$emit('getUserId', res.Result.Id)
|
|
||||||
this.$message.success('Added successfully')
|
|
||||||
this.$router.push({ path: '/system/user/list' })
|
|
||||||
}).catch(() => { this.isDisabled = false })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
getUserTypeList() {
|
|
||||||
getUserTypeListByUserType(0).then(res => {
|
|
||||||
if (res.IsSuccess) {
|
|
||||||
this.userTypeOptions = res.Result
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
getUserInfo() {
|
|
||||||
getUser(this.userId).then(res => {
|
|
||||||
this.user = res.Result
|
|
||||||
})
|
|
||||||
},
|
|
||||||
OrgnizationTypeChanged(val) {
|
|
||||||
this.user.OrganizationName = ''
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue