// deptDocEndDate 人员编辑
import React from 'react';
import { Select, Row, Col, Button, Switch, DatePicker, message, Icon, Form, Collapse, Upload, Tag, Divider, Input } from 'antd';
import { $http } from 'containers/config/https';
import '../style/style.less';
import { Util } from 'tools/index';
import Moment from 'moment';
import OfficePanelModel from './OfficePanelModel'
// 组件const
const { Option } = Select;
const Panel = Collapse.Panel;
const { TextArea } = Input;
const formItemLayout = {    // label 和input宽度
    labelCol: { span: 14 },
    wrapperCol: { span: 8, offset: 2 },
};
const formItemLayoutT = {
    labelCol: { span: 14 },
    wrapperCol: { span: 16, },
};
class OfficePanel extends React.Component {
    constructor(props) {
        super(props)
        this.state = {
            locExpDr: '',
            //medData: [],// 专长集合
            imageUrl: '',
            userExperAry: [], // 专长请求数组
            locData: [], // 回显专长数组
            // medDataIs: '', // 外层专长是否变化
            //medExperId: '', // 外层专长主键
            medDis: [], // 专长不可选数组
            removeUserExperAry: [], // 专长删除数组
            dataSource: props.newData || {},
        };
    }

    componentDidMount() {
        //console.log(this.props.dataSource.userPowerAry.userExperAry)
        // this.getSelectDwonData(this.props.locid);
        let locData = [];
        if (this.props.dataSource.userPowerAry !== undefined) {
            locData = this.props.dataSource.userPowerAry.userExperAry;
        }
        if (this.props.dataSource.userID !== undefined) {

            this.getListData();
            // this.setState({ locid: this.props.dataSource.userId, locData: locData })
            this.setState({ locID: this.props.locID, locData: locData })
        }



    }
    componentWillReceiveProps(nextProps) {
        const that = this
        //console.log(nextProps)
        if (JSON.stringify(that.props.newData) !== JSON.stringify(nextProps.newData)) {
            this.setState({
                dataSource: nextProps.newData
            })
        }

    }

    //获取下拉框数据
    // getSelectDwonData = (value) => {
    //     let data = {
    //         params: [{
    //             locDr: value
    //         }]
    //     }
    //     $http.post('urlS', this, {
    //         code: "01050017",
    //         data: data,
    //         success: function (res) {
    //             //console.log(res.result.Data);
    //             if (+res.errorCode === 0) {
    //                 if (res.result.Data) {
    //                     this.setState({ medData: res.result.Data ? res.result.Data : [] })
    //                 }
    //             }
    //         }
    //     })
    // }
    // medChange= (value) => {
    //     let {  medDis } = this.state
    //     let index = medDis.indexOf(this.props.form.getFieldValue('medData'));

    //     medDis.push(value) // 不可选数组
    //     if (index > -1) {
    //         medDis.splice(index, 1);
    //     }
    // }
    onSelctChange = (id) => {
        // console.log(this.state.medData);
        this.state.medData.forEach((item) => {
            if (item.id == id) {
                this.setState({
                    select: item.descripts,
                    locExpDr: item.id,
                })
            }
        })

    }


    //重置表单
    // handleReset = () => {
    //     this.props.form.resetFields();
    //   }
    handleCancel = (e) => {
        this.props.handThis.goback()
        return
    }
    // 保存用户信息科室提交
    handleSubmit = (e) => {

        var userData = JSON.parse(sessionStorage.getItem('userData'));
        e.preventDefault();

        if (this.state.dataSource.userID === undefined) {
            message.error("请先查询或选择要编辑的用户");
            return;
        }
        this.props.form.validateFields((err, values) => {
            // let deptDocEndDate = "";
            // if (values.deptDocEndDate !== undefined) {
            //     deptDocEndDate = Moment(values.deptDocEndDate).utcOffset(480).format('YYYY-MM-DD')
            // }
            if (!err) {  //!err
                let { userExperAry, removeUserExperAry, medDataIs, medExperId } = this.state
                const userExperAryHttp = []   // 请求数据
                // let exp = this.state.medData.filter(function (item) {
                //     return item.CBExpDr == values.medData;
                // })


                userExperAry.map((item) => {
                    let obj = {
                        userExperID: item.userExperID || '',
                        locID: this.props.locID,
                        CBExperID: item.CBExperID,
                    }
                    userExperAryHttp.push(obj)
                })
                // if (exp.length !== 0) {
                //     userExperAryHttp.push({
                //         userExperId: medExperId || '',
                //         userExperLocId: this.props.locid || '',
                //         userCBExperId: exp[0].CBExpDr || '',
                //     })
                // }
                // 判断外层专长是否有变化
                // if (removeUserExperAry === undefined) { removeUserExperAry = []; }

                // if (!values.medData) {
                //     removeUserExperAry.push(medExperId)
                // }
                // removeUserExperAry = removeUserExperAry.filter(value => Object.keys(value).length !== 0); // 去空
                if (removeUserExperAry.length > 0) {
                    removeUserExperAry = removeUserExperAry.filter(value => Object.keys(value).length !== 0); // 去空
                }


                let data = {
                    params: [{
                        deptDocLogID: userData.deptDocLogID || '',//科室人员
                        locID: this.props.locID || '',// 科室ID
                        userID: this.state.dataSource.userID || '',    //用户ID
                        updateUserID: userData.userID || '',    //当前用户
                        hospID: values.hospID || "",   //科室主键
                        deptDepartmentHead: Util.replaceTrueFalse(values.deptDepartmentHead) || '', //部门领导 
                        deptTriageNurse: Util.replaceTrueFalse(values.deptTriageNurse) || '', //分诊护士                    
                        deptInpatient: Util.replaceTrueFalse(values.deptInpatient) || '',     //住院病人
                        deptOutpatient: Util.replaceTrueFalse(values.deptOutpatient) || '',    //门诊病人
                        deptEmergency: Util.replaceTrueFalse(values.deptEmergency) || '',       // 急诊病人
                        deptOwnPatientsOnly: Util.replaceTrueFalse(values.deptOwnPatientsOnly) || '', //只看本病人可用              
                        deptPrescriberFlag: Util.replaceTrueFalse(values.deptPrescriberFlag) || '',        // 处方权                     
                        deptNoOrders: Util.replaceTrueFalse(values.deptNoOrders) || '',     // 无医嘱权                        
                        deptNoEMR: Util.replaceTrueFalse(values.deptNoEMR) || '', // 无病历权
                        deptNoDiagnosis: Util.replaceTrueFalse(values.deptNoDiagnosis) || '',    //无诊断权
                        deptAnaesthesia: Util.replaceTrueFalse(values.deptAnaesthesia) || '',   // 毒麻药品处方权
                        deptAntibiotic: Util.replaceTrueFalse(values.deptAntibiotic) || '',     //抗生素处方权
                        deptNotReadResults: Util.replaceTrueFalse(values.deptNotReadResults) || '',     //不看检查结果
                        herbalPresc: Util.replaceTrueFalse(values.herbalPresc) || '',     //草药处方权
                        deptSchedule: Util.replaceTrueFalse(values.deptSchedule) || '',          //是否排版
                        deptDocIntroduce: values.deptDocIntroduce || '',        //科室医生简介
                        deptDocStartDate: Moment(values.deptDocStartDate).format('YYYY-MM-DD') || '',        //生效日期
                        deptDocEndDate: values && values.deptDocEndDate ? Moment(values.deptDocEndDate).format('YYYY-MM-DD') : '',          //失效日期
                        userExperAry: userExperAryHttp || [],        //专长数组
                        removeUserExperAry: removeUserExperAry || [],        //专长数组删除的
                    }]
                };
                $http.post('urlADS', this, {
                    code: "01040025",
                    data: data,
                    success: function (res) {
                        let errorCode = res.errorCode;
                        if (errorCode === '0') {
                            this.setState({
                                // deptLocId: 'relive' // 提交成功 置空
                            })
                            message.success(res.errorMessage);
                            //刷新数据
                            handleThis.handleQuery();
                            //新增或编辑成功重置form表单 
                            //this.handleReset();

                        }
                    }
                });
            }

        });
    }

    // 查询用户在指定科室信息搜索所有的用户
    getListData = () => {
        let data = {
            params: [{
                userID: this.props.dataSource.userID,
                locID: this.props.locID,
                userCode: '',
                userName: '',
                userCredTypeID: '',
                userCredNo: '',
                userMobile: '',
            }],
            pagination: [{
                pageSize: 10,
                currentPage: 1,
                sortColumn: 'code',
                sortOrder: 'asc'
            }]
        };
        $http.post('urlS', this, {
            code: "01040051",
            data: data,
            success: function (res) {
                // this.closeListLoading()
                if (+res.errorCode === 0) {
                    // this.props.form.setFielenddsValue({ deptDocStartDate: Moment(res.result.Data[0].deptDocStartDate).format('YYYY-MM-DD')});
                    // this.props.form.setFielenddsValue({ deptDocEndDate: Moment(res.result.Data[0].deptDocEndDate).format('YYYY-MM-DD')});
                    this.setState({
                        dataSource: res.result,
                        locID: res.result.userPowerAry.deptLocId,
                        locData: res.result.userPowerAry.userExperAry,
                        imageUrl: res.result.userImage
                        // medExperId: res.result.userPowerAry.userFirstExperiseAry[0] ? res.result.userPowerAry.userFirstExperiseAry[0].userFirstExperId+"" : '', //medData是否有变化

                    }, () => {
                        //    console.log(this.state.dataSource.userPowerAry.deptDocStartDate) 
                    })
                    // this.props.form.setFieldsValue({
                    //     medData: res.result.userPowerAry.userFirstExperiseAry[0] ? res.result.userPowerAry.userFirstExperiseAry[0].userFirstCBExperId.toString() : '',   //外层专长
                    // })
                }
            }
        });

    }
    beforeUpload(file) {
        const isJPG = file.type === 'image/jpeg';
        if (!isJPG) {
            message.error('You can only upload JPG file!');
        }
        const isLt2M = file.size / 1024 / 1024 < 2;
        if (!isLt2M) {
            message.error('Image must smaller than 2MB!');
        }
        return isJPG && isLt2M;
    }
    handleChange = (info) => {
        if (info.file.status === 'uploading') {
            this.setState({ loading: true });
            return;
        }
        if (info.file.status === 'done') {
            // Get this url from response in real world.
            getBase64(info.file.originFileObj, imageUrl => this.setState({
                imageUrl,
                loading: false,
            }));
        }
    }

    // 调用子组件公共库导入的连接事件
    onRef = (ref) => {
        this.libraryChild = ref
    }

    // 点击公共库导入显示弹框
    handleLibraryImport = () => {
        this.libraryChild.showModal();
    }

    // 子组件传值回来 data专长数组 removeUserExperAry删除专长
    callbackModal = (data, removeUserExperAry, medDis) => {
        //console.log(data)
        this.setState({
            userExperAry: data,
            removeUserExperAry: removeUserExperAry,
            medDis: medDis
        });

    }

    render() {
        const uploadButton = (
            <div>
                <Icon type={this.state.loading ? 'loading' : 'plus'} />
                <div className="ant-upload-text">上传</div>
            </div>
        );
        const imageUrl = this.state.imageUrl;
        const { getFieldDecorator } = this.props.form;
        var deptPowerObj = {}
        if (typeof this.state.dataSource.userPowerAry !== "undefined") {
            deptPowerObj = this.state.dataSource.userPowerAry
        }

        let windowHost = window.location && window.location.origin ? window.location.origin : (window.location && window.location.protocol ? (window.location.protocol + '//' + window.location.hostname) : "");
        let patientUrl = !Util.isEmpty(this.state.imageUrl) ? this.state.imageUrl : ''
        var patientImg = patientUrl ? (patientUrl.indexOf("http") !== -1 ? patientUrl : windowHost + patientUrl) : '';
        console.dir(patientImg)
        // let userInfo = this.state.userInfo;
        return (
            <div style={{ padding: 24 }}>
                <Form layout="vertical" className="userForm">
                    <Collapse defaultActiveKey={['1', '2']} >
                        <Panel header="用户信息" key="1">
                            <Row style={{ marginTop: '15px' }}>
                                <Col span={24} style={{ margintop: '15px' }}>
                                    <span style={{ marginLeft: '20px' }}>基本信息:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{this.state.dataSource.code}</span>
                                    {this.state.dataSource.descripts && <Divider type="vertical" />}
                                    <span style={{ marginLeft: '20px' }}>{this.state.dataSource.userDesc}</span>
                                    {this.state.dataSource.descripts && <Divider type="vertical" />}
                                    <span style={{ marginLeft: '20px' }}>{this.state.dataSource.userName}</span>
                                    <span style={{ marginLeft: '20px' }}>{this.state.dataSource.userSexDesc}</span>
                                    {this.state.dataSource.descripts && <Divider type="vertical" />}
                                    <span style={{ marginLeft: '20px' }}>{this.state.dataSource.userDOB}</span>
                                    <span style={{ marginLeft: '20px' }}>{this.state.dataSource.userTitleDesc}</span>
                                    <span style={{ marginLeft: '20px' }}>{this.state.dataSource.userCredTypeDesc}</span>
                                    <span style={{ marginLeft: '20px' }}>{this.state.dataSource.userCredNo}</span>
                                    {this.state.dataSource.descripts && <Divider type="vertical" />}
                                    <span style={{ marginLeft: '20px' }}>{this.state.dataSource.userMobile}</span>
                                </Col>
                                <Col span={18}>
                                    <Row>
                                        <Col span={2} style={{ marginTop: '15px' }}>
                                            <span style={{ marginLeft: '20px' }}>语言:</span>
                                        </Col>
                                        {/* <Col span={4}>
                                            <span>{this.state.dataSource.languageDesc}</span>
                                        </Col> */}
                                        <Col span={22} style={{ height: '20px', marginTop: '15px' }}>
                                            <span>{this.state.dataSource.userLanguageDesc}</span>
                                        </Col>
                                    </Row>
                                    <Row>
                                        <Col span={2} style={{ marginTop: '15px' }}>
                                            <span style={{ marginLeft: '20px' }}>简介:</span>
                                        </Col>
                                        <Col span={22} style={{ marginTop: '15px' }}>
                                            <span>{this.state.dataSource.userIntroduce}</span>
                                        </Col>
                                    </Row>
                                    <Row>
                                        <Col span={2} style={{ marginTop: '15px' }}>
                                            <span style={{ marginLeft: '20px' }}>人员类型:</span>
                                        </Col>

                                        <Col span={22} style={{ height: '40px', marginTop: '15px' }}>
                                            {
                                                this.state.dataSource.userTypeAry && this.state.dataSource.userTypeAry.map((item) => {
                                                    return (
                                                        <span style={{ display: item.userTypeValue === 'N' ? 'none' : 'inline-block' }}>
                                                            <Tag color="cyan">{item.userTypeDesc}</Tag>
                                                        </span>
                                                    )
                                                })
                                            }
                                        </Col>
                                    </Row>
                                    <Row>
                                        <Col span={2} style={{ marginTop: '5px' }}>
                                            <span style={{ marginLeft: '20px' }}>当前状态:</span>
                                        </Col>

                                        <Col span={22} style={{ height: '20px', marginTop: '5px' }}>
                                            <span>{this.state.dataSource.userActive}</span>
                                        </Col>
                                    </Row>
                                </Col>
                                <Col span={6}>
                                    <Upload
                                        name="avatar"
                                        listType="picture-card"
                                        className="avatar-uploader"
                                        showUploadList={false}
                                        action="//jsonplaceholder.typicode.com/posts/"
                                        beforeUpload={this.beforeUpload}
                                        onChange={this.handleChange}
                                    >
                                        {imageUrl ? <img src={patientImg} alt="avatar" /> : uploadButton}
                                    </Upload>
                                </Col>
                            </Row>
                        </Panel>
                        <Panel header="科室配置" key="2">
                            {/* <Row>
                                <Col className="textR" span={2}>
                                    <span>人员专长:</span>
                                </Col>
                                <Col span={20} style={{ marginLeft: '15px' }}>
                                    <Form.Item>
                                        {getFieldDecorator('medData', {
                                            initialValue: ''
                                        })(
                                            <Select allowClear style={{ width: '150px' }} placeholder="人员专长"  onChange={(event) => { this.medChange(event) }} >
                                                {this.state.medData.map(item => <Option title={item.descripts + '^' + item.descriptsSPCode }  disabled={this.state.medDis.includes(item.CBExpDr)}  key={item.CBExpDr} value={item.CBExpDr}  >{item.descripts}</Option>)}
                                            </Select>
                                        )}
                                         <span style={{ color: 'rgb(66, 185, 131)', cursor: 'pointer', textDecoration: 'underline', marginLeft: '15px' }} onClick={this.handleLibraryImport}>+管理其他专长</span>
                                    </Form.Item>
                                   
                                </Col>
                            </Row> */}
                            <Row>
                                <Col className="textR" span={2}>
                                    <span >人员类型:</span>
                                </Col>
                                <Col span={2}>
                                    <Form.Item label="科室领导"  {...formItemLayout} className="labelR" >
                                        {getFieldDecorator('deptDepartmentHead', {
                                            valuePropName: 'checked',
                                            initialValue: deptPowerObj.deptDepartmentHead === "Y" ? true : false
                                        })(
                                            <Switch checkedChildren="是" unCheckedChildren="否" />
                                        )}
                                    </Form.Item>
                                </Col>
                                <Col span={2}>
                                    <Form.Item label="分诊护士"  {...formItemLayout} className="labelR">
                                        {getFieldDecorator('deptTriageNurse', {
                                            valuePropName: 'checked',
                                            initialValue: deptPowerObj.deptTriageNurse === "Y" ? true : false
                                        })(
                                            <Switch checkedChildren="是" unCheckedChildren="否" />
                                        )}
                                    </Form.Item>
                                </Col>
                                <Col className="textL floatL">
                                    <span style={{ color: 'rgb(66, 185, 131)', cursor: 'pointer', textDecoration: 'underline', marginLeft: '15px' }} onClick={this.handleLibraryImport}>+管理其他专长</span>
                                </Col>
                            </Row>
                            <Row>
                                <Col className="textR" span={2}>
                                    <span >可查看病人:</span>
                                </Col>
                                <Col span={2}>
                                    <Form.Item label="住院病人"  {...formItemLayout} className="labelR" >
                                        {getFieldDecorator('deptInpatient', {
                                            valuePropName: 'checked',
                                            initialValue: deptPowerObj.deptInpatient === "Y" ? true : false,
                                        })(
                                            <Switch checkedChildren="是" unCheckedChildren="否" />
                                        )}
                                    </Form.Item>
                                </Col>
                                <Col span={2}>
                                    <Form.Item label="门诊病人"  {...formItemLayout} className="labelR">
                                        {getFieldDecorator('deptOutpatient', {
                                            valuePropName: 'checked',
                                            initialValue: deptPowerObj.deptOutpatient === "Y" ? true : false,
                                        })(
                                            <Switch checkedChildren="是" unCheckedChildren="否" />
                                        )}
                                    </Form.Item>
                                </Col>
                                <Col span={2}>
                                    <Form.Item label="急诊病人"  {...formItemLayout} className="labelR">
                                        {getFieldDecorator('deptEmergency', {
                                            valuePropName: 'checked',
                                            initialValue: deptPowerObj.deptEmergency === "Y" ? true : false,
                                        })(
                                            <Switch checkedChildren="是" unCheckedChildren="否" />
                                        )}
                                    </Form.Item>
                                </Col>
                                <Col span={3}>
                                    <Form.Item label="只看本人病人"  {...formItemLayout} className="labelR">
                                        {getFieldDecorator('deptOwnPatientsOnly', {
                                            valuePropName: 'checked',
                                            initialValue: deptPowerObj.deptOwnPatientsOnly === "Y" ? true : false,
                                        })(
                                            <Switch checkedChildren="是" unCheckedChildren="否" />
                                        )}
                                    </Form.Item>
                                </Col>
                            </Row>
                            <Row>
                                <Col className="textR" span={2}>
                                    <span >处方权等:</span>
                                </Col>
                                <Col span={2}>
                                    <Form.Item label="处方权"  {...formItemLayout} className="labelR" >
                                        {getFieldDecorator('deptPrescriberFlag', {
                                            valuePropName: 'checked',
                                            initialValue: deptPowerObj.deptPrescriberFlag === "Y" ? true : false,
                                        })(
                                            <Switch checkedChildren="是" unCheckedChildren="否" />
                                        )}
                                    </Form.Item>
                                </Col>
                                <Col span={2}>
                                    <Form.Item label="无医嘱权"  {...formItemLayout} className="labelR">
                                        {getFieldDecorator('deptNoOrders', {
                                            valuePropName: 'checked',
                                            initialValue: deptPowerObj.deptNoOrders === "Y" ? true : false,
                                        })(
                                            <Switch checkedChildren="是" unCheckedChildren="否" />
                                        )}
                                    </Form.Item>
                                </Col>
                                <Col span={2}>
                                    <Form.Item label="无病历权"  {...formItemLayout} className="labelR">
                                        {getFieldDecorator('deptNoEMR', {
                                            valuePropName: 'checked',
                                            initialValue: deptPowerObj.deptNoEMR === "Y" ? true : false,
                                        })(
                                            <Switch checkedChildren="是" unCheckedChildren="否" />
                                        )}
                                    </Form.Item>
                                </Col>
                                <Col span={3}>
                                    <Form.Item label="无诊断权"  {...formItemLayout} className="labelR">
                                        {getFieldDecorator('deptNoDiagnosis', {
                                            valuePropName: 'checked',
                                            initialValue: deptPowerObj.deptNoDiagnosis === "Y" ? true : false,
                                        })(
                                            <Switch checkedChildren="是" unCheckedChildren="否" />
                                        )}
                                    </Form.Item>
                                </Col>
                                <Col span={3}>
                                    <Form.Item label="毒麻药品处方权"  {...formItemLayout} className="labelR">
                                        {getFieldDecorator('deptAnaesthesia', {
                                            valuePropName: 'checked',
                                            initialValue: deptPowerObj.deptAnaesthesia === "Y" ? true : false,
                                        })(
                                            <Switch checkedChildren="是" unCheckedChildren="否" />
                                        )}
                                    </Form.Item>
                                </Col>
                                <Col span={3}>
                                    <Form.Item label="抗生素处方权"  {...formItemLayout} className="labelR">
                                        {getFieldDecorator('deptAntibiotic', {
                                            valuePropName: 'checked',
                                            initialValue: deptPowerObj.deptAntibiotic === "Y" ? true : false,
                                        })(
                                            <Switch checkedChildren="是" unCheckedChildren="否" />
                                        )}
                                    </Form.Item>
                                </Col>
                                <Col span={3}>
                                    <Form.Item label="不看检查结果"  {...formItemLayout} className="labelR">
                                        {getFieldDecorator('deptNotReadResults', {
                                            valuePropName: 'checked',
                                            initialValue: deptPowerObj.deptNotReadResults === "Y" ? true : false,
                                        })(
                                            <Switch checkedChildren="是" unCheckedChildren="否" />
                                        )}
                                    </Form.Item>
                                </Col>
                                <Col span={3}>
                                    <Form.Item label="草药处方权"  {...formItemLayout} className="labelR">
                                        {getFieldDecorator('herbalPresc', {
                                            valuePropName: 'checked',
                                            initialValue: deptPowerObj.herbalPresc === "Y" ? true : false,
                                        })(
                                            <Switch checkedChildren="是" unCheckedChildren="否" />
                                        )}
                                    </Form.Item>
                                </Col>
                            </Row>
                            <Row>
                                <Col className="textR" span={2}>
                                    <span>排班:</span>
                                </Col>
                                <Col span={2}>
                                    <Form.Item label="是否排班"  {...formItemLayout} className="labelR" >
                                        {getFieldDecorator('deptSchedule', {
                                            valuePropName: 'checked',
                                            initialValue: deptPowerObj.deptSchedule === "Y" ? true : false,
                                        })(
                                            <Switch checkedChildren="是" unCheckedChildren="否" />
                                        )}
                                    </Form.Item>
                                </Col>
                            </Row>
                            <Row>
                                <Col className="textR" span={2}>
                                    <span>科室医生简介:</span>
                                </Col>
                                <Col span={12} style={{ marginLeft: "15px" }}>
                                    <Form.Item {...formItemLayoutT} >
                                        {getFieldDecorator('deptDocIntroduce', {
                                            // valuePropName: 'deptDocIntroduce',
                                            initialValue: deptPowerObj.deptDocIntroduce ? deptPowerObj.deptDocIntroduce : undefined,
                                        })(
                                            <TextArea style={{ height: "90px" }}></TextArea>
                                        )}
                                    </Form.Item>
                                </Col>
                            </Row>
                            <Row>
                                <Col className=" textR floatL formRequi" style={{ marginRight: '14px' }} span={2}>
                                    <span style={{ lineHeight: '30px' }}>生效日期:</span>
                                </Col>
                                <Col span={3} style={{ marginRight: '20px' }}>
                                    <Form.Item className="dpW100"  >
                                        {getFieldDecorator('deptDocStartDate', {
                                            rules: [{ required: true, message: '请输入生效日期' }],
                                            initialValue: deptPowerObj.deptDocStartDate ? Moment(deptPowerObj.deptDocStartDate, 'YYYY-MM-DD') : Moment(Moment().format('L'), 'YYYY-MM-DD'),
                                        })(
                                            <DatePicker />
                                        )}
                                    </Form.Item>
                                </Col>

                                <Col className=" textR floatL" style={{ width: '80px', marginRight: '20px' }} >
                                    <span style={{ lineHeight: '30px' }}>失效日期:</span>
                                </Col>
                                <Col span={3} className="dpW100"  >
                                    <Form.Item>
                                        {getFieldDecorator('deptDocEndDate', {
                                            rules: [],
                                            initialValue: deptPowerObj.deptDocEndDate ? Moment(deptPowerObj.deptDocEndDate, 'YYYY-MM-DD') : null,
                                        })(
                                            <DatePicker />
                                        )}
                                    </Form.Item>
                                </Col>
                            </Row>
                            {/* <Row>
                                <Form.Item label="生效日期">
                                    {getFieldDecorator('deptDocStDate ', {
                                        initialValue: this.state.dataSource.deptDocStDate ? Moment(this.state.dataSource.deptDocStDate, 'YYYY-MM-DD') : Moment(Moment().format('L'), 'YYYY-MM-DD'),
                                        rules: [{ required: true, message: '请选择生效日期' }]
                                    })(
                                        <DatePicker style={{ marginLeft: '15px' }} />
                                    )}
                                </Form.Item>
                                <Form.Item label="失效日期">
                                    {getFieldDecorator('deptDocSpDate ', {
                                        initialValue: this.state.dataSource.deptDocSpDate ? Moment(this.state.dataSource.deptDocSpDate, 'YYYY-MM-DD') : undefined,
                                    })(
                                        <DatePicker style={{ marginLeft: '15px' }} />
                                    )}
                                </Form.Item>
                            </Row> */}
                        </Panel>
                    </Collapse>
                    <Row style={{ width: '100%', textAlign: 'center', marginTop: "30px" }}>
                        <Button onClick={this.handleSubmit} style={{ marginRight: '15px', background: 'rgba(66,185,131,1)', color: '#fff' }}>保存</Button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <Button onClick={this.handleCancel} style={{ marginRight: '15px', background: 'rgba(66,185,131,1)', color: '#fff' }}>返回</Button>
                    </Row>
                </Form>
                <OfficePanelModel
                    onRef={this.onRef}
                    locID={this.props.locID}
                    hideModal={() => this.setState({ visible: false })}
                    handthis={this}
                    callbackModal={this.callbackModal.bind(this)}
                    locData={this.state.locData}
                    medDis={this.state.medDis}
                    auto={true}
                />
            </div>
        )
    }
}


const PersListEditFrom = Form.create()(OfficePanel);

export default PersListEditFrom
