[update] 限制

This commit is contained in:
zhaomeijing
2022-06-07 17:11:12 +08:00
parent d218a66cac
commit 8110443d04
@@ -358,7 +358,7 @@ export default {
}
],
certCategory: [
{ required: true, message: this.$t('pleaseSelect')+this.$t('certificationCategory'), type: 'array', trigger: 'change' },
// { required: true, message: this.$t('pleaseSelect')+this.$t('certificationCategory'), type: 'array', trigger: 'change' },
],
isMust: [
{ required: true, message: this.$t('pleaseSelect')+this.$t('Required'), trigger: 'change' },
@@ -428,7 +428,6 @@ export default {
})
},
Onchangelabel(val) {
console.log(val,'lllll')
// 新增
if(this.title === '新增') {
let _tt = []
@@ -505,40 +504,80 @@ export default {
this.visible = false
},
handleSubmit() {
this.$refs.ruleForm.validate(valid => {
if (valid) {
let url = ''
let Action
this.formInline.paramsTemplateId = this.$route.query.id
if (this.formInline.id) {
url = this.url.edit
Action = postAction
} else {
url = this.url.add
Action = postAction
}
let query = JSON.parse(JSON.stringify(this.formInline))
Object.keys(query).forEach(res => {
if (query[res] && query[res] instanceof Array) {
query[res] = query[res].join(',')
}
})
let querycontentList = JSON.parse(JSON.stringify(this.contentList))
query.certCategoryParamsInfoEOList = querycontentList
this.confirmLoading = true
Action(url, query).then((res) => {
if (res.success) {
this.confirmLoading = false
this.$message.success(this.$t('OperationSuccessful'))
this.visible = false
this.$emit('addModelList')
} else {
this.$message.warning(res.message)
this.confirmLoading = false
}
})
if(this.formInline.certCategory == undefined) {
this.$message.warning(this.$t('certificationCategory')+this.$t('cannotEmpty'))
return
}
let falg = 1
this.contentList.forEach((item,index) => {
let reg = /^[0-9a-zA-Z-]{1,}$/
// 编号的限制
if(item.paramsNumber == '') {
this.$message.warning(this.$t('standard')+this.$t('cannotEmpty'))
falg = 0
return
} else if(item.paramsNumber.length > 15){
this.$message.warning(this.$t('standard')+this.$t('cantExeed')+'15'+this.$t('Characters'))
falg = 0
return
} else if(item.paramsNumber.match(reg) === null) {
this.$message.warning(this.$t('standard')+this.$t('onlyThree'))
falg = 0
return
}
// 参数名称的限制
if(item.paramsName == '') {
this.$message.warning(this.$t('ParameterName')+this.$t('cannotEmpty'))
falg = 0
return
} else if(item.paramsName.length > 30){
this.$message.warning(this.$t('ParameterName')+this.$t('cantExeed')+'30'+this.$t('Characters'))
falg = 0
return
}
// 参数说明的限制
if(item.description.length > 200){
this.$message.warning(this.$t('ParameterDescription')+this.$t('cantExeed')+'200'+this.$t('Characters'))
falg = 0
return
}
})
if(falg === 1) {
this.$refs.ruleForm.validate(valid => {
if (valid) {
let url = ''
let Action
this.formInline.paramsTemplateId = this.$route.query.id
if (this.formInline.id) {
url = this.url.edit
Action = postAction
} else {
url = this.url.add
Action = postAction
}
let query = JSON.parse(JSON.stringify(this.formInline))
Object.keys(query).forEach(res => {
if (query[res] && query[res] instanceof Array) {
query[res] = query[res].join(',')
}
})
let querycontentList = JSON.parse(JSON.stringify(this.contentList))
query.certCategoryParamsInfoEOList = querycontentList
this.confirmLoading = true
Action(url, query).then((res) => {
if (res.success) {
this.confirmLoading = false
this.$message.success(this.$t('OperationSuccessful'))
this.visible = false
this.$emit('addModelList')
} else {
this.$message.warning(res.message)
this.confirmLoading = false
}
})
}
})
}
},
handleInput(value) {
this.$nextTick(() => {