From 41ff1d3673f4bb2b810676d8035f68fa31a87e4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Sun, 7 Apr 2024 09:54:45 +0800 Subject: [PATCH] =?UTF-8?q?custom/=E9=B2=81=E6=8E=A7=E6=95=B0=E5=AD=97-?= =?UTF-8?q?=E8=96=AA=E8=B5=84=E6=A0=B8=E7=AE=97=E5=88=97=E8=A1=A8=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=89=B9=E9=87=8F=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/calcTable/index.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/pages/calcTable/index.tsx b/src/pages/calcTable/index.tsx index fd6a942..9d6755e 100644 --- a/src/pages/calcTable/index.tsx +++ b/src/pages/calcTable/index.tsx @@ -83,23 +83,28 @@ const Index: FunctionComponent = (props) => { setSelectedRowKeys(selectedRowKeys); editItemList.current = []; setTableScrollHeight(tableScrollHeight); - setColumns([...convertColumns(_.map(columns, o => ({ ...o, i18n: i18nRes }))), { + setColumns([...convertColumns(_.map(columns, o => ({ ...o, i18n: i18nRes })), calcDetail), { title: i18nRes["操作"], dataIndex: "operate", fixed: "right", width: 120, render: (__, record) => () }]); } }; - const convertColumns: any = (cols: any[]) => { + const convertColumns: any = (cols: any[], editable: boolean) => { return _.map(cols, item => { if (_.isNaN(parseInt(item.dataIndex))) { return { ...item, editable: false }; } else { return { ...item, title: , - children: convertColumns(_.map(item.children, o => ({ ...o, i18n: item.i18n }))), - className: styles["td_odd"], i18n: item.i18n, editable: true, + children: convertColumns(_.map(item.children, o => ({ ...o, i18n: item.i18n })), editable), + className: styles["td_odd"], i18n: item.i18n, editable: !editable, onCell: (record: any, rowIndex: number) => ({ - record, rowIndex, dataIndex: item.dataIndex, title: item.title, editable: true, pattern: item.pattern, + record, + rowIndex, + dataIndex: item.dataIndex, + title: item.title, + editable: !editable, + pattern: item.pattern, handleSave }), render: (text: string) => (