From 0187e61845b4d178f129278ddb59def7f6485647 Mon Sep 17 00:00:00 2001 From: Xia Zekun Date: Mon, 18 Mar 2024 16:28:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=87=E5=87=86=E6=80=A7=E8=B4=A8=E4=B8=BA?= =?UTF-8?q?=E5=87=86=E5=85=A5=E6=80=A7=E6=97=B6=EF=BC=8C=E8=B4=A3=E4=BB=BB?= =?UTF-8?q?=E9=83=A8=E9=97=A8=E6=94=B9=E4=B8=BA=E9=9D=9E=E5=BF=85=E5=A1=AB?= =?UTF-8?q?=20=E5=9B=BD=E5=86=85=E6=A0=87=E5=87=86=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=92=8C=E6=A0=87=E5=87=86=E6=B3=95=E8=A7=84=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/customField/AddForm.vue | 17 +++++++++++++++++ .../StandardEntryOrChangeProcess.vue | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/components/customField/AddForm.vue b/src/components/customField/AddForm.vue index eb0e26f5..2f7ad0e3 100644 --- a/src/components/customField/AddForm.vue +++ b/src/components/customField/AddForm.vue @@ -764,6 +764,7 @@ export default { handleDomesticSpecialCheck () { if (this.domesticSpecialCheck) { const fieldNameList = ['part_name', 'applicable_certification', 'applicable_vehicle'] + const fieldNameListOpposite = ['responsible_department'] // “推荐性”标准性质 下时, 责任部门改为非必填 const rules = JSON.parse(JSON.stringify(this.rules)) if (this.formInline.standard_property === StandardProperty.admittance.value) { fieldNameList.forEach(key => { @@ -774,6 +775,14 @@ export default { this.dataList[dataPart][index].fieldMustInput = '1' } }) + fieldNameListOpposite.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 { fieldNameList.forEach(key => { if (rules[key] && rules[key].length > 0) { @@ -783,6 +792,14 @@ export default { this.dataList[dataPart][index].fieldMustInput = '0' } }) + fieldNameListOpposite.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(fieldNameList) diff --git a/src/views/workCenter/standardEntryOrChangeProcess/StandardEntryOrChangeProcess.vue b/src/views/workCenter/standardEntryOrChangeProcess/StandardEntryOrChangeProcess.vue index a2d79dcd..318db560 100644 --- a/src/views/workCenter/standardEntryOrChangeProcess/StandardEntryOrChangeProcess.vue +++ b/src/views/workCenter/standardEntryOrChangeProcess/StandardEntryOrChangeProcess.vue @@ -1180,6 +1180,7 @@ export default { */ handleDomesticSpecialCheck () { const fieldNameList = ['part_name', 'applicable_certification', 'applicable_vehicle'] + const fieldNameListOpposite = ['responsible_department'] // “推荐性”标准性质 下时, 责任部门改为非必填 const rules = JSON.parse(JSON.stringify(this.rules)) if (this.formInline.standard_property === StandardProperty.admittance.value) { fieldNameList.forEach(key => { @@ -1190,6 +1191,14 @@ export default { this.formList[dataPart][index].fieldMustInput = '1' } }) + fieldNameListOpposite.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 { fieldNameList.forEach(key => { if (rules[key] && rules[key].length > 0) { @@ -1199,6 +1208,14 @@ export default { this.formList[dataPart][index].fieldMustInput = '0' } }) + fieldNameListOpposite.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(fieldNameList)