fix: 报告新增名称判断格式
This commit is contained in:
@@ -276,7 +276,6 @@ import { api } from '@/utils/api'
|
||||
import _ from 'lodash'
|
||||
import { get, post, put } from '@/utils/http'
|
||||
import { dateFormat, getMillisecond } from '@/utils/date-util'
|
||||
|
||||
const paramValidator = (rule, value, callback) => {
|
||||
let validate = true
|
||||
if (value && value.length > 0) {
|
||||
@@ -287,6 +286,16 @@ const paramValidator = (rule, value, callback) => {
|
||||
}
|
||||
return validate
|
||||
}
|
||||
const nameValidator = (rule, value, callback) => {
|
||||
let validate = true
|
||||
const reg = /^[\u4e00-\u9fa5A-Za-z\-\_]*$/
|
||||
if (reg.test(value)) {
|
||||
validate = true
|
||||
} else {
|
||||
validate = false
|
||||
}
|
||||
return validate
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'ReportBox',
|
||||
@@ -324,7 +333,8 @@ export default {
|
||||
|
||||
rules: { // 表单校验规则
|
||||
name: [
|
||||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
||||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' },
|
||||
{ validator: nameValidator, message: this.$t('validate.wrongFrom'), trigger: 'blur' }
|
||||
],
|
||||
categoryId: [
|
||||
{ required: true, message: this.$t('validate.required'), trigger: 'change' }
|
||||
|
||||
Reference in New Issue
Block a user