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) => (