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>
|
||||
|
||||
Reference in New Issue
Block a user