From 5a6db8c640376ca67b451a9647b9958946e5c3ab Mon Sep 17 00:00:00 2001 From: vben Date: Tue, 20 Oct 2020 23:30:48 +0800 Subject: [PATCH] fix(table): fix table actionColOptions not work --- src/components/Form/src/BasicForm.vue | 6 +++++- src/components/Form/src/FormAction.tsx | 2 +- src/components/Form/src/types/form.ts | 20 ++++++++++---------- src/components/Table/src/types/table.ts | 2 +- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/components/Form/src/BasicForm.vue b/src/components/Form/src/BasicForm.vue index 15382631f2d..41542002884 100644 --- a/src/components/Form/src/BasicForm.vue +++ b/src/components/Form/src/BasicForm.vue @@ -207,7 +207,11 @@ } } advanceState.actionSpan = (realItemColSum % BASIC_COL_LEN) + unref(getEmptySpanRef); - getAdvanced(props.actionColOptions || { span: BASIC_COL_LEN }, itemColSum, true); + getAdvanced( + unref(getActionPropsRef).actionColOptions || { span: BASIC_COL_LEN }, + itemColSum, + true + ); emit('advanced-change'); } function getAdvanced(itemCol: Partial, itemColSum = 0, isLastAction = false) { diff --git a/src/components/Form/src/FormAction.tsx b/src/components/Form/src/FormAction.tsx index 7833255fecb..944a77be964 100644 --- a/src/components/Form/src/FormAction.tsx +++ b/src/components/Form/src/FormAction.tsx @@ -71,8 +71,8 @@ export default defineComponent({ const advancedSpanObj = showAdvancedButton ? { span: actionSpan < 6 ? 24 : actionSpan } : {}; const actionColOpt: Partial = { span: showAdvancedButton ? 6 : 4, - ...actionColOptions, ...advancedSpanObj, + ...actionColOptions, }; return actionColOpt; }); diff --git a/src/components/Form/src/types/form.ts b/src/components/Form/src/types/form.ts index d3265461168..6fa07f39b73 100644 --- a/src/components/Form/src/types/form.ts +++ b/src/components/Form/src/types/form.ts @@ -48,7 +48,7 @@ export interface FormProps { // 空白行span emptySpan?: number | Partial; // 表单内部组件大小 - size: 'default' | 'small' | 'large'; + size?: 'default' | 'small' | 'large'; // 是否禁用 disabled?: boolean; // 时间区间字段映射成多个 @@ -62,25 +62,25 @@ export interface FormProps { // 超过指定行数自动收起 autoAdvancedLine?: number; // 是否显示操作按钮 - showActionButtonGroup: boolean; + showActionButtonGroup?: boolean; // 重置按钮配置 - resetButtonOptions: Partial; + resetButtonOptions?: Partial; // 确认按钮配置 - submitButtonOptions: Partial; + submitButtonOptions?: Partial; // 操作列配置 - actionColOptions: Partial; + actionColOptions?: Partial; // 显示重置按钮 - showResetButton: boolean; + showResetButton?: boolean; // 显示确认按钮 - showSubmitButton: boolean; + showSubmitButton?: boolean; - resetFunc: () => Promise; - submitFunc: () => Promise; - transformDateFunc: (date: any) => string; + resetFunc?: () => Promise; + submitFunc?: () => Promise; + transformDateFunc?: (date: any) => string; colon?: boolean; } export interface FormSchema { diff --git a/src/components/Table/src/types/table.ts b/src/components/Table/src/types/table.ts index 1b19618cf1a..a660c802830 100644 --- a/src/components/Table/src/types/table.ts +++ b/src/components/Table/src/types/table.ts @@ -94,7 +94,7 @@ export interface BasicTableProps { // 使用搜索表单 useSearchForm?: boolean; // 表单配置 - formConfig?: FormProps; + formConfig?: Partial; // 列配置 columns: BasicColumn[]; // 是否显示序号列