iconfont
continuous-integration/drone/push Build is passing Details

uat_us
熊飞 2024-01-25 10:37:12 +08:00
parent dc66bdb40c
commit 88d20acfcf
1 changed files with 55 additions and 55 deletions

View File

@ -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 // 10 type: 0 // 10
} }
},
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>