fix: 报告新增名称判断格式
This commit is contained in:
@@ -276,7 +276,6 @@ import { api } from '@/utils/api'
|
|||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import { get, post, put } from '@/utils/http'
|
import { get, post, put } from '@/utils/http'
|
||||||
import { dateFormat, getMillisecond } from '@/utils/date-util'
|
import { dateFormat, getMillisecond } from '@/utils/date-util'
|
||||||
|
|
||||||
const paramValidator = (rule, value, callback) => {
|
const paramValidator = (rule, value, callback) => {
|
||||||
let validate = true
|
let validate = true
|
||||||
if (value && value.length > 0) {
|
if (value && value.length > 0) {
|
||||||
@@ -287,6 +286,16 @@ const paramValidator = (rule, value, callback) => {
|
|||||||
}
|
}
|
||||||
return validate
|
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 {
|
export default {
|
||||||
name: 'ReportBox',
|
name: 'ReportBox',
|
||||||
@@ -324,7 +333,8 @@ export default {
|
|||||||
|
|
||||||
rules: { // 表单校验规则
|
rules: { // 表单校验规则
|
||||||
name: [
|
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: [
|
categoryId: [
|
||||||
{ required: true, message: this.$t('validate.required'), trigger: 'change' }
|
{ required: true, message: this.$t('validate.required'), trigger: 'change' }
|
||||||
@@ -409,7 +419,7 @@ export default {
|
|||||||
if (category && category.config && category.config.queryParam) {
|
if (category && category.config && category.config.queryParam) {
|
||||||
this.editObject.categoryParams = category.config.queryParam
|
this.editObject.categoryParams = category.config.queryParam
|
||||||
if (!this.editObject.id) {
|
if (!this.editObject.id) {
|
||||||
this.editObject.categoryParams.forEach(t => {t.value = ''})
|
this.editObject.categoryParams.forEach(t => { t.value = '' })
|
||||||
}
|
}
|
||||||
this.loadParamOptions()
|
this.loadParamOptions()
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user