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