UAT变更 标准状态为起草、征求意见、审查(企标)、报批等状态时发布日期、实施日期不应是必填项
This commit is contained in:
@@ -432,6 +432,8 @@ export default {
|
||||
this.innerDisabledField = this.innerDisabledField.filter(item => item !== 'standard_state')
|
||||
}
|
||||
}
|
||||
// 起草、征求依据、报批状态时发布日期、实施日期不必填
|
||||
this.handleRequiredByState(val)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -671,6 +673,43 @@ export default {
|
||||
const text = option.componentOptions.propsData.title || option.componentOptions.propsData.label
|
||||
return text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
||||
},
|
||||
/**
|
||||
* 标准状态为起草、征求意见、报批等状态时发布日期、实施日期不应是必填项
|
||||
* @param val
|
||||
*/
|
||||
handleRequiredByState (val) {
|
||||
let notRequiredStatus = [], fields = []
|
||||
// 国内和海外的标准状态是同一个数据字典
|
||||
if (this.flag === StandardSource.DOMESTIC.value || this.flag === StandardSource.OVERSEAS.value) {
|
||||
notRequiredStatus = [StandardStatus.DRAFT.value, StandardStatus.SEEK_FOR_OPTIONS.value, StandardStatus.APPROVAL.value]
|
||||
fields = ['release_date', 'implementation_date']
|
||||
} else { // 处理企标
|
||||
notRequiredStatus = [EnterpriseStandardStatus.DRAFT.value, EnterpriseStandardStatus.SEEK_FOR_OPTIONS.value, EnterpriseStandardStatus.EXAMINE.value, EnterpriseStandardStatus.APPROVAL.value]
|
||||
fields = ['release_date', 'implementation_date']
|
||||
}
|
||||
const rules = JSON.parse(JSON.stringify(this.rules))
|
||||
if (notRequiredStatus.includes(val)) {
|
||||
fields.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'
|
||||
}
|
||||
})
|
||||
} else {
|
||||
fields.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'
|
||||
}
|
||||
})
|
||||
}
|
||||
this.rules = Object.assign({}, rules)
|
||||
this.clearValidate()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -329,7 +329,8 @@ import {
|
||||
OperationType,
|
||||
StandardProperty,
|
||||
ProcessKey,
|
||||
FGEntryChangeProcessNode
|
||||
FGEntryChangeProcessNode,
|
||||
StandardStatus
|
||||
} from '../../../enums/commonEnums.js'
|
||||
import {
|
||||
getDomesticStandardDocumentInfo,
|
||||
@@ -465,6 +466,10 @@ export default {
|
||||
// 国内的零部件名称、适用认证、适用车型和标准性质关联,准入标准必填,非准入标准不必填
|
||||
'formInline.standard_property' () {
|
||||
this.handleDomesticSpecialCheck()
|
||||
},
|
||||
'formInline.standard_state' (val) {
|
||||
// 起草、征求依据、报批状态时发布日期、实施日期不必填
|
||||
this.handleRequiredByState(val)
|
||||
}
|
||||
},
|
||||
created () {
|
||||
@@ -1079,6 +1084,36 @@ export default {
|
||||
return StandardSource.OVERSEAS.value
|
||||
}
|
||||
return this.formInline.source
|
||||
},
|
||||
/**
|
||||
* 标准状态为起草、征求意见、报批等状态时发布日期、实施日期不应是必填项
|
||||
* @param val
|
||||
*/
|
||||
handleRequiredByState (val) {
|
||||
const notRequiredStatus = [StandardStatus.DRAFT.value, StandardStatus.SEEK_FOR_OPTIONS.value, StandardStatus.APPROVAL.value]
|
||||
const fields = ['release_date', 'implementation_date']
|
||||
const rules = JSON.parse(JSON.stringify(this.rules))
|
||||
if (notRequiredStatus.includes(val)) {
|
||||
fields.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'
|
||||
}
|
||||
})
|
||||
} else {
|
||||
fields.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'
|
||||
}
|
||||
})
|
||||
}
|
||||
this.rules = Object.assign({}, rules)
|
||||
this.$refs.ruleForm.clearValidate()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user