/*
 * Author: 黎永顺
 * name: 公司组件
 * Description:
 * Date: 2023/5/10
 */
import React, { FunctionComponent } from "react";
import { OrgChartNodeDataType } from "@/components/reactChart/interface";
import styles from "./index.less";
import classNames from "classnames";

interface OwnProps {
  node: OrgChartNodeDataType;
}

type Props = OwnProps;

const RegionItem: FunctionComponent<Props> = (props) => {
  const { node } = props;
  const classes = classNames(styles["regionItemWrapper"], {
    [styles["regionItemWrapperChild"]]: node.key === 20 || node.key === 21 || node.key === 22 || node.key === 23 || node.key === 24 || node.key === 25
  });
  return (
    <div className={classes}>
      <div className={styles.header}>{node?.label}</div>
      <div className={styles.contBox}>
        <div>
          <div>
            <span>营业收入</span>
            <span>{node?.operatingIncome}</span>
          </div>
          <div>
            <span>同比</span>
            <span>{node?.operatingIncomePercent}</span>
          </div>
        </div>
        <div>
          <div>
            <span>利润总额</span>
            <span>{node?.operatingProfit}</span>
          </div>
          <div>
            <span>同比</span>
            <span>{node?.operatingProfitPercent}</span>
          </div>
        </div>
      </div>
    </div>
  );
};

export default RegionItem;
