/*
  *
  * 合计行
  * @Author:    黎永顺
  * @Date:      2024/5/24
  * @Wechat:
  * @Email:     971387674@qq.com
  * @description:
*/
import React, { FunctionComponent } from "react";
import { Table, Typography } from "antd";
import { ColumnType } from "antd/lib/table";

const { Text } = Typography;

interface OwnProps {
  columns: ColumnType<any>[];
  sumRow: any;
}

type Props = OwnProps;

const sumTotal: FunctionComponent<Props> = (props) => {
  return (<>
    {
      _.map(props.columns, (item: any, index) => {
        return <Table.Summary.Cell index={index + 1} key={index + 1}>
          <Text>{!_.isEmpty(props?.sumRow) ? props?.sumRow[item.dataIndex] : "-"}</Text>
        </Table.Summary.Cell>;
      })
    }
  </>);
};

export default sumTotal;
