import React from 'react';
import { Modal,Form,Row,Col,Card,Table,Button} from 'antd';
import moment from 'moment';
import { $http } from 'containers/config/https';
import store from 'store';
import './index.less';
    const ConsultationAuthorization = Form.create()(
    class  extends React.Component{
    constructor(props){
        super(props);
        this.state = {
          visible: false,
          dataSource:[],//授权列表
          newData:[],//授权历史

        },
        // 开启授权的表头
        this.columns = [
          {
              key: 1,
              title: '科室',
              dataIndex: 'No',
              align: "center",
              width: '9%'
          },
          {
              key: 2,
              title: '医生',
              dataIndex: 'inOperLocDesc',
              align: "center",
              width: '9%'
          },
          {
              key: 3,
              title: '授权时间(小时)',
              dataIndex: 'vendorDesc',
              align: "center",
              width: '11%'
          },
          {
              key: 4,
              title: '权限名称',
              dataIndex: 'createDate',
              align: "center",
              width: '6%'
          },
          {
              key: 5,
              title: '操作',
              dataIndex: 'createUserName',
              align: "center",
              width: '6.5%'
          }
        ];
        this.column = [
          {
              key: 1,
              title: '状态',
              dataIndex: 'No',
              align: "center",
              width: '6.5%'
          },
          {
              key: 2,
              title: '科室',
              dataIndex: 'inOperLocDesc',
              align: "center",
              width: '6.5%'
          },
          {
              key: 3,
              title: '医生',
              dataIndex: 'vendorDesc',
              align: "center",
              width: '6.5%'
          },
          {
              key: 4,
              title: '权限描述',
              dataIndex: 'createDate',
              align: "center",
              width: '6.5%'
          },
          {
              key: 5,
              title: '授权开始日期',
              dataIndex: 'createUserName',
              align: "center",
              width: '6.5%'
          },
          {
            key: 6,
            title: '授权开始时间',
            dataIndex: 'createUserName',
            align: "center",
            width: '6.5%'
          },
          {
            key: 7,
            title: '授权结束日期',
            dataIndex: 'createUserName',
            align: "center",
            width: '6.5%'
        },{
          key: 8,
          title: '授权结束时间',
          dataIndex: 'createUserName',
          align: "center",
          width: '6.5%'
        }
      ]  
      }
    componentDidMount() {
        this.setState({
          showLoading: false
        })
    }
 
    showModal = () => {
        this.setState({
          visible_department: true,
        });
      };
    
      handleOk = e => {
        // console.log(e);
        this.setState({
          visible_department: false,
        });
      };
    
      handleCancel = e => {
        // console.log(e);
        this.setState({
          visible_department: false,
        });
      }
    
	
    render() {
  
        return(
          <Modal
            className="modal-wrap"
            width={900}
            height='800px'
            title="开启授权"
            visible={this.props.visible}
            onOk={this.hideModal}
            onCancel={this.props.hideModal}
          >
            <Card title="授权列表">
            <Table
                className="table-wrap"
                style={{height: '200px', maxHeight: '200px'}}
                dataSource={this.props.dataSource}
                columns={this.columns}
                pagination={false}
                rowKey={(row) => {
                    return row.ordID
                }}
                bordered
            />
            </Card>
            <Card title="授权历史" style={{marginTop:'10px'}}>
            <Table
                className="table-wrap"
                style={{height: '200px', maxHeight: '200px'}}
                dataSource={this.state.newData}
                columns={this.column}
                pagination={false}
                rowKey={(row) => {
                    return row.ordID
                }}
                bordered
            />
            </Card>
          </Modal> 
        )
    }
  }
)
export default ConsultationAuthorization;