/* * Author: 黎永顺 * name: 分组设置-定量-组距式分组编辑表格 * Description: * Date: 2023/4/12 */ import React, { Component } from "react"; import { WeaTableEdit } from "ecCom"; class GroupSpacingEditTable extends Component { constructor(props) { super(props); this.state = { dataSource: [] }; } componentDidMount() { const { setting4RationGroupSpacing } = this.props; this.setState({ dataSource: _.map(setting4RationGroupSpacing, item => { return { ...item, includeStart: item.includeStart ? "1" : "0", includeEnd: item.includeEnd ? "1" : "0" }; }) }); } handleChangeTableData = (dataSource) => { const { onChange } = this.props; this.setState({ dataSource }, () => onChange(this.state.dataSource)); }; render() { const { dataSource } = this.state; const columns = [ { title: "起始值", dataIndex: "startValue", key: "startValue", com: [ { label: "", key: "startValue", type: "INPUTNUMBER" } ] }, { title: "含", dataIndex: "includeStart", key: "includeStart", com: [ { type: "CHECKBOX", key: "includeStart", otherParams: { content: "含" } } ] }, { title: "至", dataIndex: "to", key: "to", com: [ { label: "", type: "TEXT" } ] }, { title: "结束值", dataIndex: "endValue", key: "endValue", com: [ { label: "", key: "endValue", type: "INPUTNUMBER" } ] }, { title: "含", dataIndex: "includeEnd", key: "includeEnd", com: [ { type: "CHECKBOX", key: "includeEnd", otherParams: { content: "含" } } ] } ]; return ( ({ ...item, to: "至" }))} showCopy={false} onChange={this.handleChangeTableData} /> ); } } export default GroupSpacingEditTable;