From 1384174f03c9a009cfbb3ae99aaeec21f177e4c2 Mon Sep 17 00:00:00 2001 From: yyg1378265336 <1378265336@qq.com> Date: 星期四, 27 二月 2025 09:26:30 +0800 Subject: [PATCH] 生产工具信息 --- src/components/Form/src/hooks/useAdvanced.ts | 36 +++++++++++++++--------------------- 1 files changed, 15 insertions(+), 21 deletions(-) diff --git a/src/components/Form/src/hooks/useAdvanced.ts b/src/components/Form/src/hooks/useAdvanced.ts index 96dacb2..342b10d 100644 --- a/src/components/Form/src/hooks/useAdvanced.ts +++ b/src/components/Form/src/hooks/useAdvanced.ts @@ -1,9 +1,9 @@ import type { ColEx } from '../types'; import type { AdvanceState } from '../types/hooks'; import { ComputedRef, getCurrentInstance, Ref, shallowReactive, computed, unref, watch } from 'vue'; -import type { FormProps, FormSchema } from '../types/form'; -import { isBoolean, isFunction, isNumber, isObject } from '/@/utils/is'; -import { useBreakpoint } from '/@/hooks/event/useBreakpoint'; +import type { FormProps, FormSchemaInner as FormSchema } from '../types/form'; +import { isBoolean, isFunction, isNumber, isObject } from '@/utils/is'; +import { useBreakpoint } from '@/hooks/event/useBreakpoint'; import { useDebounceFn } from '@vueuse/core'; const BASIC_COL_LEN = 24; @@ -120,24 +120,18 @@ const { baseColProps = {} } = unref(getProps); for (const schema of unref(getSchema)) { - const { show, colProps } = schema; + const { show, ifShow, colProps } = schema; + const renderCallbackParams = { + schema: schema, + model: formModel, + field: schema.field, + values: { ...unref(defaultValueRef), ...formModel }, + }; let isShow = true; - - if (isBoolean(show)) { - isShow = show; - } - - if (isFunction(show)) { - isShow = show({ - schema: schema, - model: formModel, - field: schema.field, - values: { - ...unref(defaultValueRef), - ...formModel, - }, - }); - } + isShow && isBoolean(ifShow) && (isShow = ifShow); + isShow && isFunction(ifShow) && (isShow = ifShow(renderCallbackParams)); + isShow && isBoolean(show) && (isShow = show); + isShow && isFunction(show) && (isShow = show(renderCallbackParams)); if (isShow && (colProps || baseColProps)) { const { itemColSum: sum, isAdvanced } = getAdvanced( @@ -160,7 +154,7 @@ getAdvanced(unref(getProps).actionColOptions || { span: BASIC_COL_LEN }, itemColSum, true); - emit('advanced-change'); + emit('advanced-change', advanceState.isAdvanced); } function handleToggleAdvanced() { -- Gitblit v1.9.3