From 0621d45f9864ea89a1035bcec3752482dcb59ec5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=9C=84?= Date: Mon, 6 Nov 2023 13:39:31 +0800 Subject: [PATCH] bug 77990 --- src/components/customField/AddForm.vue | 46 ++++++++++++++++++- src/enums/commonEnums.js | 6 +++ .../modules/DomesticStandardModal.vue | 1 + 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/src/components/customField/AddForm.vue b/src/components/customField/AddForm.vue index b7910a0f..c2a11e88 100644 --- a/src/components/customField/AddForm.vue +++ b/src/components/customField/AddForm.vue @@ -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() + } } } } diff --git a/src/enums/commonEnums.js b/src/enums/commonEnums.js index 8074e24e..daa19abc 100644 --- a/src/enums/commonEnums.js +++ b/src/enums/commonEnums.js @@ -117,4 +117,10 @@ export const Recheck = { export const InventoryType = { SPECIALTY: { text: '特点', value: '1' }, COMPARISON_ITEM: { text: '对比项', value: '2' } +} + +// 标准性质 +export const StandardProperty = { + admittance: { text: '准入性', value: 'SN001' }, + recommendation: { text: '推荐性', value: 'SN002' } } \ No newline at end of file diff --git a/src/views/standardRegulationLibrary/domesticStandard/modules/DomesticStandardModal.vue b/src/views/standardRegulationLibrary/domesticStandard/modules/DomesticStandardModal.vue index ab413d20..ca44442c 100644 --- a/src/views/standardRegulationLibrary/domesticStandard/modules/DomesticStandardModal.vue +++ b/src/views/standardRegulationLibrary/domesticStandard/modules/DomesticStandardModal.vue @@ -19,6 +19,7 @@ :default-value="defaultValue" :disabled-field-list="disabledField" :exclude-standard-fields="excludeStandardFields" + domestic-special-check @submitFormData="submitFormData" />