//供应商维护单
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';
import './style/index.less';

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 VendorMaintain = Form.create()(
    class extends React.Component {
        constructor() {
            super();
            this.state = {
                userInfo: {}, //表单数据详情
                VendorListData: [], //供应商列表数据
                pageSize: 20,
                page: 1,
                total:0,
                rowKey: '', //行选中id
                rowData: {}, //当前行数据
                language: JSON.parse(window.sessionStorage.userData),
                ChineseEnglishSize: [],
                detailWidthTotal:'',
                columns:[],
            }
            // 供应商的数据表头
            this.columns = [

                {
                    key: 1,
                    title: '代码',
                    dataIndex: 'tkCode',
                    align: "center",
                    width: '20%'
                },
                {
                    key: 2,
                    title: '描述',
                    dataIndex: 'tkDesc',
                    align: "center",
                    width: '40%'
                },
                {
                    key: 3,
                    title: '状态',
                    dataIndex: 'tkSeqNo',
                    align: "center",
                    width: '20%'
                }

            ]
        }

        componentDidMount() {
            // 初始化数据
            this.getVendorList();
            this.getDetailTableColumns();
        }

        componentWillUnmount() {
            // 组件销毁前将静止让setState修改state的状态，防止内存泄漏
            this.setState = (state,callback)=>{ return; }
        }

        //清空表格内容
        resetFields = () => {
            this.props.form.resetFields();
            this.setState({userInfo: {}, rowKey: '', rowData: ''});
        };
        handleReset=()=> {
            this.resetFields();
            this.setState({VendorListData: [],total: 0});
        }
        //导入数据
        importData=()=>{

        }
        searchInformation=()=>{
            this.setState({page: 1},()=>{
                this.getVendorList()
            })
        };
        // 获取供应商列表数据
        getVendorList=()=>{
            let {language} = this.state;
            let code = this.props.form.getFieldValue('vdCode');
            let desc = this.props.form.getFieldValue('vdDesc');
            // let state = this.props.form.getFieldValue('state');
            this.setState({loading: true})
            let data = {
                params: [
                    {
                        code : code ? code :undefined,
                        desc : desc ? desc :undefined,
                    }
                ],
                pagination: [
                    {
                        pageSize:this.state.pageSize,
                        currentPage:this.state.page,
                        sort:"ID",
                        dir:"asc",
                    }
                ],
            };
            $http.post('urlS', this, {
                code: "02010014",
                data: data,
                success: function (res) {
                    if(res.errorCode==0 && res.rows.length > 0){
                        for(let i = 0; i < res.rows.length; i++){
                            res.rows[i].key = i;
                        }
                        this.setState({ VendorListData: res.rows, total: res.total, loading: false});
                    }else {
                        this.setState({ VendorListData: [],total:0,loading: false});
                        if (language.language =='EN'){
                            message.error("No related data was found");
                        }else{
                            message.error("没数据");
                        }
                        // this.props.form.resetFields();
                    }
                }
            });
        };

        //保存
        saveData=()=>{
            this.props.form.validateFields((error, value)=> {
                let obj = JSON.parse(JSON.stringify(value));
                if(error == null){
                    let data = {
                        params: [
                            {
                                id: this.state.userInfo.id,	//生产商ID
                                seqNo: obj.seqNo ? obj.seqNo : '',	//序号
                                code: obj.code,	//代码
                                descripts: obj.descripts,	//描述
                                ENDescripts: obj.ENDescripts,
                                establishedDate: obj.establishedDate ? Moment(obj.establishedDate).format('YYYY-MM-DD') : '',	//供应商成立日期
                                address: obj.address ? obj.address : '',	//供应商地址
                                telephone: obj.telephone ? obj.telephone : '',	//供应商电话
                                fax: obj.fax ? obj.fax : '',	//供应商传真
                                email: obj.email ? obj.email : '',	//供应商邮箱
                                president: obj.president ? obj.presiden : '',	//供应商法人代表
                                regCapital: obj.regCapital ? obj.regCapital : '',//供应商注册资金
                                depositBank: obj.depositBank ? obj.depositBank : '',	//供应商开户银行
                                bankAccount: obj.bankAccount ? obj.bankAccount : '',	//供应商银行账号
                                comLic: obj.comLic ? obj.comLic : '',	//工商执照
                                comLicDate: obj.comLicDate ? Moment(obj.comLicDate).format('YYYY-MM-DD') : '',	//工商执照有效期
                                revReg: obj.revReg ? obj.revReg : '',	//税务登记
                                revRegDate: obj.revRegDate ? Moment(obj.revRegDate).format('YYYY-MM-DD') : '',	//税务登记有效期
                                drugManLic: obj.drugManLic ? obj.drugManLic : '',	//药品经营许可证
                                drugManLicDate: obj.drugManLicDate ? Moment(obj.drugManLicDate).format('YYYY-MM-DD') : '',	// 药品经营许可证有效期
                                sanitation: obj.sanitation ? obj.sanitation : '',	//卫生许可证
                                sanitationDate: obj.sanitationDate ? Moment(obj.sanitationDate).format('YYYY-MM-DD') : '',	//卫生许可证有效期
                                orgCode: obj.orgCode ? obj.orgCode : '',	//组织机构代码
                                orgCodeDate: obj.orgCodeDate ? Moment(obj.orgCodeDate).format('YYYY-MM-DD')  : '',	//组织机构代码有效期
                                gsp: obj.gsp ? obj.gsp : '',	//Gsp认证
                                gspDate: obj.gspDate ? Moment(obj.gspDate).format('YYYY-MM-DD') : '',	//社会信用码
                                socialCreditCode: obj.socialCreditCode ? obj.socialCreditCode : '',	//社会信用码
                                socialCreditExpDate: obj.socialCreditExpDate ? Moment(obj.socialCreditExpDate).format('YYYY-MM-DD')  : '',	//三证合一效期
                                grading: obj.grading ? obj.grading : '',	// 等级 G-Good,B-Bad,A-Average
                                crLimit: obj.crLimit ?obj.crLimit : '',	//信贷限额采购额
                                contractNo: obj.contractNo ? obj.contractNo : '',	//合同编号
                                venType: obj.venType ? obj.venType : '',	// 类型
                                startDate:  Moment(obj.startDate).format('YYYY-MM-DD'),	//生效日期
                                endDate: obj.endDate ? Moment(obj.endDate).format('YYYY-MM-DD') : '',	//失效日期
                            }
                        ]
                    };
                    $http.post('urlS', this, {
                        code: "02010013",
                        data: data,
                        success: function (res) {
                            if(res.errorCode == 0) {
                                message.success(res.errorMessage);
                                this.getVendorList();

                            }
                        }
                    });
                }
            })
        }
        // 设置行属性
        onClickRow = (record) => {
            return {
                // 单击行选中
                onClick: (e) => {
                    e.stopPropagation();
                    this.resetFields();
                    if (this.state.rowKey === '') {
                        // 保存行数据以及ID
                        this.setState({rowKey: record.id,userInfo:record});
                    } else {
                        if (this.state.rowKey !== record.id) {
                            this.setState({rowKey: record.id,userInfo:record});
                        } else {
                            this.setState({rowKey: '', userInfo: {}});
                            this.resetFields();
                        }
                    }
                }
            }
        };

        // 表格行的类名
        setRowClassName = (record) => {
            return record.id === this.state.rowKey ? 'clickRowStyle' : '';
        };
        // 页码改变的回调，参数是改变后的页码及每页条数
        onChange = (page, pageSize) => {
            this.setState({page: page, pageSize: this.state.pageSize}, () => {
                // 重新调用查询方法
                this.getVendorList();
            });
        };

        onShowSizeChange = (current, size) => {
            this.setState({page: current, pageSize: size}, () => {
                // 重新调用查询方法
                this.onChange(current,size);
            })
        };

        //页面中英文翻译
        getDetailTableColumns = () => {
            let {language} = this.state;
            let data = {
                params: [{
                    reactCode: ['VendorMaintain'],
                    compontName: 'VendorMaintain',
                    type: 'C',
                }]
            }
            $http.post('urlS', this, {
                code: '01040073',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        let arr = res.result.C&&res.result.C.length > 0 ? JSON.parse(JSON.stringify(res.result.C)).map((item, index) => {
                            return  {
                                ...item,
                                key: index + 1,
                                title: <div>{language.language== 'EN' ? item.enDescripts : item.title}</div>
                            }
                        }) : '';
                        let filterArr = arr.filter(function(item){ return item.display === 'Y'});
                        this.setState({columns: filterArr, detailWidthTotal: res.totalWidth,ChineseEnglishSize:language.language=='EN' ? res.result.language.EN : res.result.language.CN})
                    }
                }
            })
        };
        //获取最大代码
        saveMaxInventory=()=>{
            let data = {
                params: [{}]
            };
            $http.post('urlS', this, {
                code: "02020336",
                data: data,
                success: function (res) {
                    if(res.errorCode==0){
                        this.props.form.setFieldsValue({ code: res.result.maxCode });
                        message.success(res.errorMessage)
                    }else {
                        message.error(res.errorMessage);
                    }
                }
            });
        }
        render() {
            const { getFieldDecorator } = this.props.form;
            const {userInfo,ChineseEnglishSize,columns} = this.state;
            return (
                <div className="VendorMaintain">
                    <Col span={12}>
                        <Row>
                            <Card
                                size="small"
                                title={<div className="card-title-left-icon"><div></div>{ChineseEnglishSize.VendorMaintainlist ? ChineseEnglishSize.VendorMaintainlist.descripts:'供应商列表'}</div>}
                            >
                                <Col span={24}>
                                    <Row >
                                        <Col span={8}>
                                            <FormItem {...formItemLayout} label={ChineseEnglishSize.VendorMaintainvdCode ? ChineseEnglishSize.VendorMaintainvdCode.descripts:'代码'}>
                                                {getFieldDecorator('vdCode',{
                                                    initialValue: undefined,
                                                })(
                                                    <Input />
                                                ) }
                                            </FormItem>
                                        </Col>
                                        <Col span={8}>
                                            <FormItem {...formItemLayout} label={ChineseEnglishSize.VendorMaintainvdDesc ? ChineseEnglishSize.VendorMaintainvdDesc.descripts:'描述'}>
                                                {getFieldDecorator('vdDesc',{
                                                    initialValue: undefined,
                                                })(
                                                    <Input />
                                                ) }
                                            </FormItem>
                                        </Col>
                                        <Col style={{textAlign: 'center'}} span={8}>
                                            <Button onClick={this.searchInformation}>{ChineseEnglishSize.VendorMaintainsearch ? ChineseEnglishSize.VendorMaintainsearch.descripts:'查询'}</Button>
                                            <Button type="primary" onClick={this.handleReset} style={{marginLeft: '20px'}}>{ChineseEnglishSize.VendorMaintainclean ? ChineseEnglishSize.VendorMaintainclean.descripts:'清屏'}</Button>
                                        </Col>
                                    </Row>
                                </Col>
                            </Card>
                        </Row>
                        <Row>
                            <Col>
                                <Card
                                    size="small"
                                >
                                    <div  style={{height: store.getState().tableHeight.y +94 + 'px'}}>
                                        <Table
                                            columns={columns.length>0?columns:this.columns}
                                            dataSource={this.state.VendorListData}
                                            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.VendorListData}
                                                          loading={this.state.loading} onChange={this.onChange.bind(this)} pageSize={true} />
                                    </div>
                                </Card>
                            </Col>
                        </Row>
                    </Col>
                    <Col span={12}>
                        <Col>
                            <Form>
                                <Card
                                    title={<div className="card-title-left-icon"><div></div>{ChineseEnglishSize.VendorMaintaininfo ? ChineseEnglishSize.VendorMaintaininfo.descripts:'供应商信息'}</div>}
                                    size="small"
                                >
                                    <div  style={{height: store.getState().tableHeight.y +129 + 'px',overflow: 'auto'}} >
                                        <Col >
                                            <Row>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintainseqNo ? ChineseEnglishSize.VendorMaintainseqNo.descripts:'供应商序号：'} {...formItemItem}>
                                                        {getFieldDecorator('seqNo', {
                                                            initialValue: userInfo.seqNo ? userInfo.seqNo : undefined,
                                                        })(
                                                            <Input style={{width: '100%'}} type="number"/>
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={11}  className='maxInventory'>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintaincode ? ChineseEnglishSize.VendorMaintaincode.descripts:'供应商代码：'} {...formItemItem}>
                                                        {getFieldDecorator('code', {
                                                            initialValue: userInfo.code ? userInfo.code : undefined,
                                                            rules:[{ required : ChineseEnglishSize.VendorMaintaincode ? ChineseEnglishSize.VendorMaintaincode.required =='Y'? true:false: false, message: ChineseEnglishSize.VendorMaintaincode ? ChineseEnglishSize.VendorMaintaincode.message:'请输入供应商代码'}]
                                                        })(
                                                            <Input style={{width: '100%'}} />
                                                        )}
                                                    </FormItem>
                                                    <a className='max' onClick={this.saveMaxInventory}>{ChineseEnglishSize.MaterialInventoryItemMaintenanmaxCode ? ChineseEnglishSize.MaterialInventoryItemMaintenanmaxCode.descripts:'最大码'}</a>
                                                </Col>
                                            </Row>
                                            <Row>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintaindesc ? ChineseEnglishSize.VendorMaintaindesc.descripts:'供应商描述：'} {...formItemItem}>
                                                        {getFieldDecorator('descripts', {
                                                            initialValue: userInfo.descripts ? userInfo.descripts : undefined,
                                                            rules:[{ required : ChineseEnglishSize.VendorMaintaindesc ? ChineseEnglishSize.VendorMaintaindesc.required =='Y'? true:false: false, message: ChineseEnglishSize.VendorMaintaindesc ? ChineseEnglishSize.VendorMaintaindesc.message:'请输入供应商描述'}]
                                                        })(
                                                            <Input style={{width: '100%'}} />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintainestablishedDate ? ChineseEnglishSize.VendorMaintainestablishedDate.descripts:'供应商成立日期：'} {...formItemItem}>
                                                        {getFieldDecorator('establishedDate', {
                                                            initialValue:  userInfo.establishedDate ? Moment(userInfo.establishedDate) : undefined,
                                                        })(
                                                            <DatePicker
                                                                format="YYYY-MM-DD"
                                                                style={{width:'100%'}}
                                                            >
                                                            </DatePicker>
                                                        )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintainregCapital ? ChineseEnglishSize.VendorMaintainregCapital.descripts:'供应商注册资金：'} {...formItemItem}>
                                                        {getFieldDecorator('regCapital', {
                                                            initialValue: userInfo.regCapital ? userInfo.regCapital : undefined,
                                                        })(
                                                            <Input style={{width: '100%'}} />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintainaddress ? ChineseEnglishSize.VendorMaintainaddress.descripts:'供应商地址：'} {...formItemItem}>
                                                        {getFieldDecorator('address', {
                                                            initialValue: userInfo.address ? userInfo.address : undefined,
                                                        })(
                                                            <Input style={{width: '100%'}} />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintaintelephone ? ChineseEnglishSize.VendorMaintaintelephone.descripts:'供应商电话：'} {...formItemItem}>
                                                        {getFieldDecorator('telephone', {
                                                            initialValue: userInfo.telephone ? userInfo.telephone : undefined,
                                                        })(
                                                            <Input style={{width: '100%'}} />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintainfax ? ChineseEnglishSize.VendorMaintainfax.descripts:'供应商传真：'} {...formItemItem}>
                                                        {getFieldDecorator('fax', {
                                                            initialValue: userInfo.fax ? userInfo.fax : undefined,
                                                        })(
                                                            <Input style={{width: '100%'}} />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintainemail ? ChineseEnglishSize.VendorMaintainemail.descripts:'供应商邮箱：'} {...formItemItem}>
                                                        {getFieldDecorator('email', {
                                                            initialValue: userInfo.email ? userInfo.email : undefined,
                                                        })(
                                                            <Input style={{width: '100%'}} />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintainpresident ? ChineseEnglishSize.VendorMaintainpresident.descripts:'供应商法人代表：'} {...formItemItem}>
                                                        {getFieldDecorator('president', {
                                                            initialValue: userInfo.president ? userInfo.president : undefined,
                                                        })(
                                                            <Input style={{width: '100%'}} />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintaindepositBank ? ChineseEnglishSize.VendorMaintaindepositBank.descripts:'供应商开户银行：'} {...formItemItem}>
                                                        {getFieldDecorator('depositBank', {
                                                            initialValue: userInfo.depositBank ? userInfo.depositBank : undefined,
                                                        })(
                                                            <Input style={{width: '100%'}} />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintainbankAccount ? ChineseEnglishSize.VendorMaintainbankAccount.descripts:'供应商银行账号：'} {...formItemItem}>
                                                        {getFieldDecorator('bankAccount', {
                                                            initialValue: userInfo.bankAccount ? userInfo.bankAccount : undefined,
                                                        })(
                                                            <Input style={{width: '100%'}} />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintaincomLic ? ChineseEnglishSize.VendorMaintaincomLic.descripts:'工商执照：'} {...formItemItem}>
                                                        {getFieldDecorator('comLic', {
                                                            initialValue: userInfo.comLic ? userInfo.comLic : undefined,
                                                        })(
                                                            <Input style={{width: '100%'}} />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintaincomLicDate ? ChineseEnglishSize.VendorMaintaincomLicDate.descripts:'工商执照有效期：'} {...formItemItem}>
                                                        {getFieldDecorator('comLicDate', {
                                                            initialValue:  userInfo.comLicDate ? Moment(userInfo.comLicDate) : undefined,
                                                        })(
                                                            <DatePicker
                                                                format="YYYY-MM-DD"
                                                                style={{width:'100%'}}
                                                            >
                                                            </DatePicker>
                                                        )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintainrevReg ? ChineseEnglishSize.VendorMaintainrevReg.descripts:'税务登记：'} {...formItemItem}>
                                                        {getFieldDecorator('revReg', {
                                                            initialValue:  userInfo.revReg ? userInfo.revReg: undefined,
                                                        })(
                                                            <Input style={{width: '100%'}} />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintainrevRegDate ? ChineseEnglishSize.VendorMaintainrevRegDate.descripts:'税务登记有效期：'} {...formItemItem}>
                                                        {getFieldDecorator('revRegDate', {
                                                            initialValue: userInfo.revRegDate ? Moment(userInfo.revRegDate) : undefined,
                                                        })(
                                                            <DatePicker
                                                                format="YYYY-MM-DD"
                                                                style={{width:'100%'}}
                                                            >
                                                            </DatePicker>
                                                        )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintaindrugManLic ? ChineseEnglishSize.VendorMaintaindrugManLic.descripts:'药品经营许可证：'} {...formItemItem}>
                                                        {getFieldDecorator('drugManLic', {
                                                            initialValue:  userInfo.drugManLic ?userInfo.drugManLic : undefined,
                                                        })(
                                                            <Input style={{width: '100%'}} />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintaindrugManLicDate ? ChineseEnglishSize.VendorMaintaindrugManLicDate.descripts:'药品经营许可证有效期：'} {...formItemItem}>
                                                        {getFieldDecorator('drugManLicDate', {
                                                            initialValue: userInfo.drugManLicDate ?  Moment(userInfo.drugManLicDate) : undefined,
                                                        })(
                                                            <DatePicker
                                                                format="YYYY-MM-DD"
                                                                style={{width:'100%'}}
                                                            >
                                                            </DatePicker>
                                                        )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintainsanitation ? ChineseEnglishSize.VendorMaintainsanitation.descripts:'卫生许可证：'} {...formItemItem}>
                                                        {getFieldDecorator('sanitation', {
                                                            initialValue: userInfo.sanitation ? userInfo.sanitation : undefined,
                                                        })(
                                                            <Input style={{width: '100%'}} />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintainsanitationDate ? ChineseEnglishSize.VendorMaintainsanitationDate.descripts:'卫生许可证效期：'} {...formItemItem}>
                                                        {getFieldDecorator('sanitationDate', {
                                                            initialValue:  userInfo.sanitationDate ? Moment(userInfo.sanitationDate) : undefined,
                                                        })(
                                                            <DatePicker
                                                                format="YYYY-MM-DD"
                                                                style={{width:'100%'}}
                                                            >
                                                            </DatePicker>
                                                        )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintainorgCode ? ChineseEnglishSize.VendorMaintainorgCode.descripts:'组织机构代码：'} {...formItemItem}>
                                                        {getFieldDecorator('orgCode', {
                                                            initialValue: userInfo.orgCode ? userInfo.orgCode : undefined,
                                                        })(
                                                            <Input style={{width: '100%'}} />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintainorgCodeDate ? ChineseEnglishSize.VendorMaintainorgCodeDate.descripts:'组织机构代码有效期：'} {...formItemItem}>
                                                        {getFieldDecorator('orgCodeDate', {
                                                            initialValue:  userInfo.orgCodeDate ? Moment(userInfo.orgCodeDate) : undefined,
                                                        })(
                                                            <DatePicker
                                                                format="YYYY-MM-DD"
                                                                style={{width:'100%'}}
                                                            >
                                                            </DatePicker>
                                                        )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintaingsp ? ChineseEnglishSize.VendorMaintaingsp.descripts:'Gsp认证：'} {...formItemItem}>
                                                        {getFieldDecorator('gsp', {
                                                            initialValue: userInfo.gsp ? userInfo.gsp : undefined,
                                                        })(
                                                            <Input style={{width: '100%'}} />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintaingspDate ? ChineseEnglishSize.VendorMaintaingspDate.descripts:'GSP认证有效期：'} {...formItemItem}>
                                                        {getFieldDecorator('gspDate', {
                                                            initialValue:  userInfo.gspDate ? Moment(userInfo.gspDate) : undefined,
                                                        })(
                                                            <DatePicker
                                                                format="YYYY-MM-DD"
                                                                style={{width:'100%'}}
                                                            >
                                                            </DatePicker>
                                                        )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintainsocialCreditCode ? ChineseEnglishSize.VendorMaintainsocialCreditCode.descripts:'社会信用码：'} {...formItemItem}>
                                                        {getFieldDecorator('socialCreditCode', {
                                                            initialValue: userInfo.socialCreditCode ? userInfo.socialCreditCode : undefined,
                                                        })(
                                                            <Input style={{width: '100%'}} />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintainsocialCreditExpDate ? ChineseEnglishSize.VendorMaintainsocialCreditExpDate.descripts:'信用码效期：'} {...formItemItem}>
                                                        {getFieldDecorator('socialCreditExpDate', {
                                                            initialValue:  userInfo.socialCreditExpDate ? Moment(userInfo.socialCreditExpDate) : undefined,
                                                        })(
                                                            <DatePicker
                                                                format="YYYY-MM-DD"
                                                                style={{width:'100%'}}
                                                            >
                                                            </DatePicker>
                                                        )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintaingrading ? ChineseEnglishSize.VendorMaintaingrading.descripts:'等级：'} {...formItemItem}>
                                                        {getFieldDecorator('grading', {
                                                            initialValue: userInfo.grading ? userInfo.grading : undefined,
                                                        })(
                                                            <Select allowClear style={{width: '100%'}}>
                                                                <Option value="G" key="G" title="Good" seatchprop="Good">Good</Option>
                                                                <Option value="B" key="B" title="Bad" seatchprop="Bad">Bad</Option>
                                                                <Option value="A" key="A" title="Average" seatchprop="Average">Average</Option>
                                                            </Select>
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintaincrLimit ? ChineseEnglishSize.VendorMaintaincrLimit.descripts:'信贷限额采购额：'} {...formItemItem}>
                                                        {getFieldDecorator('crLimit', {
                                                            initialValue:  userInfo.crLimit ?userInfo.crLimit : undefined,
                                                        })(
                                                            <Input style={{width: '100%'}} />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintaincontractNo ? ChineseEnglishSize.VendorMaintaincontractNo.descripts:'合同编号：'} {...formItemItem}>
                                                        {getFieldDecorator('contractNo', {
                                                            initialValue: userInfo.contractNo ? userInfo.contractNo : undefined,
                                                        })(
                                                            <Input style={{width: '100%'}} />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintainvenType ? ChineseEnglishSize.VendorMaintainvenType.descripts:'类型：'} {...formItemItem}>
                                                        {getFieldDecorator('venType', {
                                                            initialValue: userInfo.venType ? userInfo.venType : undefined,
                                                        })(
                                                            <Input style={{width: '100%'}} />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintainstartDate ? ChineseEnglishSize.VendorMaintainstartDate.descripts:'生效日期：'} {...formItemItem}>
                                                        {getFieldDecorator('startDate', {
                                                            initialValue:  userInfo.startDate ? Moment(userInfo.startDate) : undefined,
                                                            rules:[{ required : ChineseEnglishSize.VendorMaintainstartDate ? ChineseEnglishSize.VendorMaintainstartDate.required =='Y'? true:false: false, message: ChineseEnglishSize.VendorMaintainstartDate ? ChineseEnglishSize.VendorMaintainstartDate.message:'请选择生效日期'}]
                                                        })(
                                                            <DatePicker
                                                                format="YYYY-MM-DD"
                                                                style={{width:'100%'}}
                                                            >
                                                            </DatePicker>
                                                        )}
                                                    </FormItem>
                                                </Col>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintainendDate ? ChineseEnglishSize.VendorMaintainendDate.descripts:'失效日期：'} {...formItemItem}>
                                                        {getFieldDecorator('endDate', {
                                                            initialValue: userInfo.endDate ? Moment(userInfo.endDate) : undefined,
                                                        })(
                                                            <DatePicker
                                                                format="YYYY-MM-DD"
                                                                style={{width:'100%'}}
                                                            >
                                                            </DatePicker>
                                                        )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                            <Row>
                                                <Col span={11}>
                                                    <FormItem label={ChineseEnglishSize.VendorMaintainENDesc ? ChineseEnglishSize.VendorMaintainENDesc.descripts:'英文描述：'} {...formItemItem}>
                                                        {getFieldDecorator('ENDescripts', {
                                                            initialValue: userInfo.ENDesc ? userInfo.ENDesc: undefined,
                                                        })(
                                                            <Input style={{width: '100%'}} />
                                                        )}
                                                    </FormItem>
                                                </Col>
                                            </Row>
                                        </Col>
                                    </div>
                                </Card>
                            </Form>

                        </Col>
                        <Col>
                            <Row style={{marginTop: '10px',textAlign: 'right'}} >
                                <Button type="primary" style={{marginRight: '30px'}} onClick={this.saveData}>{ChineseEnglishSize.VendorMaintainsave ? ChineseEnglishSize.VendorMaintainsave.descripts:'保存'}</Button>
                                <Button onClick={this.resetFields}>{ChineseEnglishSize.VendorMaintainvenreset ? ChineseEnglishSize.VendorMaintainvenreset.descripts:'重置'}</Button>
                            </Row>
                        </Col>
                    </Col>
                </div>
            )
        }
    }
);
export default VendorMaintain;