From 1285771c8d301246b2ec0a5120d47ec1eb1dde0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=9C=84?= Date: Wed, 29 Nov 2023 16:31:26 +0800 Subject: [PATCH] =?UTF-8?q?UAT=E5=8F=98=E6=9B=B4=20=E6=A0=87=E5=87=86?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E4=B8=BA=E8=B5=B7=E8=8D=89=E3=80=81=E5=BE=81?= =?UTF-8?q?=E6=B1=82=E6=84=8F=E8=A7=81=E3=80=81=E5=AE=A1=E6=9F=A5=EF=BC=88?= =?UTF-8?q?=E4=BC=81=E6=A0=87=EF=BC=89=E3=80=81=E6=8A=A5=E6=89=B9=E7=AD=89?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=97=B6=E5=8F=91=E5=B8=83=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E3=80=81=E5=AE=9E=E6=96=BD=E6=97=A5=E6=9C=9F=E4=B8=8D=E5=BA=94?= =?UTF-8?q?=E6=98=AF=E5=BF=85=E5=A1=AB=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/customField/AddForm.vue | 39 +++++++++++++++++++ .../StandardEntryOrChangeProcess.vue | 37 +++++++++++++++++- 2 files changed, 75 insertions(+), 1 deletion(-) diff --git a/src/components/customField/AddForm.vue b/src/components/customField/AddForm.vue index 791f630c..e9f30bf4 100644 --- a/src/components/customField/AddForm.vue +++ b/src/components/customField/AddForm.vue @@ -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() + } } } diff --git a/src/views/workCenter/standardEntryOrChangeProcess/StandardEntryOrChangeProcess.vue b/src/views/workCenter/standardEntryOrChangeProcess/StandardEntryOrChangeProcess.vue index d1ae6f37..82526b4c 100644 --- a/src/views/workCenter/standardEntryOrChangeProcess/StandardEntryOrChangeProcess.vue +++ b/src/views/workCenter/standardEntryOrChangeProcess/StandardEntryOrChangeProcess.vue @@ -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() } } }