Browse Source
perf: 表单需要通过权限控制是否需要展示,dependencies.if 这种方式需要别triggerFields触发字段,不能满足要求 (#6756)
pull/6768/head
pangyajun123
5 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with
7 additions and
2 deletions
-
docs/src/components/common-ui/vben-form.md
-
packages/@core/ui-kit/form-ui/src/form-render/form-field.vue
-
packages/@core/ui-kit/form-ui/src/types.ts
|
|
|
@ -473,6 +473,8 @@ export interface FormSchema< |
|
|
|
fieldName: string; |
|
|
|
/** 帮助信息 */ |
|
|
|
help?: CustomRenderType; |
|
|
|
/** 是否隐藏表单项 */ |
|
|
|
hide?: boolean; |
|
|
|
/** 表单的标签(如果是一个string,会用于默认必选规则的消息提示) */ |
|
|
|
label?: CustomRenderType; |
|
|
|
/** 自定义组件内部渲染 */ |
|
|
|
|
|
|
|
@ -41,6 +41,7 @@ const { |
|
|
|
emptyStateValue, |
|
|
|
fieldName, |
|
|
|
formFieldProps, |
|
|
|
hide, |
|
|
|
label, |
|
|
|
labelClass, |
|
|
|
labelWidth, |
|
|
|
@ -95,7 +96,7 @@ const currentRules = computed(() => { |
|
|
|
}); |
|
|
|
|
|
|
|
const visible = computed(() => { |
|
|
|
return isIf.value && isShow.value; |
|
|
|
return !hide && isIf.value && isShow.value; |
|
|
|
}); |
|
|
|
|
|
|
|
const shouldRequired = computed(() => { |
|
|
|
@ -283,7 +284,7 @@ onUnmounted(() => { |
|
|
|
|
|
|
|
<template> |
|
|
|
<FormField |
|
|
|
v-if="isIf" |
|
|
|
v-if="!hide && isIf" |
|
|
|
v-bind="fieldProps" |
|
|
|
v-slot="slotProps" |
|
|
|
:name="fieldName" |
|
|
|
|
|
|
|
@ -255,6 +255,8 @@ export interface FormSchema< |
|
|
|
fieldName: string; |
|
|
|
/** 帮助信息 */ |
|
|
|
help?: CustomRenderType; |
|
|
|
/** 是否隐藏表单项 */ |
|
|
|
hide?: boolean; |
|
|
|
/** 表单项 */ |
|
|
|
label?: CustomRenderType; |
|
|
|
// 自定义组件内部渲染
|
|
|
|
|