import React, { Component } from 'react';
import { Button, Dropdown, Icon, Menu } from 'antd';
import ColumnAuthoritysModel from './ColumnAuthoritysModel';

class ComponentConfig extends Component {
  constructor(props) {
    super(props);
    this.state = {
      configType: "C",
      compontName: "",
      visible: false,
    }
  }
  handleMenuClick = (e) => {
    this.setState({
      configType: e.key,
      visible: true,
    })

  }

  render() {
    const menu = (
      <Menu onClick={this.handleMenuClick}>
        <Menu.Item key="C">列权限</Menu.Item>
        <Menu.Item key="B">按钮权限</Menu.Item>
      </Menu>
    );
    return (
      <div>
        <Dropdown overlay={menu}>
          <Button><Icon style={{ color: '#409AFF' }} type="setting" theme="filled" /></Button>
        </Dropdown>
        <ColumnAuthoritysModel
          clientWidth='800px'
          compontName={this.props.compontName}
          configType={this.state.configType}
          visible={this.state.visible}

          onCancel={
            () => {
              this.setState({
                visible: false,
              }, () => {
                this.props.reLoad()
              })
            }
          }
        />
      </div>
    );
  }
}

export default ComponentConfig;