From 58d99f7a0a0cf9e41077c0f9a62a9537e45a7d7d Mon Sep 17 00:00:00 2001 From: buqiyuan <1743369777@qq.com> Date: Sat, 9 Mar 2024 15:18:53 +0800 Subject: [PATCH] fix(schema-form): nested field setting failed --- src/components/core/draggable-modal/index.vue | 11 +++--- .../schema-form/src/hooks/useFormEvents.ts | 27 ++++++++------- .../schema-form/src/hooks/useFormMethods.ts | 34 ++++--------------- .../core/schema-form/src/schema-form.vue | 14 ++++---- .../core/schema-form/src/types/form.ts | 12 ++----- src/router/routes/modules/demos.ts | 2 +- .../demos/tables/edit-row-table/columns.tsx | 7 ---- src/views/system/role/index.vue | 4 ++- 8 files changed, 40 insertions(+), 71 deletions(-) diff --git a/src/components/core/draggable-modal/index.vue b/src/components/core/draggable-modal/index.vue index 5e0b7ba74..ce47f8901 100644 --- a/src/components/core/draggable-modal/index.vue +++ b/src/components/core/draggable-modal/index.vue @@ -4,7 +4,7 @@
diff --git a/src/components/core/schema-form/src/types/form.ts b/src/components/core/schema-form/src/types/form.ts index 931f175f5..63879042c 100644 --- a/src/components/core/schema-form/src/types/form.ts +++ b/src/components/core/schema-form/src/types/form.ts @@ -64,20 +64,12 @@ type ComponentSchema = /** 表单组件属性 */ componentProps?: | ComponentProps - | { - (opt: RenderCallbackParams>): ComponentProps; - requestResult: ComponentProps['requestResult']; - }; + | ((opt: RenderCallbackParams>) => ComponentProps); }; }[ComponentType] | { component: CustomRenderFn | ((opt: RenderCallbackParams) => Component); - componentProps?: - | ComponentProps - | { - (opt: RenderCallbackParams): ComponentProps; - requestResult: ComponentProps['requestResult']; - }; + componentProps?: ComponentProps | ((opt: RenderCallbackParams) => ComponentProps); }; /** 表单项 */ diff --git a/src/router/routes/modules/demos.ts b/src/router/routes/modules/demos.ts index 9978de69c..dcc5298b9 100644 --- a/src/router/routes/modules/demos.ts +++ b/src/router/routes/modules/demos.ts @@ -161,7 +161,7 @@ const routes: Array = [ meta: { title: '英雄详情', icon: 'ant-design:desktop-outlined', - hideInMenu: false, + hideInMenu: true, keepAlive: false, activeMenu: `${moduleName}-table-lol`, }, diff --git a/src/views/demos/tables/edit-row-table/columns.tsx b/src/views/demos/tables/edit-row-table/columns.tsx index 4dabc8890..9f38bf8df 100644 --- a/src/views/demos/tables/edit-row-table/columns.tsx +++ b/src/views/demos/tables/edit-row-table/columns.tsx @@ -17,7 +17,6 @@ export type ListItemType = (typeof tableData)[number]; export const columns: TableColumn[] = [ { title: '姓名', - dataIndex: 'name', sorter: true, /** 默认开启编辑, 仅`editableType`为`cell`时有效 */ @@ -38,7 +37,6 @@ export const columns: TableColumn[] = [ }, { title: '性别', - dataIndex: 'gender', /** 搜索表单配置 */ formItemProps: { @@ -75,8 +73,6 @@ export const columns: TableColumn[] = [ rules: [{ required: true, type: 'number', message: '请选择性别' }], componentProps: ({ formInstance, formModel, tableRowKey }) => ({ onChange() { - console.log('formModel', formModel); - // 根据当前选择的性别,更新衣服可选项 formInstance?.updateSchema({ field: `${tableRowKey}.clothes`, @@ -92,7 +88,6 @@ export const columns: TableColumn[] = [ }, { title: '衣服', - dataIndex: 'clothes', formItemProps: { component: 'Select', @@ -136,7 +131,6 @@ export const columns: TableColumn[] = [ }, { title: '价格', - dataIndex: 'price', editFormItemProps: { component: 'InputNumber', @@ -146,7 +140,6 @@ export const columns: TableColumn[] = [ }, { title: '状态', - dataIndex: 'status', formItemProps: { component: 'Select', diff --git a/src/views/system/role/index.vue b/src/views/system/role/index.vue index 8ecdaac4f..3faae3114 100644 --- a/src/views/system/role/index.vue +++ b/src/views/system/role/index.vue @@ -113,7 +113,9 @@ perm: 'system:role:update', effect: 'disable', }, - onClick: () => openMenuModal(record), + onClick: () => { + openMenuModal(record); + }, }, { label: '删除',