标准性质是准入,状态为发布、即将实施和现行有效的时候 新车型实施日期和在产车的实施日期 都改成必填
This commit is contained in:
@@ -340,6 +340,7 @@ export default {
|
|||||||
// 国内的零部件分类、适用认证、适用车型和标准性质关联,准入标准必填,非准入标准不必填
|
// 国内的零部件分类、适用认证、适用车型和标准性质关联,准入标准必填,非准入标准不必填
|
||||||
'formInline.standard_property' () {
|
'formInline.standard_property' () {
|
||||||
this.handleDomesticSpecialCheck()
|
this.handleDomesticSpecialCheck()
|
||||||
|
this.handleStatePropertyCheck()
|
||||||
},
|
},
|
||||||
// 标准等级分类改变后授权部门需要自动带出
|
// 标准等级分类改变后授权部门需要自动带出
|
||||||
'formInline.grade_classification' (val) {
|
'formInline.grade_classification' (val) {
|
||||||
@@ -501,6 +502,7 @@ export default {
|
|||||||
}
|
}
|
||||||
// 起草、征求依据、报批、废止状态时发布日期、实施日期不必填
|
// 起草、征求依据、报批、废止状态时发布日期、实施日期不必填
|
||||||
this.handleRequiredByState(val)
|
this.handleRequiredByState(val)
|
||||||
|
this.handleStatePropertyCheck()
|
||||||
},
|
},
|
||||||
// 企标:企业标准代号选Q,企业名称代号只能选ZZ\ZR;标准代号选TS,企业名称代号只能选ZZ
|
// 企标:企业标准代号选Q,企业名称代号只能选ZZ\ZR;标准代号选TS,企业名称代号只能选ZZ
|
||||||
'formInline.standard_code' (val) {
|
'formInline.standard_code' (val) {
|
||||||
@@ -758,6 +760,37 @@ export default {
|
|||||||
clearValidate (fieldNameList) {
|
clearValidate (fieldNameList) {
|
||||||
this.$refs.ruleForm.clearValidate(fieldNameList)
|
this.$refs.ruleForm.clearValidate(fieldNameList)
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* 标准性质是准入,状态为发布、即将实施和现行有效的时候 新车型实施日期和在产车的实施日期 都改成必填
|
||||||
|
*/
|
||||||
|
handleStatePropertyCheck () {
|
||||||
|
const mustFillFields = ['new_model_implementation_date', 'on_the_production_date']
|
||||||
|
const rules = JSON.parse(JSON.stringify(this.rules))
|
||||||
|
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)) {
|
||||||
|
mustFillFields.forEach(key => {
|
||||||
|
if (rules[key] && rules[key].length > 0) {
|
||||||
|
rules[key][0].required = true
|
||||||
|
const dataPart = Object.keys(this.dataList).find(tt => this.dataList[tt].some(item => item.dbFieldName === key))
|
||||||
|
const index = this.dataList[dataPart].findIndex(tt => tt.dbFieldName === key)
|
||||||
|
this.dataList[dataPart][index].fieldMustInput = '1'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
mustFillFields.forEach(key => {
|
||||||
|
if (rules[key] && rules[key].length > 0) {
|
||||||
|
rules[key][0].required = false
|
||||||
|
const dataPart = Object.keys(this.dataList).find(tt => this.dataList[tt].some(item => item.dbFieldName === key))
|
||||||
|
const index = this.dataList[dataPart].findIndex(tt => tt.dbFieldName === key)
|
||||||
|
this.dataList[dataPart][index].fieldMustInput = '0'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.rules = Object.assign({}, rules)
|
||||||
|
this.clearValidate(mustFillFields)
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 国内海外的特殊处理
|
* 国内海外的特殊处理
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -501,10 +501,12 @@ export default {
|
|||||||
// 国内的零部件分类、适用认证、适用车型和标准性质关联,准入标准必填,非准入标准不必填
|
// 国内的零部件分类、适用认证、适用车型和标准性质关联,准入标准必填,非准入标准不必填
|
||||||
'formInline.standard_property' () {
|
'formInline.standard_property' () {
|
||||||
this.handleDomesticSpecialCheck()
|
this.handleDomesticSpecialCheck()
|
||||||
|
this.handleStatePropertyCheck()
|
||||||
},
|
},
|
||||||
'formInline.standard_state' (val) {
|
'formInline.standard_state' (val) {
|
||||||
// 起草、征求依据、报批状态时发布日期、实施日期不必填
|
// 起草、征求依据、报批状态时发布日期、实施日期不必填
|
||||||
this.handleRequiredByState(val)
|
this.handleRequiredByState(val)
|
||||||
|
this.handleStatePropertyCheck()
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 生成流程名称
|
* 生成流程名称
|
||||||
@@ -1203,6 +1205,55 @@ export default {
|
|||||||
this.rules = Object.assign({}, rules)
|
this.rules = Object.assign({}, rules)
|
||||||
this.$refs.ruleForm.clearValidate(fieldNameList)
|
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
|
* @param id
|
||||||
|
|||||||
Reference in New Issue
Block a user