From e0ff8d5294fb82561b9eb06bf68ba8d1b233b476 Mon Sep 17 00:00:00 2001 From: Oliver <1069035666@qq.com> Date: Tue, 10 Jan 2023 06:15:52 +0000 Subject: [PATCH 1/2] =?UTF-8?q?table=20updateColumn=20=E6=97=B6=20?= =?UTF-8?q?=E5=A4=9A=E7=BA=A7=E5=B1=9E=E6=80=A7=E5=8C=B9=E9=85=8D=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Oliver <1069035666@qq.com> --- src/components/Table/src/hooks/useColumns.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/Table/src/hooks/useColumns.ts b/src/components/Table/src/hooks/useColumns.ts index 9b1da22..5a549b0 100644 --- a/src/components/Table/src/hooks/useColumns.ts +++ b/src/components/Table/src/hooks/useColumns.ts @@ -298,7 +298,9 @@ export function useColumns( const column: BasicColumn[] = []; updateData.forEach((item) => { columnsRef.value.forEach((val) => { - if (val.dataIndex === item.dataIndex) { + const dataIndexStr = isArray(val.dataIndex) ? val.dataIndex.join('.') : val.dataIndex; + if (dataIndexStr === item.dataIndex) { + item.dataIndex = val.dataIndex; const newColumn = deepMerge(val, item); column.push(newColumn as BasicColumn); } else { -- Gitee From 4ef02bf3fc29eea2e5bd61560391fb23f23b059f Mon Sep 17 00:00:00 2001 From: Oliver <1069035666@qq.com> Date: Sat, 14 Jan 2023 05:19:26 +0000 Subject: [PATCH 2/2] =?UTF-8?q?Editable=20=20=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Oliver <1069035666@qq.com> --- .../src/components/editable/EditableCell.vue | 15 ++++++++------- src/components/Table/src/types/table.ts | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/components/Table/src/components/editable/EditableCell.vue b/src/components/Table/src/components/editable/EditableCell.vue index b878dbe..1f978e8 100644 --- a/src/components/Table/src/components/editable/EditableCell.vue +++ b/src/components/Table/src/components/editable/EditableCell.vue @@ -242,15 +242,16 @@ return false; } if (isFunction(editRule)) { - const res = await editRule(currentValue, record as Recordable); - if (!!res) { - ruleMessage.value = res; - ruleVisible.value = true; - return false; - } else { + editRule(currentValue, record as Recordable) + .then(() => { ruleMessage.value = ''; return true; - } + }) + .catch((msg) => { + ruleMessage.value = msg; + ruleVisible.value = true; + return false; + }); } } ruleMessage.value = ''; diff --git a/src/components/Table/src/types/table.ts b/src/components/Table/src/types/table.ts index 5366e2a..ac47f84 100644 --- a/src/components/Table/src/types/table.ts +++ b/src/components/Table/src/types/table.ts @@ -461,7 +461,7 @@ export interface BasicColumn extends ColumnProps { index: number; }) => Recordable) | Recordable; - editRule?: boolean | ((text: string, record: Recordable) => Promise); + editRule?: boolean | ((text: any, record: Recordable) => Promise); // editValueMap?: (value: any) => string; onEditRow?: () => void; -- Gitee