/*
 * Author: 黎永顺
 * name: 分组设置-定量-单项式分组编辑表格
 * Description:
 * Date: 2023/4/12
 */
import React, { Component } from "react";
import { WeaLocaleProvider, WeaTableEdit } from "ecCom";

const { getLabel } = WeaLocaleProvider;
class GroupIndividualEditTable extends Component {
  constructor(props) {
    super(props);
    this.state = {
      dataSource: []
    };
  }

  componentDidMount() {
    const { setting4RationGroupIndividual } = this.props;
    this.setState({
      dataSource: setting4RationGroupIndividual
    });
  }

  handleChangeTableData = (dataSource) => {
    const { onChange } = this.props;
    this.setState({ dataSource }, () => onChange(this.state.dataSource));
  };

  render() {
    const { dataSource } = this.state;
    const columns = [
      {
        title: getLabel(111, "分组设置值"),
        dataIndex: "value",
        key: "value",
        com: [
          { label: "", key: "value", type: "INPUTNUMBER" }
        ]
      }
    ];
    return (
      <WeaTableEdit
        draggable={true} columns={columns} datas={dataSource}
        showCopy={false} deleteConfirm onChange={this.handleChangeTableData}
      />
    );
  }
}

export default GroupIndividualEditTable;
