import React,{Component} from 'react';
import {
    Switch,Button, Col, Row, Input, Select, message,Pagination,Card,Tabs,Table
} from 'antd';
import { $http } from '../../containers/config/https';
import { Util } from '../../tools';
class CBConfigTable extends Component {
    constructor(props) {
        super(props);
        this.state = {
            configData:[],
            configName:"",
            selectedRowKeys:[]
        };
        this.dataColumns = [
            {
                key: 1,
                title: '描述',
                dataIndex: 'Desc',
                width: 150,
                align: "center"
            }
        ]
    }
    componentWillMount() {
        this.setState({
            configData:this.props.configData,
            selectedRowKeys:this.props.selectedRowKeys,
            configName:this.props.configName,
        })
    }
    render() {
        const rowSelection = {
            onChange: (selectedRowKeys, selectedRows) => {
                this.setState({selectedRowKeys:selectedRowKeys})
            },
            getCheckboxProps: record => ({
              disabled: record.name === 'Disabled User', // Column configuration not to be checked
              name: record.name,
            }),
            selectedRowKeys:this.state.selectedRowKeys
        };
        return (
            <div style={{overflow:"auto",background: '#fff', height:'92.5%'}}>
                <div>{this.state.configName}</div>
                <Table ref="edittable" 
                    rowSelection={rowSelection} 
                    bordered 
                    columns={this.dataColumns} 
                    dataSource={this.state.configData} 
                    pagination={false} 
                    rowKey={row=>row.ID}
                    style={{height:'300px'}}
                />
                            
            </div>
        );
    }
}

export default CBConfigTable;
