From 83ef0235203ab53c66bb3f0d0ffe1d2af9cc7216 Mon Sep 17 00:00:00 2001 From: liwenxuan <1298531568@qq.com> Date: Mon, 9 Dec 2024 16:50:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E8=81=94=E9=80=89=E9=A1=B9=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E6=98=BE=E7=A4=BA=E9=9A=90=E8=97=8F=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liwenxuan <1298531568@qq.com> --- src/components/formTable/formItemGroup.vue | 280 +-- src/components/formTable/index.vue | 1821 ++++++++++++++------ 2 files changed, 1476 insertions(+), 625 deletions(-) diff --git a/src/components/formTable/formItemGroup.vue b/src/components/formTable/formItemGroup.vue index 99cf3cb..6db2c0f 100644 --- a/src/components/formTable/formItemGroup.vue +++ b/src/components/formTable/formItemGroup.vue @@ -94,144 +94,172 @@ const clickBtn = (control: any) => { injectBtnEvent && injectBtnEvent(control) } } +// 根据表单设置不显示指定字段 +const linksIf = (obj: FormList) => { + const { type } = formProps.value; + const { config: { disabledAdd, disabledEdit, disabledDetail } = {} } = obj; + if (type === 1) { + if (disabledAdd) { + // 编辑页 || 新增页 + return false; // 不显示 + } + } else if (type === 2) { + // 编辑 + if (disabledEdit) { + return false; + } + } else if (type === 4 || type === 3) { + // 查看 + if (disabledDetail) { + return false; + } + } + // 如果当前字段的name值存在于表单数据的vIf中,则不显示 + const vIf: string | string[] = formProps.value.hideField; + if (vIf?.length > 0 && obj.name) { + return vIf.indexOf(obj.name) === -1; // 存在时返回false隐藏 + } + return true; +}; diff --git a/src/components/formTable/index.vue b/src/components/formTable/index.vue index 9a23462..fce125e 100644 --- a/src/components/formTable/index.vue +++ b/src/components/formTable/index.vue @@ -4,60 +4,60 @@ @ 备注: 自定义表单画板 --> - \ No newline at end of file + + + + + + + \ No newline at end of file