Commit 26f8d2aa by pangyajun123 Committed by GitHub

perf: 表单需要通过权限控制是否需要展示,dependencies.if 这种方式需要别triggerFields触发字段,不能满足要求 (#6756)

1 parent a8b848d3
...@@ -473,6 +473,8 @@ export interface FormSchema< ...@@ -473,6 +473,8 @@ export interface FormSchema<
fieldName: string; fieldName: string;
/** 帮助信息 */ /** 帮助信息 */
help?: CustomRenderType; help?: CustomRenderType;
/** 是否隐藏表单项 */
hide?: boolean;
/** 表单的标签(如果是一个string,会用于默认必选规则的消息提示) */ /** 表单的标签(如果是一个string,会用于默认必选规则的消息提示) */
label?: CustomRenderType; label?: CustomRenderType;
/** 自定义组件内部渲染 */ /** 自定义组件内部渲染 */
......
...@@ -41,6 +41,7 @@ const { ...@@ -41,6 +41,7 @@ const {
emptyStateValue, emptyStateValue,
fieldName, fieldName,
formFieldProps, formFieldProps,
hide,
label, label,
labelClass, labelClass,
labelWidth, labelWidth,
...@@ -95,7 +96,7 @@ const currentRules = computed(() => { ...@@ -95,7 +96,7 @@ const currentRules = computed(() => {
}); });
const visible = computed(() => { const visible = computed(() => {
return isIf.value && isShow.value; return !hide && isIf.value && isShow.value;
}); });
const shouldRequired = computed(() => { const shouldRequired = computed(() => {
...@@ -283,7 +284,7 @@ onUnmounted(() => { ...@@ -283,7 +284,7 @@ onUnmounted(() => {
<template> <template>
<FormField <FormField
v-if="isIf" v-if="!hide && isIf"
v-bind="fieldProps" v-bind="fieldProps"
v-slot="slotProps" v-slot="slotProps"
:name="fieldName" :name="fieldName"
......
...@@ -255,6 +255,8 @@ export interface FormSchema< ...@@ -255,6 +255,8 @@ export interface FormSchema<
fieldName: string; fieldName: string;
/** 帮助信息 */ /** 帮助信息 */
help?: CustomRenderType; help?: CustomRenderType;
/** 是否隐藏表单项 */
hide?: boolean;
/** 表单项 */ /** 表单项 */
label?: CustomRenderType; label?: CustomRenderType;
// 自定义组件内部渲染 // 自定义组件内部渲染
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!