[update] 配置必填长度校验
This commit is contained in:
@@ -216,29 +216,84 @@ export default {
|
||||
this.visible = false
|
||||
},
|
||||
handleSubmit() {
|
||||
this.$refs.ruleForm.validate(valid => {
|
||||
if (valid) {
|
||||
let querycontentList = {}
|
||||
let paramsManifestId = { paramsManifestId : this.itemId }
|
||||
querycontentList = {
|
||||
paramsConfigEOList: this.paramsConfigEOList,
|
||||
deleteConfigIds: this.deleteConfigIds
|
||||
}
|
||||
let querycontentListItem = { ...querycontentList, ...paramsManifestId }
|
||||
postAction(this.url.conAdd, querycontentListItem).then((res) => {
|
||||
if (res.success) {
|
||||
this.confirmLoading = false
|
||||
this.$message.success(this.$t('OperationSuccessful'))
|
||||
this.visible = false
|
||||
this.deleteConfigIds = ''
|
||||
this.deleteConfigIdsArray = []
|
||||
} else {
|
||||
this.$message.warning(res.message)
|
||||
this.confirmLoading = false
|
||||
}
|
||||
})
|
||||
let flag = 1
|
||||
this.paramsConfigEOList.forEach((item) => {
|
||||
// 配置名称
|
||||
if(item.configName == ''){
|
||||
this.$message.warning(this.$t('configurationName')+this.$t('cannotEmpty'))
|
||||
flag = 0
|
||||
return
|
||||
} else if(item.configName.length > 25){
|
||||
this.$message.warning(this.$t('configurationName')+this.$t('cantExeed')+'25'+this.$t('characters'))
|
||||
flag = 0
|
||||
return
|
||||
}
|
||||
// 车型
|
||||
if(item.carType == ''){
|
||||
this.$message.warning(this.$t('Model')+this.$t('cannotEmpty'))
|
||||
flag = 0
|
||||
return
|
||||
} else if(item.carType.length > 20){
|
||||
this.$message.warning(this.$t('Model')+this.$t('cantExeed')+'20'+this.$t('characters'))
|
||||
flag = 0
|
||||
return
|
||||
}
|
||||
// 版本
|
||||
if(item.version == ''){
|
||||
this.$message.warning(this.$t('Version')+this.$t('cannotEmpty'))
|
||||
flag = 0
|
||||
return
|
||||
} else if(item.version.length > 20){
|
||||
this.$message.warning(this.$t('Version')+this.$t('cantExeed')+'20'+this.$t('characters'))
|
||||
flag = 0
|
||||
return
|
||||
}
|
||||
// 电池
|
||||
if(item.battery == ''){
|
||||
this.$message.warning(this.$t('Battery')+this.$t('cannotEmpty'))
|
||||
flag = 0
|
||||
return
|
||||
} else if(item.battery.length > 20){
|
||||
this.$message.warning(this.$t('Battery')+this.$t('cantExeed')+'20'+this.$t('characters'))
|
||||
flag = 0
|
||||
return
|
||||
}
|
||||
// 电机
|
||||
if(item.motor == ''){
|
||||
this.$message.warning(this.$t('electricMachinery')+this.$t('cannotEmpty'))
|
||||
flag = 0
|
||||
return
|
||||
} else if(item.motor.length > 20){
|
||||
this.$message.warning(this.$t('electricMachinery')+this.$t('cantExeed')+'20'+this.$t('characters'))
|
||||
flag = 0
|
||||
return
|
||||
}
|
||||
})
|
||||
if(flag == 1){
|
||||
this.$refs.ruleForm.validate(valid => {
|
||||
if (valid) {
|
||||
let querycontentList = {}
|
||||
let paramsManifestId = { paramsManifestId : this.itemId }
|
||||
querycontentList = {
|
||||
paramsConfigEOList: this.paramsConfigEOList,
|
||||
deleteConfigIds: this.deleteConfigIds
|
||||
}
|
||||
})
|
||||
let querycontentListItem = { ...querycontentList, ...paramsManifestId }
|
||||
postAction(this.url.conAdd, querycontentListItem).then((res) => {
|
||||
if (res.success) {
|
||||
this.confirmLoading = false
|
||||
this.$message.success(this.$t('OperationSuccessful'))
|
||||
this.visible = false
|
||||
this.deleteConfigIds = ''
|
||||
this.deleteConfigIdsArray = []
|
||||
} else {
|
||||
this.$message.warning(res.message)
|
||||
this.confirmLoading = false
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user