bug 77990

This commit is contained in:
赵霄
2023-11-06 13:39:31 +08:00
parent 8686118ee1
commit 0621d45f98
3 changed files with 51 additions and 2 deletions
+44 -2
View File
@@ -153,7 +153,7 @@ import JMultiSelectTag from '../dict/JMultiSelectTag'
import UploadFile from '../UploadFile'
// 选择标准选择器
import StandardSelection from '../selection/StandardSelection'
import { FieldType } from '../../enums/commonEnums'
import { FieldType, StandardProperty } from '../../enums/commonEnums'
import JMultipleDatePicker from '../JMultipleDatePicker'
import UserSelection from '../selection/UserSelection'
import { getAction } from '../../api/manage.js'
@@ -256,6 +256,12 @@ export default {
default: () => {
return []
}
},
// 是否需要进行国内标准的特殊校验
domesticSpecialCheck: {
type: Boolean,
required: false,
default: false
}
},
data () {
@@ -274,6 +280,12 @@ export default {
excludeStandardNumbers: '' // 不包含的标准号
}
},
watch: {
// 国内、海外的零部件名称、适用认证、适用车型和标准性质关联,准入标准必填,非准入标准不必填
'formInline.standard_property' () {
this.handleDomesticSpecialCheck()
}
},
methods: {
add () {
this.formInline = Object.assign({}, this.defaultValue)
@@ -316,7 +328,7 @@ export default {
// 处理标准选择不能选自己
this.excludeStandardNumbers = this.formInline[this.excludeStandardValFormFields]
console.log('11111111111111', this.excludeStandardNumbers, this.excludeStandardFields)
this.handleDomesticSpecialCheck()
this.loading = false
} else {
this.loading = false
@@ -459,6 +471,36 @@ export default {
},
clearValidate () {
this.$refs.ruleForm.clearValidate()
},
/**
* 国内海外的特殊处理
*/
handleDomesticSpecialCheck () {
if (this.domesticSpecialCheck) {
const fieldNameList = ['part_name', 'applicable_certification', 'applicable_vehicle']
const rules = JSON.parse(JSON.stringify(this.rules))
if (this.formInline.standard_property === StandardProperty.admittance.value) {
fieldNameList.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 {
fieldNameList.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()
}
}
}
}