From 935262ce2a05fd01644dc5aadf73fab0584a6ee7 Mon Sep 17 00:00:00 2001 From: lideqin <694785430@qq.com> Date: Wed, 29 Nov 2023 11:01:40 +0800 Subject: [PATCH] =?UTF-8?q?[update]=20=E4=BF=AE=E6=94=B9=E6=89=A9=E5=B1=95?= =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/JExpandTable.vue | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/components/JExpandTable.vue b/src/components/JExpandTable.vue index ff32f5ff..24db86bd 100644 --- a/src/components/JExpandTable.vue +++ b/src/components/JExpandTable.vue @@ -237,14 +237,23 @@ export default { if (this.formIsDepend) { if (this.dataSource[i][this.formIsDepend]) { // 需要依赖某个字段,获取当前行该字段时,扩展表单是否有必填项 + // console.log(this.dataSource[i]) + // console.log(this.extraForm[this.dataSource[i][this.formIsDepend]]) + const currRowExtraFormFormArr = this.extraForm[this.dataSource[i][this.formIsDepend]].formArr const currRowExtraFormRules = this.extraForm[this.dataSource[i][this.formIsDepend]].rules let isHaveRequired = false - for (const item in currRowExtraFormRules) { - if (currRowExtraFormRules[item].required === true) { - // 有任意一个字段有必填 + for (const item of currRowExtraFormFormArr) { + if (currRowExtraFormRules[item.dbFieldName].required === true && !this.dataSource[i][item.dbFieldName]) { + // 有必填但没有填内容 isHaveRequired = true } } + // for (const item in currRowExtraFormRules) { + // if (currRowExtraFormRules[item].required === true) { + // // 有任意一个字段有必填,但没有内容 + // isHaveRequired = true + // } + // } if (isHaveRequired) { // 任意一个字段有必填,她又没展开过,校验不通过 arr[i] = false @@ -258,12 +267,18 @@ export default { } else { // 没有依赖的字段 let isHaveRequired = false - for (const item in this.extraForm.rules) { - if (this.extraForm.rules[item].required === true) { - // 有任意一个字段有必填 + for (const item of this.extraForm.formArr) { + if (this.extraForm.rules[item.dbFieldName].required === true && !this.dataSource[i][item.dbFieldName]) { + // 有字段有必填,但没有内容 isHaveRequired = true } } + // for (const item in this.extraForm.rules) { + // if (this.extraForm.rules[item].required === true) { + // // 有任意一个字段有必填 + // isHaveRequired = true + // } + // } if (isHaveRequired) { // 任意一个字段有必填,她又没展开过,校验不通过 arr[i] = false