import React from 'react';
import { connect } from 'dva';
import {  Modal } from 'antd';

class DeleteConfirmPage extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      visible:false,
    };
  };
  handleShowModal = () => {
    this.setState({
      visible: true
    })
  }
  handleCloseModal = () => {
    this.setState({
      visible: false
    })
  }
  handleDeleteRecord=()=>{
    if (typeof this.props.handle == 'function') {
      this.props.handle();
    }
    this.handleCloseModal();
  };


  render() {

    return (
      <div className='btn_margin'>
        <span onClick={this.handleShowModal}>{this.props.children}</span>
        <Modal visible={this.state.visible} maskClosable={false} onCancel={this.handleCloseModal}  title="确认删除"  onOk={this.handleDeleteRecord}>
          <p>是否确认删除?</p>
        </Modal>
      </div>
    );
  }
}

DeleteConfirmPage.propTypes = {
};

export default connect()(DeleteConfirmPage);
