/*
 * Author: 黎永顺
 * name: 个税申报-字段对应查看列表
 * Description:
 * Date: 2023/8/16
 */
import React, { Component } from "react";
import { WeaTable } from "ecCom";

class LedgerFieldsTable extends Component {
  constructor(props) {
    super(props);
    this.state = {
      dataSource: []
    };
  }

  componentWillReceiveProps(nextProps, nextContext) {
    if (nextProps.dataSource !== this.props.dataSource && !_.isEmpty(nextProps.dataSource)) {
      this.setState({
        dataSource: _.take(nextProps.dataSource)[0].taxReportRules || _.take(nextProps.dataSource)[0].addUpRules
      });
    }
  }

  render() {
    const { columns } = this.props;
    const { dataSource } = this.state;
    return (
      <WeaTable dataSource={dataSource} columns={columns} pagination={false} bordered/>
    );
  }
}

export default LedgerFieldsTable;
