diff --git a/src/views/secondHandCar/carSource.vue b/src/views/secondHandCar/carSource.vue index 40b2a8d9..2b0c2dc8 100644 --- a/src/views/secondHandCar/carSource.vue +++ b/src/views/secondHandCar/carSource.vue @@ -401,17 +401,21 @@ export default { }else if(this.form.vehicleType !=='平板拖车'){ this.form.boardType='' } - let _validationRules; - if( type === 0 ) { - _validationRules = this.validationRules.filter(item => item.name != '底盘品牌不能为空') - } else { - _validationRules = this.validationRules - } - let rule = _validationRules.find(item => - item.value === null || - item.value === undefined || - item.value === '' - ) + let rule + if( type == 1 ) { + rule = this.validationRules.find(item => + item.value === null || + item.value === undefined || + item.value === '' + ) + } else { + rule = this.validationRulesSimple.find(item => + item.value === null || + item.value === undefined || + item.value === '' + ) + } + if(rule){ this.$toast(rule.name) return @@ -526,6 +530,16 @@ export default { { value: this.form.underpanBrand, name: '底盘品牌不能为空' }, ]; }, + validationRulesSimple() { + return [ + { value: this.form.vehicleType, name: '车辆类型不能为空' }, + { value: this.form.emissionStandard, name: '排放标准不能为空' }, + { value: this.form.areaCode, name: '所在城市不能为空' }, + { value: this.form.mileage, name: '行驶里程不能为空' }, + { value: this.form.contactNumber, name: '联系方式不能为空' }, + { value: this.form.minPrice, name: '售价不能为空' }, + ]; + }, }, }