/*
 * Creator:     ML
 * CreatDate:   2020-03-06
 * descripts：  寄快递 快递信息编辑 弹窗
 * */
import React from 'react';
import { Form, Row, Col, Input, message, Select, Button, Modal, Table, Pagination,DatePicker,TimePicker } from 'antd';
import { $http } from 'containers/config/https';
import moment from 'moment';
const FormItem = Form.Item;
const marginRight = {
    marginRight:"38px"
}
const { TextArea } = Input;
const Option = Select.Option;
const SendExpress = Form.create()(
    class SendExpress extends React.Component {
        constructor(props) {
            super(props)
            var userData = JSON.parse(sessionStorage.getItem('userData'))
            this.state = {
                userData: userData,
                parms: {},//单行信息
                loading: false,//确定按钮 loading
                visible: false,//查找病人弹窗
                birthCity: [],//地市区信息
                birthAreas: [],//地县信息
                birthVillages: [],//地乡信息
                birthHamlets: [],//地村落信息
                params:{},
                rainData:[]
            }
        }
        componentDidMount() {
            this.props.onRef(this);
        }
        //获取省市地址 存取session
        getProviceOther=()=>{
            let data = {}
            data = {
                params: [{
                    provinceFlag:  1,	//省
                    cityFlag:  1,  //市
                    countryFlag: 1,	//国家
                }]
            }
            $http.post('urlS', this, {
                code: '03030005',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.setState({
                            countryArr:res.country
                        })
                        this.setState({
                            localProvince: res.province,
                            localCity: res.city
                        })
                    //     if (JSON.parse(localStorage.getItem('province')) && JSON.parse(localStorage.getItem('province')).length > 0) {
                    //         this.setState({
                    //             localProvince: JSON.parse(localStorage.getItem('province'))
                    //         })
                    //     } else {
                    //         localStorage.setItem('province', JSON.stringify(res.province))
                    //         this.setState({
                    //             localProvince: res.province
                    //         })
                    //     } if (JSON.parse(localStorage.getItem('city')) && JSON.parse(localStorage.getItem('city')).length > 0) {
                    //         this.setState({
                    //             localCity: JSON.parse(localStorage.getItem('city'))
                    //         })
                    //     } else {
                    //         // localStorage.setItem('city', JSON.stringify(res.city))
                    //         this.setState({
                    //             localCity: res.city
                    //         })
                    //     }
                    // } else {

                    // }
                }
            }
            })
        }
        //获取快递
        getExpressId=()=>{
            let data = {
                params: [{
                    userID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "",//用户Id
                    hospID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).hospID : "",//医院Id
                }],
            }
            $http.post('urlS', this, {
                code: '03030035',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                     this.setState({
                         expressArr:res.result
                     })
                    } 
                }
            })
            $http.post('urlS', this, {
                code: '03030034',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                     this.setState({
                         expressPayArr:res.result
                     })
                    } 
                }
            })
        }
        //选择或清除省
        onProvinceChange(flag, value, option) {
            if (value) {
                let city = []
                city = this.state.localCity.filter((item) => item.province == value);
                let params = this.state.params;
                let patFlag = this.firstToUp(flag);
                if (params["pat" + patFlag + "ProvinceID"]) {
                    params["pat" + patFlag + "ProvinceID"] = undefined;
                    params["pat" + patFlag + "CityID"] = undefined;
                    params["pat" + patFlag + "AreaID"] = undefined;
                    params["pat" + patFlag + "VillageID"] = undefined;
                    params["pat" + patFlag + "HamletID"] = undefined;
                }
                if (city && city.length == 0) {
                    this.setState({
                        [flag + "Door"]: false
                    })
                } else {
                    this.setState({
                        [flag + "Door"]: true
                    })
                }
                this.setState({
                    [flag + "City"]: city,
                    [flag + "Areas"]: [],
                    [flag + "Villages"]: [],
                    [flag + "Hamlets"]: [],
                    params: params,
                })
                this.props.form.setFieldsValue({
                    [flag + "CityID"]: undefined,
                    [flag + "AreaID"]: undefined,
                    [flag + "VillageID"]: undefined,
                    [flag + "HamletID"]: undefined,
                    [flag + "ZIP"]: undefined
                });
            } else {
                //清除省
                this.props.form.setFieldsValue({
                    [flag + "CityID"]: undefined,
                    [flag + "AreaID"]: undefined,
                    [flag + "VillageID"]: undefined,
                    [flag + "HamletID"]: undefined,
                    [flag + "ZIP"]: undefined
                });
                let params = this.state.params;
                let patFlag = this.firstToUp(flag);
                if (params["pat" + patFlag + "ProvinceID"]) {
                    params["pat" + patFlag + "ProvinceID"] = undefined;
                    params["pat" + patFlag + "CityID"] = undefined;
                    params["pat" + patFlag + "AreaID"] = undefined;
                    params["pat" + patFlag + "VillageID"] = undefined;
                    params["pat" + patFlag + "HamletID"] = undefined;
                }
                this.setState({
                    [flag + "City"]: [],
                    [flag + "Areas"]: [],
                    [flag + "Villages"]: [],
                    [flag + "Hamlets"]: [],
                    params: params,
                })
            }
        }
        //首字母大写
        firstToUp = (str) => {
            return str.substring(0, 1).toUpperCase() + str.substring(1);
            // 正则法
            // str = str.toLowerCase();
            // var reg = /\b(\w)|\s(\w)/g; //  \b判断边界\s判断空格
            // return str.replace(reg, function (m) {
            //     return m.toUpperCase()
            // });
        }
        onCityFocus = (provinceFlag, cityFlag) => {
            let city = this.state[cityFlag];
            let provinceID = this.props.form.getFieldValue(provinceFlag);
            if ((city.length === 0) && (provinceID)) {
                let newCity = []
                newCity = this.state.localCity.filter((item) => item.province == provinceID);
                this.setState({
                    [cityFlag]: newCity,
                })
            }

        }
        //选择或清除市
        onCityChange(flag, value, option) {
            if (value) {
                this.props.form.setFieldsValue({
                    [flag + "ProvinceID"]: option.props.provinceid,
                    [flag + "AreaID"]: undefined,
                    [flag + "VillageID"]: undefined,
                    [flag + "HamletID"]: undefined,
                    [flag + "ZIP"]: undefined
                });
                let params = this.state.params;
                let patFlag = this.firstToUp(flag);
                if (params["pat" + patFlag + "CityID"]) {
                    params["pat" + patFlag + "CityID"] = undefined;
                    params["pat" + patFlag + "AreaID"] = undefined;
                    params["pat" + patFlag + "VillageID"] = undefined;
                    params["pat" + patFlag + "HamletID"] = undefined;
                }
                this.setState({
                    params: params,
                })
                this.getAreas(value, flag, "1");
            } else {
                //清除市
                this.props.form.setFieldsValue({
                    [flag + "CityID"]: undefined,
                    [flag + "AreaID"]: undefined,
                    [flag + "VillageID"]: undefined,
                    [flag + "HamletID"]: undefined,
                    [flag + "ZIP"]: undefined
                });
                let params = this.state.params;
                let patFlag = this.firstToUp(flag);
                if (params["pat" + patFlag + "CityID"]) {
                    params["pat" + patFlag + "CityID"] = undefined;
                    params["pat" + patFlag + "AreaID"] = undefined;
                    params["pat" + patFlag + "VillageID"] = undefined;
                    params["pat" + patFlag + "HamletID"] = undefined;
                }
                this.setState({
                    [flag + "Areas"]: [],
                    [flag + "Villages"]: [],
                    [flag + "Hamlets"]: [],
                    params: params,
                })
            }
        }
        //选择市时加载县数据
        getAreas = (cityID, flag, cleanFlag) => {
            let data = {
                params: [{
                    cityId: cityID
                }],
            }
            $http.post('urlS', this, {
                code: '03030006',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        if (cleanFlag === "1") {
                            this.setState({
                                [flag + "Areas"]: res.result,
                                [flag + "Villages"]: [],
                                [flag + "Hamlets"]: [],
                            })
                        } else {
                            this.setState({
                                [flag + "Areas"]: res.result,
                            })
                        }
                    } else {
                        this.setState({
                            [flag + "Areas"]: [],
                            [flag + "Villages"]: [],
                            [flag + "Hamlets"]: [],
                        })
                    }
                }
            })

        }
        //选择或清除县
        onAreaChange(flag, value, option) {
            if (value) {
                this.props.form.setFieldsValue({
                    [flag + "VillageID"]: undefined,
                    [flag + "HamletID"]: undefined,
                    [flag + "ZIP"]: undefined
                });
                this.getVillages(value, flag, "1");
            } else {
                //清除市
                this.props.form.setFieldsValue({
                    [flag + "VillageID"]: undefined,
                    [flag + "HamletID"]: undefined,
                    [flag + "ZIP"]: undefined
                });
                let params = this.state.params;
                let patFlag = "";
                switch (flag) {
                    case "birth":
                        patFlag = "Birth";
                        break;
                    case "native":
                        patFlag = "Native";
                        break;
                    case "present":
                        patFlag = "Present";
                        break;
                    case "register":
                        patFlag = "Register";
                        break;
                    case "company":
                        patFlag = "Company";
                        break;
                    case "contact":
                        patFlag = "Contact";
                        break;
                }
                if (params["pat" + patFlag + "AreaID"]) {
                    params["pat" + patFlag + "AreaID"] = undefined;
                    params["pat" + patFlag + "VillageID"] = undefined;
                    params["pat" + patFlag + "HamletID"] = undefined;
                }
                this.setState({
                    [flag + "Villages"]: [],
                    [flag + "Hamlets"]: [],
                    params: params,
                })
            }
        }
        //县获取焦点
        onAreaFocus(cityFlag, areaFlag) {
            let area = this.state[areaFlag + "Areas"];
            let cityID = this.props.form.getFieldValue(cityFlag);
            if ((area.length === 0) && (cityID)) {
                this.getAreas(cityID, areaFlag, "0");
            }
        }
        //选择乡时加载村数据
        getHamlets = (villageID, flag) => {
            let data = {
                params: [{
                    villageId: villageID
                }],
            }
            $http.post('urlS', this, {
                code: '03030008',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.setState({
                            [flag + "hamlets"]: res.result,
                        })
                    } else {
                        this.setState({
                            [flag + "hamlets"]: [],
                        })
                    }
                }
            })
        }
        //选择或清除乡
        onVillageChange(flag, value, option) {
            if (value) {
                this.props.form.setFieldsValue({
                    [flag + "HamletID"]: undefined
                });
                this.getHamlets(value, flag);
            } else {
                //清除市
                this.props.form.setFieldsValue({
                    [flag + "HamletID"]: undefined,
                    [flag + "ZIP"]: undefined
                });
                let params = this.state.params;
                let patFlag = "";
                switch (flag) {
                    case "birth":
                        patFlag = "Birth";
                        break;
                    case "native":
                        patFlag = "Native";
                        break;
                    case "present":
                        patFlag = "Present";
                        break;
                    case "register":
                        patFlag = "Register";
                        break;
                    case "company":
                        patFlag = "Company";
                        break;
                    case "contact":
                        patFlag = "Contact";
                        break;
                }
                if (params["pat" + patFlag + "VillageID"]) {
                    params["pat" + patFlag + "VillageID"] = undefined;
                    params["pat" + patFlag + "HamletID"] = undefined;
                }
                this.setState({
                    [flag + "Hamlets"]: [],
                    params: params,
                })
            }
        }
        //乡获取焦点时调用
        onVillageFocus(areaFlag, villageFlag) {
            let village = this.state[villageFlag + "Villages"];
            let areaID = this.props.form.getFieldValue(areaFlag);
            if ((village.length === 0) && (areaID)) {
                this.getVillages(areaID, villageFlag, "0");
            }
        }
        //选择县时加载乡数据
        getVillages = (countyID, flag, cleanFlag) => {
            let data = {
                params: [{
                    areaId: countyID,
                }],
            }
            $http.post('urlS', this, {
                code: '03030007',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        if (cleanFlag === "1") {
                            this.setState({
                                [flag + "Villages"]: res.result,
                                [flag + "Hamlets"]: [],
                            })
                        } else {
                            this.setState({
                                [flag + "Villages"]: res.result,
                            })
                        }
                    } else {
                        this.setState({
                            [flag + "Villages"]: [],
                            [flag + "Hamlets"]: [],
                        })
                    }
                }
            })

        }
        onHamletFocus(villageFlag, hamletsFlag) {
            let hamlets = this.state[hamletsFlag + "Hamlets"];
            let villageID = this.props.form.getFieldValue(villageFlag);
            if ((hamlets.length === 0) && (villageID)) {
                this.getHamlets(villageID, hamletsFlag);
            }
        }
        handleOk = (e) => {
            this.props.form.validateFields((err, values) => {
                if (!err) {
                    let data = {
                        params: [{
                            admID:this.props.admID&&this.props.admID||"",
                            userID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "",//用户Id
                            hospID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).hospID : "",//医院Id
                            patientID:this.props.titleData&&this.props.titleData.patID,
                            expressID:values&&values.expressID||"",
                            expressPayID:values&&values.expressPayID||"",
                            receiveConpany:values&&values.receiveConpany||"",
                            receiveName:values&&values.receiveName||"",
                            receivePhone:values&&values.receivePhone||"",
                            receiveMobile:values&&values.receiveMobile||"",
                            receiveCountryID:values&&values.receiveCountryID||"",
                            receiveProvinceID:values&&values.birthProvinceID||"",
                            receiveCityID:values&&values.birthCityID||"",
                            receiveAreaID:values&&values.birthAreaID||"",
                            receiveVillageID:values&&values.birthVillageID||"",
                            receiveHamletID:values&&values.birthHamletID||"",
                            receiveAdress:values&&values.receiveAdress||"",
                            parcelQuantity:values&&values.parcelQuantity||"",
                            sendStartDate:values.sendStartDate ? moment(values.sendStartDate).format('YYYY-MM-DD') : undefined,
                            sendStartTime: values.sendStartTime ? moment(values.sendStartTime).format('HH:mm') : undefined,
                            expressType:values&&values.expressType||"",
                            tempRange:values&&values.tempRange||"",
                            presc:this.props.newPresc&&this.props.newPresc||undefined,
                            cmpresc:this.props.newCmpresc&&this.props.newCmpresc||undefined,
                            specNos:this.props.newSpecNosc&&this.props.newSpecNosc||undefined,
                            checkNos:this.props.newCheckNos&&this.props.newCheckNos||undefined,
                        }],
                    }
                    $http.post('urlS', this, {
                        code: '03030033',
                        data: data,
                        success: function (res) {
                            if (+res.errorCode === 0) {
                                this.props.handleTableInfo()
                                message.success(this.props.localeProvider && this.props.localeProvider.PatientRecordInformationSavedSuccessfully ? this.setMessage('PatientRecordInformationSavedSuccessfully', 'descripts') : '保存成功')
                                this.setState({ visible: false, })
                            } 
                        }
                    })
                }
            })
            
        }
        showModal = (v) => {
            this.props.form.resetFields();
            this.setState({
                visible: true,
                birthDoor:true,
                v,
                birthCity: [],
                birthAreas: [],
                birthVillages: [],
                birthHamlets: [],
            });
            this.getRain()
            this.getProviceOther()
            this.getExpressId()
            this.getAreas(this.props.titleData.patCityID, "birth", "0");
            // console.log("this.props.newPresc",this.props.newPresc)
        }
         //获取温控条件下拉框
         getRain=()=>{
            let data = {
                params: [{}],
            }
            $http.post('urlS', this, {
                code: '03010112',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                       this.setState({
                           rainData:res.result
                       })
                    } else {
                       
                    }
                }
            })
        }
        handleCancel = () => {
            this.setState({
                visible: false,
            });
        }
        //国际化
        setMessage(name, message) {
            return this.props.localeProvider ? this.props.localeProvider[name][message] : ''
        } 
        //选择日期
        onPanelChange = (mode) => {
            this.setState({
                sendData: moment(mode).format('YYYY-MM-DD'),
            })
        }
        // 截取开始到结束的数据
    range=(start, end)=> {
        const result = [];
        for (let i = start; i < end; i++) {
            result.push(i);
        }
        return result;
    }
        render() {
            const { getFieldDecorator } = this.props.form;
            const { localProvince,countryArr, localCity, birthCity, birthAreas, birthVillages, birthHamlets,  params } = this.state
            let firstCityItem = [] //省,市Option
            let birthCityItem = []
            let birthAreasItem = []//县Option
            let birthVillagesItem = []//乡
            let birthHamletsItem = []//村
            let provinceItem = [];
            localProvince && localProvince.map(item => {
                provinceItem.push(<Option key={item.id} className={'1' + item.province} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)} title={item.descripts}>{item.descripts}</Option>)
            });

            // let firstCityItem = []
            //第一次加载的城市;
            localCity && localCity.map(item => {
                firstCityItem.push(<Option provinceid={item.province} key={item.id} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)} className={'2' + item.province} title={item.descripts}>{item.descripts}</Option>)
            });
            //卡信息城市
            if ((!birthCity && this.state.birthDoor) || (birthCity && birthCity.length === 0 && this.state.birthDoor)) {
                //卡信息城市下拉数据为空时加载所有城市
                birthCityItem = firstCityItem;
            } else {
                birthCity && birthCity.map(item => {
                    birthCityItem.push(<Option provinceid={item.province} key={item.id} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)} className={'2' + item.province} title={item.descripts}>{item.descripts}</Option>)
                });
            }
            birthAreas && birthAreas.map(item => {
                birthAreasItem.push(<Option key={item.id} role={item.descripts + '^' + item.descriptsSPCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
            });
            
            
            if ((birthAreas) && (birthAreas.length === 0) && (params && params.areaId)) {
                birthAreasItem.push(<Option key={params.areaId} role={params.areaDesc} title={params.areaDesc} value={String(params.areaId)}>{params.areaDesc}</Option>)
            }
            birthVillages && birthVillages.map(item => {
                birthVillagesItem.push(<Option key={item.id} role={item.descripts + '^' + item.descriptsSPCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
            });
            if ((birthVillages) && (birthVillages.length === 0) && (params && params.villageId)) {
                birthVillagesItem.push(<Option key={params.villageId} role={params.villageDesc} title={params.villageDesc} value={String(params.villageId)}>{params.villageDesc}</Option>)
            }
            birthHamlets && birthHamlets.map(item => {
                birthHamletsItem.push(<Option key={item.id} role={item.descripts + '^' + item.descriptsSPCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
            });
            if ((birthHamlets) && (birthHamlets.length === 0) && (params && params.hamletId)) {
                birthHamletsItem.push(<Option key={params.hamletId} role={params.hamletDesc} title={params.hamletDesc} value={String(params.hamletId)}>{params.hamletDesc}</Option>)
            }
            let country = []
            countryArr && countryArr.map(item => {
                country.push(<Option key={item.id} title={item.descripts} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)}>{item.descripts}</Option>)
            })
            //快递服务
            let expressOp = []
            this.state.expressArr && this.state.expressArr.map(item => {
                expressOp.push(<Option key={item.id} title={item.descripts} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)}>{item.descripts}</Option>)
            })
            //快递支付方式
            let expressPayOp = []
            this.state.expressPayArr && this.state.expressPayArr.map(item => {
                expressPayOp.push(<Option key={item.id} title={item.descripts} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)}>{item.descripts}</Option>)
            })
              //获取温控条件
              let rainOp = []
              this.state.rainData && this.state.rainData.map(item => {
                 rainOp.push(<Option key={item.id} title={item.descripts} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)}>{item.descripts}</Option>)
              })
            return (
                <div
                >
                    <Modal
                        className='findPatients'
                        width='1000px'
                        visible={this.state.visible}
                        title={this.props.localeProvider && this.props.localeProvider.PatientRecordInformationReceiptInformationOk ? this.setMessage('PatientRecordInformationReceiptInformationOk', 'descripts') : '确认收件信息'}
                        onOk={this.handleOk}
                        onCancel={this.handleCancel}
                        footer={[
                            <Button key="submit" type="primary" loading={this.setState.loading} disabled={this.state.rowId == ""} onClick={this.handleOk}>{this.props.localeProvider && this.props.localeProvider.PatientRecordInformationOk ? this.setMessage('PatientRecordInformationOk', 'descripts') : '确定'}</Button>,
                            <Button key="cancel" type="primary" loading={this.setState.loading} onClick={this.handleCancel}>{this.props.localeProvider && this.props.localeProvider.PatientRecordInformationCancel ? this.setMessage('PatientRecordInformationCancel', 'descripts') : '取消'}</Button>,
                        ]}>
                        <div>
                            <Form>
                                <Row>
                                    <Col span={3} style={marginRight}>
                                        <FormItem label={this.props.localeProvider && this.props.localeProvider.PatientRecordInformationTheRecipientName ? this.setMessage('PatientRecordInformationTheRecipientName', 'descripts') : '收件人姓名'}>
                                            {getFieldDecorator('receiveName', {
                                                initialValue: this.props.titleData&&this.props.titleData.patName?this.props.titleData.patName:undefined,
                                                rules: [{ required: true, message: this.props.localeProvider && this.props.localeProvider.PatientRecordInformationTheRecipientName ? this.setMessage('PatientRecordInformationTheRecipientName', 'message') : '请填写收件人姓名' }]
                                            })(
                                                <Input
                                                />
                                            )}
                                        </FormItem>
                                    </Col >
                                    <Col span={3} style={marginRight}>
                                        <FormItem label={this.props.localeProvider && this.props.localeProvider.PatientRecordInformationMobilePhoneNumber ? this.setMessage('PatientRecordInformationMobilePhoneNumber', 'descripts') : '手机号码'}>
                                            {getFieldDecorator('receiveMobile', {
                                                initialValue: this.props.titleData&&this.props.titleData.patMobile?this.props.titleData.patMobile:undefined,
                                                rules: [{ required: false, message: '' }]
                                            })(
                                                <Input />
                                            )}
                                        </FormItem>
                                    </Col >
                                    <Col span={3} style={marginRight}>
                                        <FormItem label={this.props.localeProvider && this.props.localeProvider.PatientRecordInformationFixedTelephone ? this.setMessage('PatientRecordInformationFixedTelephone', 'descripts') : '固定电话'}>
                                            {getFieldDecorator('receivePhone', {
                                                initialValue: this.props.titleData&&this.props.titleData.patTelphone?this.props.titleData.patTelphone:undefined,
                                                rules: [{ required: false, message: '' }]
                                            })(
                                                <Input
                                                    allowClear
                                                />
                                            )}
                                        </FormItem>
                                    </Col >
                                    <Col span={3} style={marginRight}>
                                        <FormItem label={this.props.localeProvider && this.props.localeProvider.PatientRecordInformationRecipientCompanyName ? this.setMessage('PatientRecordInformationRecipientCompanyName', 'descripts') : '收件方公司名称'}>
                                            {getFieldDecorator('receiveConpany', {
                                                initialValue: undefined,
                                                // rules: [{ required: true, message: '请填写收件方公司' }]
                                            })(
                                                <Input
                                                    allowClear
                                                />
                                            )}
                                        </FormItem>
                                    </Col >
                                    <Col span={3} style={marginRight}>
                                        <FormItem label={this.props.localeProvider && this.props.localeProvider.PatientRecordInformationRecipientCountry ? this.setMessage('PatientRecordInformationRecipientCountry', 'descripts') : '收件人国家'}>
                                            {getFieldDecorator('receiveCountryID', {
                                                initialValue: this.props.titleData&&this.props.titleData.patCountryID?this.props.titleData.patCountryID:undefined,
                                                rules: [{ required: true, message: this.props.localeProvider && this.props.localeProvider.PatientRecordInformationRecipientCountry ? this.setMessage('PatientRecordInformationRecipientCountry', 'message') : '请填写收件方国家' }]
                                            })(
                                               <Select showSearch allowClear optionFilterProp="role">
                                                   {country}
                                               </Select>
                                            )}
                                        </FormItem>
                                    </Col >
                                <Col span={3} style={marginRight}>
                                <FormItem  label={ this.props.localeProvider && this.props.localeProvider.PatientRecordInformationProvince ? this.setMessage('PatientRecordInformationProvince', 'descripts') : '省'}>
                                    {getFieldDecorator('birthProvinceID',
                                        {
                                            initialValue: this.props.titleData&&this.props.titleData.patProvinceID ?String(this.props.titleData.patProvinceID) :undefined,
                                            rules: [{ required: true, message: this.props.localeProvider && this.props.localeProvider.PatientRecordInformationProvince ? this.setMessage('PatientRecordInformationProvince', 'message') : '请选择省' }],
                                        })(
                                            <Select
                                                ref={this.bornProvince}
                                                allowClear={true}
                                                showSearch={true}
                                                placeholder={this.props.localeProvider && this.props.localeProvider.PatientRecordInformationProvince ? this.setMessage('PatientRecordInformationProvince', 'descripts') : '省'}
                                                optionFilterProp="role"
                                                onChange={this.onProvinceChange.bind(this, "birth")}
                                            >
                                                {
                                                    localProvince && localProvince.map(item => {
                                                        return (<Option key={item.id + "birth"} className={'1' + item.province} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)} title={item.descripts}>{item.descripts}</Option>)
                                                    })
                                                }
                                            </Select>
                                        )}
                                </FormItem>
                            </Col>
                            <Col span={3} style={marginRight} >
                                <FormItem  label={ this.props.localeProvider && this.props.localeProvider.PatientRecordInformationCity ? this.setMessage('PatientRecordInformationCity', 'descripts') : '市'}>
                                    {getFieldDecorator('birthCityID',
                                        {
                                            initialValue:this.props.titleData&&this.props.titleData.patCityID?String(this.props.titleData.patCityID):undefined,
                                            rules: [{ required: true, message:this.props.localeProvider && this.props.localeProvider.PatientRecordInformationCity ? this.setMessage('PatientRecordInformationCity', 'message') : '请选择市' }],
                                        })(
                                            <Select
                                                ref={this.birthCity}
                                                allowClear={true}
                                                showSearch={true}
                                                placeholder={this.props.localeProvider && this.props.localeProvider.PatientRecordInformationCity ? this.setMessage('PatientRecordInformationCity', 'descripts') : '市'}
                                                optionFilterProp="role"
                                                onFocus={this.onCityFocus.bind(this, "birthProvinceID", "birthCity")}
                                                onChange={this.onCityChange.bind(this, "birth")}
                                            >
                                                {birthCityItem}
                                            </Select>
                                        )}
                                </FormItem>
                            </Col>
                            <Col span={3} style={marginRight}>
                                <FormItem   label={ this.props.localeProvider && this.props.localeProvider.PatientRecordInformationCounty ? this.setMessage('PatientRecordInformationCounty', 'descripts') : '县'}>
                                    {getFieldDecorator('birthAreaID',
                                        {
                                            initialValue: this.props.titleData&&this.props.titleData.patAreaID?String(this.props.titleData.patAreaID):undefined,
                                            rules: [{ required: true, message: this.props.localeProvider && this.props.localeProvider.PatientRecordInformationCounty ? this.setMessage('PatientRecordInformationCounty', 'message') : '请选择县' }],
                                        })(
                                            <Select
                                                ref={this.bornCountry}
                                                allowClear={true}
                                                showSearch={true}
                                                placeholder={this.props.localeProvider && this.props.localeProvider.PatientRecordInformationCounty ? this.setMessage('PatientRecordInformationCounty', 'descripts') : '县'}
                                                optionFilterProp="role"
                                                onChange={this.onAreaChange.bind(this, "birth")}
                                                onFocus={this.onAreaFocus.bind(this, "birthCityID", "birth")}
                                            >
                                                {birthAreasItem}
                                            </Select>
                                        )}
                                </FormItem>
                            </Col>
                            <Col span={3} style={marginRight}>
                                <FormItem  label={this.props.localeProvider && this.props.localeProvider.PatientRecordInformationTownship ? this.setMessage('PatientRecordInformationTownship', 'descripts') :  '乡'} >
                                    {getFieldDecorator('birthVillageID',
                                        {
                                            initialValue: this.props.titleData&&this.props.titleData.patVillageID?String(this.props.titleData.patVillageID):undefined,
                                        })(
                                            <Select
                                                ref={this.bornVillage}
                                                allowClear={true}s
                                                showSearch={true}
                                                placeholder={this.props.localeProvider && this.props.localeProvider.PatientRecordInformationTownship ? this.setMessage('PatientRecordInformationTownship', 'descripts') : '乡'}
                                                optionFilterProp="role"
                                                onChange={this.onVillageChange.bind(this, "birth")}
                                                onFocus={this.onVillageFocus.bind(this, "birthAreaID", "birth")}
                                            >
                                                {birthVillagesItem}
                                            </Select>
                                        )}
                                </FormItem>
                            </Col>
                            {/* <Col span={6} >
                                <FormItem  label='村'>
                                    {getFieldDecorator('birthHamletID',
                                        {
                                            initialValue: params && params.hamletId ? params.hamletId : undefined,
                                            rules: [{ required: false, message: '请选择村' }],
                                        })(
                                            <Select
                                                ref={this.bornHamlet}
                                                allowClear={true}
                                                showSearch={true}
                                                placeholder='村'
                                                optionFilterProp="role"
                                                onFocus={this.onHamletFocus.bind(this, "birthVillageID", "birth")}
                                            >
                                            </Select>
                                        )}
                                </FormItem>
                            </Col> */}
                             <Col span={3} style={marginRight}>
                                        <FormItem label={this.props.localeProvider && this.props.localeProvider.PatientRecordInformationChooseExpress ? this.setMessage('PatientRecordInformationChooseExpress', 'descripts') : '选择快递'}>
                                            {getFieldDecorator('expressID', {
                                                initialValue: "1",
                                                rules: [{ required: false, message: '' }]
                                            })(
                                                <Select
                                                    allowClear

                                                >
                                                    {expressOp}
                                                </Select>
                                            )}
                                        </FormItem>
                                    </Col >
                                    <Col span={3} style={marginRight}>
                                        <FormItem label={this.props.localeProvider && this.props.localeProvider.PatientRecordInformationPaymentMethod ? this.setMessage('PatientRecordInformationPaymentMethod', 'descripts') : '付款方式'}>
                                            {getFieldDecorator('expressPayID', {
                                                initialValue: "2",
                                                rules: [{ required: false, message: '' }]
                                            })(
                                                <Select
                                                    allowClear
                                                >
                                                    {expressPayOp}
                                                </Select>
                                            )}
                                        </FormItem>
                                    </Col >   
                                    <Col span={3} style={marginRight}>
                                        <FormItem label={this.props.localeProvider && this.props.localeProvider.PatientRecordInformationNumberOfPackages ? this.setMessage('PatientRecordInformationNumberOfPackages', 'descripts') : '包裹数量'}>
                                            {getFieldDecorator('parcelQuantity', {
                                                initialValue: "1",
                                                rules: [{ required: true, message: this.props.localeProvider && this.props.localeProvider.PatientRecordInformationNumberOfPackages ? this.setMessage('PatientRecordInformationNumberOfPackages', 'message') : '请填写包裹数量' }]
                                            })(
                                                <Input
                                                    allowClear
                                                    type="number"
                                                    min={1}
                                                />
                                            )}
                                        </FormItem>
                                    </Col >
                                    <Col span={3} style={marginRight}>
                                        <FormItem label={this.props.localeProvider && this.props.localeProvider.PatientRecordInformationPickUpDate ? this.setMessage('PatientRecordInformationPickUpDate', 'descripts') : '上门取件日期'}>
                                            {getFieldDecorator('sendStartDate', {
                                                initialValue: undefined,
                                                rules: [{ required: false, message: '' }]
                                            })(
                                                <DatePicker style={{ width: '100%' } } onChange={this.onPanelChange} disabledDate={(curDate) => {
                                                    // return curDate && curDate < moment().endOf('day');
                                                }} />
                                            )}
                                        </FormItem>
                                    </Col >
                                    <Col span={3} style={marginRight}>
                                        <FormItem label={this.props.localeProvider && this.props.localeProvider.PatientRecordInformationPickUpTime ? this.setMessage('PatientRecordInformationPickUpTime', 'descripts') : '上门取件时间'}>
                                            {getFieldDecorator('sendStartTime', {
                                                initialValue: undefined,
                                                rules: [{ required: false, message: '' }]
                                            })(
                                                <TimePicker
                                                style={{ width: '100%' }}
                                                separator=":"
                                                showToday
                                                format={'HH:mm'}
                                                disabledHours={()=>{
                                                    let hours = moment().hours();//0~23
                                                    if(this.state.sendData=== moment().format('YYYY-MM-DD')){
                                                        return this.range(hours+1, 24);
                                                    }
                                                }}
                                                disabledMinutes={
                                                    ()=>{
                                                        let minutes = moment().minutes();//0~23
                                                        if(this.state.sendData=== moment().format('YYYY-MM-DD')){
                                                            return this.range(minutes-1, 60);
                                                        }
                                                    }
                                                }
                                                />
                                            )}
                                        </FormItem>
                                    </Col >
                                    <Col span={3} style={marginRight}>
                                        <FormItem label={this.props.localeProvider && this.props.localeProvider.PatientRecordInformationProductCategory ? this.setMessage('PatientRecordInformationProductCategory', 'descripts') : '产品类别'}>
                                            {getFieldDecorator('expressType', {
                                                initialValue: undefined,
                                                rules: [{ required: false, message: '' }]
                                            })(
                                                <Input
                                                    allowClear
                                                />
                                            )}
                                        </FormItem>
                                    </Col >
                                    <Col span={3} style={marginRight}>
                                        <FormItem label={this.props.localeProvider && this.props.localeProvider.PatientRecordInformationTemperatureControlConditions ? this.setMessage('PatientRecordInformationTemperatureControlConditions', 'descripts') : '温控条件'}>
                                            {getFieldDecorator('tempRange', {
                                                initialValue: undefined,
                                                rules: [{ required: false, message: '' }]
                                            })(
                                            <Select showSearch allowClear optionFilterProp="role">
                                                {rainOp}
                                            </Select>
                                            )}
                                        </FormItem>
                                    </Col >
                                </Row>
                                <Row gutter={60} style={{margin:"0"}}>
                                   <Col span={24} style={{paddingLeft:"0",paddingRight:"46px"}}>
                                   <FormItem  label={this.props.localeProvider && this.props.localeProvider.PatientRecordInformationAddress ? this.setMessage('PatientRecordInformationAddress', 'descripts') : '详细地址'}>
                                    {getFieldDecorator('receiveAdress',
                                        {
                                            initialValue: this.props.titleData&&this.props.titleData.patAddress?this.props.titleData.patAddress:undefined,
                                            rules: [{ required: true, message: this.props.localeProvider && this.props.localeProvider.PatientRecordInformationAddress ? this.setMessage('PatientRecordInformationAddress', 'message') : '请输入详细地址' }],
                                        })(
                                           <TextArea></TextArea>
                                        )}
                                </FormItem>
                                   </Col>
                                </Row>
                            </Form>
                        </div>
                    </Modal>
                </div>
            )
        }
    })
export default SendExpress 