// q欠费科室列表
import React from 'react';
import { Card, Row, Col, Form, DatePicker, Select, Button, Checkbox, Table, Switch, message, Pagination, Input } from 'antd';
import { $http } from 'containers/config/https';
import CommonPagination from 'components/pagination/index';
import Moment from 'moment';
import store from 'store';

const { Option } = Select;
const FormItem = Form.Item;
const formItemLayout = {    // label 和input宽度
    labelCol: { span: 8 },
    wrapperCol: { span: 16 },
};
const formItemItem = {
    labelCol: { span: 10 },
    wrapperCol: { span: 14 }
};
const OPLocArrearsSetting = Form.create()(
    class extends React.Component {
        constructor() {
            super();
            this.state = {
                userInfo: {}, //表单数据详情
                ImportTypeListData: [], //进口类型列表数据
                pageSize: 10,
                page: 1,
                total: 0,
                rowKey: '', //行选中id
                rowData: {}, //当前行数据
                language: JSON.parse(window.sessionStorage.userData),
                columns: [],
                detailWidthTotal: ''
            }
            
            // 库存单的数据表头
            this.columns = [

                {
                    title: '科室类型',
                    dataIndex: 'LocType',
                    align: "center",
                    width: '100px'
                },
                {
                    title: '科室代码',
                    dataIndex: 'LocCode',
                    align: "center",
                    width: '100px'
                },
                {
                    title: '科室名称',
                    dataIndex: 'LocDescripts',
                    align: "center",
                    width: '100px'
                },
                {
                    title: '生效日期',
                    dataIndex: 'StartDate',
                    align: "center",
                    width: '100px'
                },
                {
                    title: '失效日期',
                    dataIndex: 'EndDate',
                    align: "center",
                    width: '100px'
                },
                {
                    title: '状态',
                    dataIndex: 'State',
                    align: "center",
                    width: '100px'
                },
                {
                    title: '操作',
                    dataIndex: 'op',
                    align: "center",
                    width: '100px'
                },
            ]
        }

        render() {
            const { getFieldDecorator } = this.props.form;
            return (
                <div className="OPLocArrearsSetting">
                    <Col span={16}>
                        <Row>
                            <Card
                                title={<div className="card-title-left-icon"><div></div>不受控科室详细</div>}
                                size="small"
                            >
                                <Col span={24}>
                                    <Row >
                                        <Col span={6}>
                                            <FormItem {...formItemLayout} label="科室">
                                                {getFieldDecorator('locDesc', {
                                                    initialValue: undefined
                                                })(
                                                    <Select allowClear style={{ width: '150px' }}>
                                                        <Option value="1" key="1" >...</Option>
                                                        <Option value="0" key="0" >...</Option>
                                                    </Select>
                                                )}
                                            </FormItem>
                                        </Col>
                                        <Col span={6}>
                                            <FormItem {...formItemLayout} label="状态">
                                                {getFieldDecorator('locState', {
                                                    initialValue: undefined
                                                })(
                                                    <Select allowClear style={{ width: '100%' }}>
                                                        <Option value="1" key="1" >有效</Option>
                                                        <Option value="0" key="0" >失效</Option>
                                                    </Select>
                                                )}
                                            </FormItem>
                                        </Col>
                                        <Col style={{ textAlign: 'center' }} span={3}>
                                            <Button onClick={this.searchInformation}>查询</Button>
                                        </Col>
                                    </Row>
                                </Col>
                            </Card>
                        </Row>
                        <Row>
                            <Col>
                                <Card
                                    size="small"
                                >
                                    <div style={{ height: store.getState().tableHeight.y + 94 + 'px' }}>
                                        <Table
                                            columns={this.columns.length > 0 ? this.columns : this.columns}
                                            // dataSource={this.state.ImportTypeListData}
                                            pagination={false}
                                            bordered
                                            style={{ height: store.getState().tableHeight.y + 61 + 'px' }}
                                            scroll={{ y: store.getState().tableHeight.y + 10 }}
                                        // rowKey={record => record.key}
                                        // onRow={this.onClickRow}
                                        // rowClassName={this.setRowClassName}
                                        />
                                        {/* <CommonPagination size='small' current={this.state.page} total={this.state.total} search='search'
                                            onShowSizeChange={this.onShowSizeChange.bind(this)} complete={true} dataSource={this.state.ImportTypeListData}
                                            loading={this.state.loading} onChange={this.onChange.bind(this)} /> */}
                                    </div>
                                </Card>
                            </Col>
                        </Row>
                    </Col>
                    <Col span={8}>
                        <Col >

                            <Form>
                                <Card
                                    title={<div className="card-title-left-icon"><div></div>添加不受控科室</div>}
                                    size="small"
                                >
                                    <div style={{ height: store.getState().tableHeight.y + 129 + 'px' }}>
                                        <Col >
                                            <Row>
                                                <Col span={11}>
                                                    <FormItem label="科室类型"{...formItemItem}>
                                                        {getFieldDecorator('locType', {
                                                            initialValue: undefined,
                                                        })(
                                                            <Select allowClear style={{ width: '200px' }}>
                                                                <Option value="1" key="1" >有效</Option>
                                                                <Option value="0" key="0" >失效</Option>
                                                            </Select>
                                                        )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row>
                                                <Col span={11}>
                                                    <FormItem label="科室" {...formItemItem}>
                                                        {getFieldDecorator('Desc', {
                                                            initialValue: undefined,
                                                        })(
                                                            <Select allowClear style={{ width: '200px' }}>
                                                                <Option value="1" key="1" >...</Option>
                                                                <Option value="0" key="0" >...</Option>
                                                            </Select>

                                                        )}
                                                    </FormItem>
                                                </Col>

                                            </Row>
                                            <Row>
                                                <Col span={11}>
                                                    <FormItem label="生效日期" {...formItemItem}>
                                                        {getFieldDecorator('startDate', {
                                                            initialValue: undefined,
                                                            rules: [{ required: true, message: '生效日期不能为空' }],
                                                        })(
                                                            <DatePicker
                                                                format="YYYY-MM-DD"
                                                                style={{ width: '200px' }}
                                                            >
                                                            </DatePicker>
                                                        )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row>

                                                <Col span={11}>
                                                    <FormItem label="失效日期" {...formItemItem}>
                                                        {getFieldDecorator('endDate', {
                                                            initialValue: undefined,
                                                        })(
                                                            <DatePicker
                                                                format="YYYY-MM-DD"
                                                                style={{ width: '200px' }}
                                                            >
                                                            </DatePicker>
                                                        )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                        </Col>
                                    </div>
                                </Card>
                            </Form>

                        </Col>
                        <Col>
                            <Row style={{ marginTop: '10px', textAlign: 'right' }} >
                                <Button type="primary" style={{ marginRight: '30px' }} onClick={this.saveData}>保存</Button>
                                <Button onClick={this.resetFields}>取消</Button>
                            </Row>
                        </Col>
                    </Col>
                </div>
            )
        }
    }
);
export default OPLocArrearsSetting;