diff --git a/src/pages/calcTable/index.tsx b/src/pages/calcTable/index.tsx index b0cd6aa..b4931b4 100644 --- a/src/pages/calcTable/index.tsx +++ b/src/pages/calcTable/index.tsx @@ -97,49 +97,8 @@ const Index: FunctionComponent = (props) => { setSelectedRowKeys([...selectedRowKeys, ...rowKeys]); setTableScrollHeight(tableScrollHeight); setMzgOptPermission(mzgOptPermission); - setColumns([ - ...convertColumns(_.map(columns, (o) => ({ ...o, i18n: i18nRes }))), - { - title: i18nRes["操作"], - dataIndex: "operate", - fixed: "right", - width: optWidth || 120, - render: (__, record) => ( - - - {optWidth && ( - <> - - - - )} - {record?.lockTime && {record?.lockTime}} - - ) - } - ]); + setColumns(_.map(columns, (o) => ({ ...o, i18n: i18nRes }))); + setEditCell({}); } }; const convertColumns: any = (cols: any[]) => { @@ -353,6 +312,51 @@ const Index: FunctionComponent = (props) => { ); } }; + const cols = useMemo(() => { + return [ + ...convertColumns(columns), + { + title: i18n["操作"], + dataIndex: "operate", + fixed: "right", + width: optWidth || 120, + render: (__: any, record: any) => ( + + + {optWidth && ( + <> + + + + )} + {record?.lockTime && {record?.lockTime}} + + ) + } + ]; + }, [columns, editCell, i18n]); const components = { body: { row: EditableRow, @@ -373,7 +377,7 @@ const Index: FunctionComponent = (props) => { x: 1200, y: `calc(100vh - ${tableScrollHeight || (!showTotalCell ? 165 : 200)}px)` }} - columns={(!isDetailTable || showSee) && !mzgOptPermission ? columns : _.filter(columns, (o) => o.dataIndex !== "operate")} + columns={(!isDetailTable || showSee) && !mzgOptPermission ? cols : _.filter(cols, (o) => o.dataIndex !== "operate")} footer={() => (!isDetailTable ? : null)} pagination={ !_.isNil(pageInfo) @@ -392,7 +396,7 @@ const Index: FunctionComponent = (props) => { {i18n["总计"]} - + )