fix:添加校验的中英文

This commit is contained in:
zhangyu
2021-06-16 15:28:06 +08:00
parent a808dae7c1
commit ae2e7ea9ef
6 changed files with 54 additions and 16 deletions

View File

@@ -234,7 +234,7 @@ export default {
immediate: true,
deep: true,
handler (n, o) {
console.log(n)
// console.log(n)
}
}
}

View File

@@ -59,6 +59,7 @@
<el-switch
id="account-input-status"
v-model="editObject.status"
:active-color="theme.themeColor"
:disabled="(editObject.username === loginName) || (editObject.username==='admin' && editObject.id==1)"
:active-value="1"
:inactive-value="0">

View File

@@ -144,10 +144,14 @@ export default {
},
methods: {
statusChange (user) {
console.log(user)
if (user.roles) {
user.roleIds = user.roles.map(t => t.id)
}
put(this.url, user).then(response => {
// if (!user.id){
// return
// }
put('sys/user', user).then(response => {
if (response.code === 200) {
this.rightBox.show = false
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })

View File

@@ -165,6 +165,30 @@ const cn = {
copySuccess: '复制成功',
lnglatError: '经纬度格式错误'
},
validate: {
required: '必填项',
number: '必须是数字',
email: '不合法的E-mail地址',
tel: '不合法的电话号码',
telephone: '电话号码不能为空',
host: '不合法的IP',
fileSize: '文件过大',
port: '不合法的端口',
special: '不能包含特殊字符',
config: {
account: {}
},
integer: '必须是整数',
positiveInteger: '必须是正整数',
domain: '不合法的域名',
usize: '必须是(1 - 49)的数字',
url: '不合法的URL',
uSize: '必须是(1 - 47)的数字',
requiredIdc: '机房为必选项',
tooLong: '文本太长',
key: '不合法的值',
onlyWord: '只可以输入a-z、A-Z、0-9、"_" 字符'
},
config: {
config: '设置',
user: {

View File

@@ -164,6 +164,28 @@ const en = {
copySuccess: 'Copy success',
lnglatError: 'Wrong format of latitude and longitude'
},
validate: { // 校验规则
required: 'Required', // '必填项'
number: 'Numberic', // '必须是数字'
integer: 'Integer',
positiveInteger: 'Positive integer',
email: 'Invalid email', // '不合法的E-mail地址'
tel: 'Invalid phone number', // '不合法的电话号码'
telephone: 'Phone number cannot be empty',
host: 'Invalid Host', // '不合法的Host'
domain: 'Invalid domain',
usize: 'Must be number(1 - 47)',
fileSize: 'File exceed max size', // File exceed max size.
port: 'Invalid port',
url: 'Invalid URL',
uSize: 'Must be number(1 - 47)',
requiredIdc: 'dc is required',
key: 'Invalid key',
repeat: 'Repeat',
tooLong: 'Too long content',
onlyWord: 'only input a-z、A-Z、0-9、"_" ',
mobile: 'Invalid mobile'
},
config: {
config: 'Setting', // "设置"
user: {

View File

@@ -80,20 +80,7 @@ export default {
}
},
methods: {
statusChange (user) {
if (user.roles) {
user.roleIds = user.roles.map(t => t.id)
}
put(this.url, user).then(response => {
if (response.code === 200) {
this.rightBox.show = false
this.$message({ duration: 1000, type: 'success', message: this.$t('tip.saveSuccess') })
} else {
this.$message.error(response.msg)
}
this.getTableData()
})
}
}
}
</script>