From 58617f947941b754569ee69a176446f3ad412769 Mon Sep 17 00:00:00 2001 From: buqiyuan <1743369777@qq.com> Date: Fri, 4 Oct 2024 03:37:55 +0800 Subject: [PATCH] fix: table setting error --- .../src/components/editable-cell/index.vue | 9 +++----- .../table-settings/column-setting.vue | 21 +++++++++---------- .../table-settings/search-setting.vue | 8 +++---- .../table-settings/size-setting.vue | 2 +- .../core/dynamic-table/src/dynamic-table.vue | 8 +++---- .../dynamic-table/src/hooks/useColumns.ts | 7 ++++--- .../src/hooks/useTableContext.ts | 17 ++++++++++++--- .../dynamic-table/src/hooks/useTableForm.ts | 6 +++--- .../dynamic-table/src/hooks/useTableState.ts | 10 ++------- vite.config.ts | 4 ++-- 10 files changed, 47 insertions(+), 45 deletions(-) diff --git a/src/components/core/dynamic-table/src/components/editable-cell/index.vue b/src/components/core/dynamic-table/src/components/editable-cell/index.vue index 0a1469a56..6416f6ac4 100644 --- a/src/components/core/dynamic-table/src/components/editable-cell/index.vue +++ b/src/components/core/dynamic-table/src/components/editable-cell/index.vue @@ -53,6 +53,7 @@ const tableContext = useTableContext(); const { + tableProps, editFormModel, editTableFormRef, editFormErrorMsgs, @@ -105,11 +106,7 @@ const handleSaveCell = async () => { const { rowKey, column } = props; await validateCell(rowKey!, dataIndex.value); - const saveRes = tableContext.props.onSave?.( - rowKey!, - editFormModel.value[rowKey!], - column?.record, - ); + const saveRes = tableProps.onSave?.(rowKey!, editFormModel.value[rowKey!], column?.record); if (isPromise(saveRes)) { saving.value = true; await saveRes.finally(() => (saving.value = false)); @@ -120,7 +117,7 @@ const handleCancelSaveCell = () => { const { rowKey, column } = props; - tableContext.props?.onCancel?.(rowKey!, editFormModel.value[rowKey!], column?.record); + tableProps.onCancel?.(rowKey!, editFormModel.value[rowKey!], column?.record); isCellEdit.value = false; cancelCellEditable(props.rowKey!, dataIndex.value); }; diff --git a/src/components/core/dynamic-table/src/components/table-settings/column-setting.vue b/src/components/core/dynamic-table/src/components/table-settings/column-setting.vue index a32bd24b6..710d43ced 100644 --- a/src/components/core/dynamic-table/src/components/table-settings/column-setting.vue +++ b/src/components/core/dynamic-table/src/components/table-settings/column-setting.vue @@ -27,7 +27,7 @@