[update] 配置必填长度校验
This commit is contained in:
@@ -216,29 +216,84 @@ export default {
|
|||||||
this.visible = false
|
this.visible = false
|
||||||
},
|
},
|
||||||
handleSubmit() {
|
handleSubmit() {
|
||||||
this.$refs.ruleForm.validate(valid => {
|
let flag = 1
|
||||||
if (valid) {
|
this.paramsConfigEOList.forEach((item) => {
|
||||||
let querycontentList = {}
|
// 配置名称
|
||||||
let paramsManifestId = { paramsManifestId : this.itemId }
|
if(item.configName == ''){
|
||||||
querycontentList = {
|
this.$message.warning(this.$t('configurationName')+this.$t('cannotEmpty'))
|
||||||
paramsConfigEOList: this.paramsConfigEOList,
|
flag = 0
|
||||||
deleteConfigIds: this.deleteConfigIds
|
return
|
||||||
}
|
} else if(item.configName.length > 25){
|
||||||
let querycontentListItem = { ...querycontentList, ...paramsManifestId }
|
this.$message.warning(this.$t('configurationName')+this.$t('cantExeed')+'25'+this.$t('characters'))
|
||||||
postAction(this.url.conAdd, querycontentListItem).then((res) => {
|
flag = 0
|
||||||
if (res.success) {
|
return
|
||||||
this.confirmLoading = false
|
}
|
||||||
this.$message.success(this.$t('OperationSuccessful'))
|
// 车型
|
||||||
this.visible = false
|
if(item.carType == ''){
|
||||||
this.deleteConfigIds = ''
|
this.$message.warning(this.$t('Model')+this.$t('cannotEmpty'))
|
||||||
this.deleteConfigIdsArray = []
|
flag = 0
|
||||||
} else {
|
return
|
||||||
this.$message.warning(res.message)
|
} else if(item.carType.length > 20){
|
||||||
this.confirmLoading = false
|
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