标准性质是准入,状态为发布、即将实施和现行有效的时候 新车型实施日期和在产车的实施日期 都改成必填
This commit is contained in:
@@ -501,10 +501,12 @@ export default {
|
||||
// 国内的零部件分类、适用认证、适用车型和标准性质关联,准入标准必填,非准入标准不必填
|
||||
'formInline.standard_property' () {
|
||||
this.handleDomesticSpecialCheck()
|
||||
this.handleStatePropertyCheck()
|
||||
},
|
||||
'formInline.standard_state' (val) {
|
||||
// 起草、征求依据、报批状态时发布日期、实施日期不必填
|
||||
this.handleRequiredByState(val)
|
||||
this.handleStatePropertyCheck()
|
||||
},
|
||||
/**
|
||||
* 生成流程名称
|
||||
@@ -1203,6 +1205,55 @@ export default {
|
||||
this.rules = Object.assign({}, rules)
|
||||
this.$refs.ruleForm.clearValidate(fieldNameList)
|
||||
},
|
||||
/**
|
||||
* 标准性质是准入,状态为发布、即将实施和现行有效的时候 新车型实施日期和在产车的实施日期 都改成必填
|
||||
*/
|
||||
handleStatePropertyCheck () {
|
||||
const mustFillFields = ['new_model_implementation_date', 'on_the_production_date']
|
||||
const rules = JSON.parse(JSON.stringify(this.rules))
|
||||
// console.log('this.formListArr', this.formListArr)
|
||||
console.log('this.formList', this.formList)
|
||||
// 逻辑: 如果rules里没有mustFillFields里的所需字段
|
||||
// 就去 this.formListArr 里寻找其名字,然后填入规则
|
||||
mustFillFields.forEach(key => {
|
||||
if (!Object.keys(rules).includes(key)) {
|
||||
console.log('rules不包含', key, '尝试查找添加')
|
||||
const fieldInfo = this.formListArr.find(item => item.dbFieldName === key)
|
||||
rules[key] = [{
|
||||
required: false,
|
||||
message: fieldInfo.dbFieldTxt + this.$t('cannotEmpty'),
|
||||
trigger: 'blur'
|
||||
}]
|
||||
console.log('添加rule.', key, rules[key])
|
||||
}
|
||||
})
|
||||
if (this.formInline.standard_property === StandardProperty.admittance.value && (
|
||||
this.formInline.standard_state === StandardStatus.RELEASE.value ||
|
||||
this.formInline.standard_state === StandardStatus.BE_IMPLEMENTED_SOON.value ||
|
||||
this.formInline.standard_state === StandardStatus.CURRENTLY_EFFECTIVE.value)) {
|
||||
console.log('标准性质是准入,状态为发布、即将实施和现行有效的时候 新车型实施日期和在产车的实施日期 都改成必填')
|
||||
mustFillFields.forEach(key => {
|
||||
if (rules[key] && rules[key].length > 0) {
|
||||
rules[key][0].required = true
|
||||
const dataPart = Object.keys(this.formList).find(tt => this.formList[tt].some(item => item.dbFieldName === key))
|
||||
const index = this.formList[dataPart].findIndex(tt => tt.dbFieldName === key)
|
||||
this.formList[dataPart][index].fieldMustInput = '1'
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.log('标准性质是准入,状态为发布、即将实施和现行有效 已不符合, 取消 新车型实施日期和在产车的实施日期 的必填')
|
||||
mustFillFields.forEach(key => {
|
||||
if (rules[key] && rules[key].length > 0) {
|
||||
rules[key][0].required = false
|
||||
const dataPart = Object.keys(this.formList).find(tt => this.formList[tt].some(item => item.dbFieldName === key))
|
||||
const index = this.formList[dataPart].findIndex(tt => tt.dbFieldName === key)
|
||||
this.formList[dataPart][index].fieldMustInput = '0'
|
||||
}
|
||||
})
|
||||
}
|
||||
this.rules = Object.assign({}, rules)
|
||||
this.$refs.ruleForm.clearValidate(mustFillFields)
|
||||
},
|
||||
/**
|
||||
* 获取海外的表单数据
|
||||
* @param id
|
||||
|
||||
Reference in New Issue
Block a user