From 5613dcef99239211dbe5541a9d5a5b376eedbea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=AA=E5=BF=86=E5=A4=A9=E5=A0=82?= <1455668754@qq.com> Date: Mon, 23 Mar 2026 10:05:32 +0800 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20table=E5=85=81=E8=AE=B8=E9=80=9A?= =?UTF-8?q?=E8=BF=87props=E5=8A=A8=E6=80=81=E5=8F=98=E5=8C=96data=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + packages/effects/plugins/src/vxe-table/use-vxe-grid.vue | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/package.json b/package.json index bd937293f..e62297128 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ }, "type": "module", "scripts": { + "bootstrap": "pnpm install", "build": "cross-env NODE_OPTIONS=--max-old-space-size=8192 turbo build", "build:analyze": "turbo build:analyze", "build:antd": "pnpm run build --filter=@vben/web-antd", diff --git a/packages/effects/plugins/src/vxe-table/use-vxe-grid.vue b/packages/effects/plugins/src/vxe-table/use-vxe-grid.vue index 4cb2d03bb..ddde3d30a 100644 --- a/packages/effects/plugins/src/vxe-table/use-vxe-grid.vue +++ b/packages/effects/plugins/src/vxe-table/use-vxe-grid.vue @@ -72,6 +72,7 @@ const { gridEvents, formOptions, tableTitle, + tableData, tableTitleHelp, showSearchForm, separator, @@ -229,6 +230,9 @@ const options = computed(() => { } if (mergedOptions.formConfig) { mergedOptions.formConfig.enabled = false; + if (tableData.value && tableData.value.length > 0) { + mergedOptions.data = tableData.value; + } } return mergedOptions; }); From 6b3506f1284b5a7518a3182469cc3bbe6b3982f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=AA=E5=BF=86=E5=A4=A9=E5=A0=82?= <1455668754@qq.com> Date: Mon, 23 Mar 2026 10:06:35 +0800 Subject: [PATCH 2/5] =?UTF-8?q?feat:=20table=20=E7=B1=BB=E5=9E=8BVxeTableG?= =?UTF-8?q?ridColumns=E6=9B=BF=E4=BB=A3VxeTableGridOptions['columns']?= =?UTF-8?q?=E9=AD=94=E6=B3=95=E5=80=BC=E5=86=99=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/effects/plugins/src/vxe-table/index.ts | 2 +- packages/effects/plugins/src/vxe-table/types.ts | 6 ++++++ playground/src/views/system/dept/data.ts | 4 ++-- playground/src/views/system/menu/data.ts | 4 ++-- playground/src/views/system/role/data.ts | 4 ++-- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/effects/plugins/src/vxe-table/index.ts b/packages/effects/plugins/src/vxe-table/index.ts index a19f2b8fc..6f0efe442 100644 --- a/packages/effects/plugins/src/vxe-table/index.ts +++ b/packages/effects/plugins/src/vxe-table/index.ts @@ -1,5 +1,5 @@ export { setupVbenVxeTable } from './init'; -export type { VxeTableGridOptions } from './types'; +export type { VxeTableGridColumns, VxeTableGridOptions } from './types'; export * from './use-vxe-grid'; export { default as VbenVxeGrid } from './use-vxe-grid.vue'; diff --git a/packages/effects/plugins/src/vxe-table/types.ts b/packages/effects/plugins/src/vxe-table/types.ts index 8b9aea47d..8e56ce418 100644 --- a/packages/effects/plugins/src/vxe-table/types.ts +++ b/packages/effects/plugins/src/vxe-table/types.ts @@ -26,6 +26,8 @@ interface ToolbarConfigOptions extends VxeGridPropTypes.ToolbarConfig { search?: boolean; } +export type VxeTableGridColumns = VxeTableGridOptions['columns']; + export interface VxeTableGridOptions extends VxeTableGridProps { /** 工具栏配置 */ toolbarConfig?: ToolbarConfigOptions; @@ -40,6 +42,10 @@ export interface VxeGridProps< T extends Record = any, D extends BaseFormComponentType = BaseFormComponentType, > { + /** + * 数据 + */ + tableData?: any[]; /** * 标题 */ diff --git a/playground/src/views/system/dept/data.ts b/playground/src/views/system/dept/data.ts index 48773625a..b0699e7a6 100644 --- a/playground/src/views/system/dept/data.ts +++ b/playground/src/views/system/dept/data.ts @@ -1,4 +1,4 @@ -import type { VxeTableGridOptions } from '@vben/plugins/vxe-table'; +import type { VxeTableGridColumns } from '@vben/plugins/vxe-table'; import type { VbenFormSchema } from '#/adapter/form'; import type { OnActionClickFn } from '#/adapter/vxe-table'; @@ -76,7 +76,7 @@ export function useSchema(): VbenFormSchema[] { */ export function useColumns( onActionClick?: OnActionClickFn, -): VxeTableGridOptions['columns'] { +): VxeTableGridColumns { return [ { align: 'left', diff --git a/playground/src/views/system/menu/data.ts b/playground/src/views/system/menu/data.ts index 75190b4ac..11aa2bd37 100644 --- a/playground/src/views/system/menu/data.ts +++ b/playground/src/views/system/menu/data.ts @@ -1,4 +1,4 @@ -import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { OnActionClickFn, VxeTableGridColumns } from '#/adapter/vxe-table'; import type { SystemMenuApi } from '#/api/system/menu'; import { $t } from '#/locales'; @@ -23,7 +23,7 @@ export function getMenuTypeOptions() { export function useColumns( onActionClick: OnActionClickFn, -): VxeTableGridOptions['columns'] { +): VxeTableGridColumns { return [ { align: 'left', diff --git a/playground/src/views/system/role/data.ts b/playground/src/views/system/role/data.ts index 255b6cc72..9c9d0fbab 100644 --- a/playground/src/views/system/role/data.ts +++ b/playground/src/views/system/role/data.ts @@ -1,5 +1,5 @@ import type { VbenFormSchema } from '#/adapter/form'; -import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { OnActionClickFn, VxeTableGridColumns } from '#/adapter/vxe-table'; import type { SystemRoleApi } from '#/api'; import { $t } from '#/locales'; @@ -77,7 +77,7 @@ export function useGridFormSchema(): VbenFormSchema[] { export function useColumns( onActionClick: OnActionClickFn, onStatusChange?: (newStatus: any, row: T) => PromiseLike, -): VxeTableGridOptions['columns'] { +): VxeTableGridColumns { return [ { field: 'name', From cd955df02ffac4dd5932f5b523753f4a7bbee467 Mon Sep 17 00:00:00 2001 From: Jin Mao Date: Tue, 24 Mar 2026 10:19:24 +0800 Subject: [PATCH 3/5] chore: fix lint --- pnpm-workspace.yaml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index fe5903cee..c29232ab2 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -12,6 +12,14 @@ packages: - scripts/* - docs - playground + +overrides: + '@ast-grep/napi': 'catalog:' + '@ctrl/tinycolor': 'catalog:' + clsx: 'catalog:' + pinia: 'catalog:' + vue: 'catalog:' + catalog: '@ast-grep/napi': ^0.42.0 '@changesets/changelog-github': ^0.6.0 @@ -179,9 +187,3 @@ catalog: zod: ^3.25.76 zod-defaults: 0.1.3 -overrides: - '@ast-grep/napi': 'catalog:' - '@ctrl/tinycolor': 'catalog:' - clsx: 'catalog:' - pinia: 'catalog:' - vue: 'catalog:' From 2aced2f659b5afb6606d161962a791515818c544 Mon Sep 17 00:00:00 2001 From: xueyitt <1455668754@qq.com> Date: Tue, 24 Mar 2026 10:20:43 +0800 Subject: [PATCH 4/5] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0table=20=E5=B8=AE?= =?UTF-8?q?=E5=8A=A9=E4=BF=A1=E6=81=AFhelp=E9=80=9A=E8=BF=87=E8=A1=A8?= =?UTF-8?q?=E5=8D=95values=E5=8A=A8=E6=80=81=E5=B1=95=E7=A4=BA=E5=86=85?= =?UTF-8?q?=E5=AE=B9=20(#7712)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui-kit/form-ui/src/form-render/form-field.vue | 15 ++++++++++++++- packages/@core/ui-kit/form-ui/src/types.ts | 10 +++++++++- playground/src/views/examples/form/basic.vue | 2 ++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/packages/@core/ui-kit/form-ui/src/form-render/form-field.vue b/packages/@core/ui-kit/form-ui/src/form-render/form-field.vue index 5bfa1b96e..af831cce4 100644 --- a/packages/@core/ui-kit/form-ui/src/form-render/form-field.vue +++ b/packages/@core/ui-kit/form-ui/src/form-render/form-field.vue @@ -48,6 +48,7 @@ const { modelPropName, renderComponentContent, rules, + help, } = defineProps< Props & { commonComponentProps: MaybeComponentProps; @@ -174,6 +175,18 @@ const computedProps = computed(() => { }; }); +// 自定义帮助信息 +const computedHelp = computed(() => { + return help ? onHelpFunc : undefined; +}); + +const onHelpFunc = () => { + if (!help) { + return undefined; + } + return isFunction(help) ? help(values.value, formApi!) : help; +}; + watch( () => computedProps.value?.autofocus, (value) => { @@ -322,7 +335,7 @@ onUnmounted(() => { labelClass, ) " - :help="help" + :help="computedHelp" :colon="colon" :label="label" :required="shouldRequired && !hideRequiredMark" diff --git a/packages/@core/ui-kit/form-ui/src/types.ts b/packages/@core/ui-kit/form-ui/src/types.ts index b5c5a4fbc..2238abd1c 100644 --- a/packages/@core/ui-kit/form-ui/src/types.ts +++ b/packages/@core/ui-kit/form-ui/src/types.ts @@ -67,6 +67,14 @@ export type FormActions = FormContext; export type CustomRenderType = (() => Component | string) | string; +// 动态渲染参数 +export type CustomParamsRenderType = + | (( + value: Partial>, + actions: FormActions, + ) => Component | string) + | string; + export type FormSchemaRuleType = | 'required' | 'selectRequired' @@ -254,7 +262,7 @@ export interface FormSchema< /** 字段名 */ fieldName: string; /** 帮助信息 */ - help?: CustomRenderType; + help?: CustomParamsRenderType; /** 是否隐藏表单项 */ hide?: boolean; /** 表单项 */ diff --git a/playground/src/views/examples/form/basic.vue b/playground/src/views/examples/form/basic.vue index 81fda07e1..fd96ff4d0 100644 --- a/playground/src/views/examples/form/basic.vue +++ b/playground/src/views/examples/form/basic.vue @@ -281,6 +281,8 @@ const [BaseForm, baseFormApi] = useVbenForm({ { component: 'DatePicker', fieldName: 'datePicker', + help: (values) => + [`这是一个可输出其他字段值的帮助信息${values?.rate}`].map((v) => h('p', v)), label: '日期选择框', }, { From 47a853330d843f800dd67225fc1494c2bd5a103d Mon Sep 17 00:00:00 2001 From: xueyitt <1455668754@qq.com> Date: Tue, 24 Mar 2026 10:22:02 +0800 Subject: [PATCH 5/5] =?UTF-8?q?feat:=20ApiSelect=E5=A2=9E=E5=8A=A0shouldFe?= =?UTF-8?q?tch=E6=8E=A7=E5=88=B6=EF=BC=8C=E5=9C=A8api=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E4=B9=8B=E5=89=8D=E7=9A=84=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E5=85=81=E8=AE=B8=E8=AF=B7=E6=B1=82=E7=9A=84=E5=9B=9E=E8=B0=83?= =?UTF-8?q?=E5=87=BD=E6=95=B0=20(#7713)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/api-component/api-component.vue | 13 ++++++++++++- playground/src/views/examples/form/basic.vue | 5 +++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/effects/common-ui/src/components/api-component/api-component.vue b/packages/effects/common-ui/src/components/api-component/api-component.vue index 19f51f526..682cd16b8 100644 --- a/packages/effects/common-ui/src/components/api-component/api-component.vue +++ b/packages/effects/common-ui/src/components/api-component/api-component.vue @@ -46,6 +46,8 @@ interface Props { alwaysLoad?: boolean; /** 在api请求之前的回调函数 */ beforeFetch?: AnyPromiseFunction; + /** 在api请求之前的判断是否允许请求的回调函数 */ + shouldFetch?: AnyPromiseFunction; /** 在api请求之后的回调函数 */ afterFetch?: AnyPromiseFunction; /** 直接传入选项数据,也作为api返回空数据时的后备数据 */ @@ -88,6 +90,7 @@ const props = withDefaults(defineProps(), { alwaysLoad: false, loadingSlot: '', beforeFetch: undefined, + shouldFetch: undefined, afterFetch: undefined, modelPropName: 'modelValue', api: undefined, @@ -159,7 +162,7 @@ const bindProps = computed(() => { }); async function fetchApi() { - const { api, beforeFetch, afterFetch, resultField } = props; + const { api, beforeFetch, shouldFetch, afterFetch, resultField } = props; if (!api || !isFunction(api)) { return; @@ -178,6 +181,14 @@ async function fetchApi() { if (beforeFetch && isFunction(beforeFetch)) { finalParams = (await beforeFetch(cloneDeep(finalParams))) || finalParams; } + // 判断是否需要控制执行中断 + if ( + shouldFetch && + isFunction(shouldFetch) && + !(await shouldFetch(finalParams)) + ) { + return; + } let res = await api(finalParams); if (afterFetch && isFunction(afterFetch)) { res = (await afterFetch(res)) || res; diff --git a/playground/src/views/examples/form/basic.vue b/playground/src/views/examples/form/basic.vue index fd96ff4d0..4474df943 100644 --- a/playground/src/views/examples/form/basic.vue +++ b/playground/src/views/examples/form/basic.vue @@ -113,6 +113,10 @@ const [BaseForm, baseFormApi] = useVbenForm({ params: { keyword: keyword.value || undefined, }, + // 远程搜索判断。当为true时,才允许调用api + shouldFetch: (params: any) => { + return !!params?.keyword; + }, showSearch: true, }; }, @@ -120,6 +124,7 @@ const [BaseForm, baseFormApi] = useVbenForm({ fieldName: 'remoteSearch', // 界面显示的label label: '远程搜索', + help: '远程查询,仅有输入时方进行查询', renderComponentContent: () => { return { notFoundContent: fetching.value ? h(Spin) : undefined,