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