import React from 'react'
import { connect } from 'dva'
import { Form, Button, Checkbox, Input, DatePicker, Select, Tabs, Divider, Row, Col, Icon, Cascader, message } from 'antd'
import { initFilter, addRuleAndGroups, guid, extendInclude, extendRule } from "../../../utils/common"
import moment from 'moment'
import classNames from 'classnames'
import styles from '../../Combination/combinationPage.css'

const { Search } = Input

class FMEnterpriseInfoPage extends React.Component {
  constructor(props) {
    super(props)
    var myDate = new Date()
    var year = myDate.getFullYear() //获取当前年
    var mon = myDate.getMonth() + 1 //获取当前月
    var date = myDate.getDate() //获取当前日
    this.state = {
      activeKey: 'entryprise-tabs-1',
      //基本信息
      baseId: guid(),
      name: "",
      abbName: "",
      legalPerson: "",
      creditCode: "",
      isCenter: false,
      tmpPlaceId:"",
      tmpParentId:"",
      placeId: "",
      provId: "",
      proviences: [],
      cityId: "",
      cities: [],
      propId: "",
      propEnum: [],
      industryId: "",
      options: [],
      defaultValue: [],
      capital: 0,
      GDP: 0,
      fundId: "",
      fundEnum: [],
      createTime: year + "-" + mon + "-" + date,
      //定位
      localId: guid(),
      lng: 118.616544,
      lat: 24.94745,
      address: "福建省",
      level: 16,
      //能耗配置
      energyId: guid(),
      isEnergy: false,
      energyManagement: "",
      energyLeader: "",
      leaderPosition: "",
      leaderTel: "",
      energyCharge: "",
      chargeTel: "",
      isManagementSys: false,
      authDate: year + "-" + mon + "-" + date,
      authMechanism: "",
    }
  };

  componentDidMount () {
    this.getEntEnumByPCode()
    this.getIndustryEnumByPCode()
    this.getFunEnumByPCode()
    this.getBaseInfoData()
    this.getLocalState()
    this.getBaseEnergyData()
  }

  onRef = (ref) => {
    this.child = ref
  };

  //获取数据
  getBaseInfoData = (value) => {
    const json = initFilter(this.props.login.OrgId)
    extendInclude(json,"Nav_Place")
    addRuleAndGroups(json, value)
    this.props.dispatch({
      type: 'app/getDataByPost',
      url: 'FM/BaseInfo/OrderPaged',
      payload: json,
      onlyData: false,
      onComplete: (re) => {
        if (re && re.IsSuccessful && re.Data && re.Data.length > 0) {
          var reData = re.Data[0]
          this.setState({
            baseId: reData.ID,
            name: reData.NAME,
            abbName: reData.ABB_NAME,
            legalPerson: reData.LEGAL_PERSON,
            creditCode: reData.CREDIT_CODE,
            isCenter: reData.IS_CENTER,
            tmpPlaceId: reData.PLACE_ID,
            tmpParentId: reData.Nav_Place.PARENT_ID,
            propId: reData.PROP_ENUM_ITEM_ID,
            capital: reData.CAPITAL,
            fundId: reData.FUND_ENUM_ITEM_ID,
            createTime: reData.CREATE_TIME,
            industryId: reData.INDUSTRY_ENUM_ITEM_ID,
            GDP: reData.GDP
          }, () => {
            this.getProviences()
          })
        }
        else {
          this.getProviences()
        }
      }
    })
  };

  //获取能耗配置数据
  getBaseEnergyData = (value) => {
    const json = initFilter(this.props.login.OrgId)
    addRuleAndGroups(json, value)
    this.props.dispatch({
      type: 'app/getDataByPost',
      url: 'FM/BaseEnergy/OrderPaged',
      payload: json,
      onlyData: false,
      onComplete: (re) => {
        if (re && re.IsSuccessful && re.Data && re.Data.length > 0) {
          var reData = re.Data[0]
          this.setState({
            energyId: reData.ID,
            isEnergy: reData.IS_ENERGY,
            energyManagement: reData.ENERGY_MANAGEMENT,
            energyLeader: reData.ENERGY_LEADER,
            leaderPosition: reData.LEADER_POSITION,
            leaderTel: reData.LEADER_TEL,
            energyCharge: reData.ENERGY_CHARGE,
            chargeTel: reData.CHARGE_TEL,
            isManagementSys: reData.IS_MANAGEMENT_SYS,
            authDate: reData.AUTH_DATE,
            authMechanism: reData.AUTH_MECHANISM,
          })
        }
      }
    })
  };

  //獲取選中的地區數據
  getPlace = () => {
    const json = {
      OrgId: this.props.login.OrgId,
      Keyword: this.state.placeId
    }
    this.props.dispatch({
      type: 'app/getDataByPost',
      url: 'BD/Place/Get',
      payload: json,
      onlyData: false,
      onComplete: (re) => {
        if (re && re.IsSuccessful && re.Data) {
          this.setState({
            cityId: re.Data.ID,
            provId: re.Data.PARENT_ID,
          }, () => {
            this.getProviences()
          })
        }
      }
    })
  }

  //获取省份数据
  getProviences = () => {
    const json = {
      OrgId: this.props.login.OrgId
    }
    this.props.dispatch({
      type: 'app/getDataByPost',
      url: 'BD/BDPlace/GetProviences',
      payload: json,
      onlyData: false,
      onComplete: (re) => {
        if (re && re.IsSuccessful && re.Data && re.Data.length > 0) {
          this.setState({
            proviences: re.Data
          }, () => {
            this.getCitiesByPId()
          })
        }
      }
    })
  };

  //获取城市数据
  getCitiesByPId = () => {
    const json = {
      OrgId: this.props.login.OrgId,
      //Parameter1: this.state.provId
    }
    if(this.state.tmpParentId){
      extendRule(json,"PARENT_ID",1,this.state.tmpParentId);//城市
    }
    extendRule(json,"PROP",1,2);//城市
    this.props.dispatch({
      type: 'app/getDataByPost',
      url: 'BD/Place/OrderPaged',
      payload: json,
      onlyData: false,
      onComplete: (re) => {
        if (re && re.IsSuccessful && re.Data && re.Data.length > 0) {
          this.setState({
            cities: re.Data
          },()=>{
            this.setState({
              cityId:this.state.tmpPlaceId,
              placeId:this.state.tmpPlaceId,
              provId:this.state.tmpParentId
            });
          
          })
        }
      }
    })
  };

  //选择省份获取城市数据
  getCityData = (value) => {
    this.setState({
      provId: value,
      cityId:"",
      tmpPlaceId:"",
      tmpParentId:value,
    }, () => {
      this.getCitiesByPId()
    }
    )
  }
  //企业属性
  getEntEnumByPCode = () => {
    const json = {
      OrgId: this.props.login.OrgId,
      Parameter1: "FM040"
    }
    this.props.dispatch({
      type: 'app/getDataByPost',
      url: 'FM/Enum/GetEnumDataByCode',
      payload: json,
      onlyData: false,
      onComplete: (re) => {
        if (re && re.IsSuccessful && re.Data && re.Data.length > 0) {
          this.setState({
            propEnum: re.Data
          })
        }
      }
    })
  };

  //行业
  getIndustryEnumByPCode = () => {
    const json = {
      OrgId: this.props.login.OrgId
    }
    this.props.dispatch({
      type: 'app/getDataByPost',
      url: 'FM/FMBaseInfo/GetIndustryData',
      payload: json,
      onlyData: false,
      onComplete: (re) => {
        if (re && re.IsSuccessful && re.Data) {
          this.setState({
            defaultValue: re.Data.DefaultValue,
            options: re.Data.Options
          })
        }
      }
    })
  };

  //资金单位
  getFunEnumByPCode = () => {
    const json = {
      OrgId: this.props.login.OrgId,
      Parameter1: "QIAN"
    }
    this.props.dispatch({
      type: 'app/getDataByPost',
      url: 'FM/Enum/GetEnumDataByCode',
      payload: json,
      onlyData: false,
      onComplete: (re) => {
        if (re && re.IsSuccessful && re.Data && re.Data.length > 0) {
          this.setState({
            fundEnum: re.Data
          })
        }
      }
    })
  };

  //地图初始化
  getInitMap = () => {
    const json = {
      OrgId: this.props.login.OrgId
    }
    this.props.dispatch({
      type: 'app/getDataByPost',
      url: 'FM/BaseConfig/Entities',
      payload: json,
      onlyData: false,
      onComplete: (re) => {
        if (re && re.IsSuccessful && re.Data && re.Data.length > 0) {
          //var mapSrc = 'https://api.map.baidu.com/api?v=2.0&ak='+ re.Data[0].MAP_KEY;
          //var script = document.createElement('script');
          //script.type = 'text/javascript';
          //script.src = mapSrc;
          //document.head.appendChild(script);   
          //this.map = new window.BMap.Map("map");
          //let point = new BMap.Point(116.404, 39.915);
          //this.map.centerAndZoom("北京",10);
          if (window.bdMap)
            return
          window.bdMap = new BMap.Map('map')
          window.localSearch = new BMap.LocalSearch(bdMap)
          let lng = this.state.lng
          let lat = this.state.lat
          if (lng > 0 && lat > 0) {
            this.mapInit()
          } else {
            window.localSearch.search(this.state.address)
            window.localSearch.enableAutoViewport()
            window.localSearch.setSearchCompleteCallback(function (searchResult) {
              var poi = searchResult.getPoi(0)
              if (!poi) {
                window.localSearch.search(this.state.address)
                return
              }
              this.setState({
                lng: poi.point.lng,
                lat: poi.point.lat,
              })
              this.mapInit()
            })
          }

          //厦门
          bdMap.addControl(new BMap.NavigationControl())               // 添加平移缩放控件
          bdMap.addControl(new BMap.ScaleControl())                    // 添加比例尺控件
          bdMap.addControl(new BMap.OverviewMapControl())              //添加缩略地图控件
          bdMap.enableScrollWheelZoom()

          bdMap.addEventListener('click', (e) => {
            var zoom = e.target.getZoom()
            bdMap.centerAndZoom(e.point, zoom)

            var geoc = new BMap.Geocoder()
            geoc.getLocation(e.point, (rs) => {
              var addComp = rs.addressComponents
              var address = addComp.province + addComp.city + addComp.district + addComp.street + addComp.streetNumber
              this.setState({
                address: address
              })
            })

            bdMap.clearOverlays()
            var marker = new BMap.Marker(e.point)  // 创建标注
            bdMap.addOverlay(marker)              // 将标注添加到地图中
            bdMap.panTo(e.point)
            this.setState({
              lng: e.point.lng,
              lat: e.point.lat,
              level: zoom
            })
          })
        }
      }
    })
  }

  //标注地图
  mapInit = () => {
    let lng = this.state.lng
    let lat = this.state.lat
    var point = new BMap.Point(lng, lat)
    bdMap.centerAndZoom(point, this.state.level)
    var marker = new BMap.Marker(point)  // 创建标注
    bdMap.addOverlay(marker)              // 将标注添加到地图中
    bdMap.panTo(point)
  }

  //坐标
  getLocalState = () => {
    const json = {
      OrgId: this.props.login.OrgId
    }
    this.props.dispatch({
      type: 'app/getDataByPost',
      url: 'FM/BaseAdd/Entities',
      payload: json,
      onlyData: false,
      onComplete: (re) => {
        if (re && re.IsSuccessful && re.Data && re.Data.length > 0) {
          var data = re.Data[0]
          this.setState({
            localId: data.ID,
            lng: data.LONGITUDE,
            lat: data.LATITIDE,
            level: data.HIERARCHY,
            address: data.ADDRESS
          }, () => {
            this.getInitMap()
          })
        } else {
          this.getInitMap()
        }
      }
    })
  };

  //提交数据
  postForm = () => {
    const { provId, cityId, propId, industryId, fundId } = this.state
    if (!provId || !cityId || !propId || !industryId || !fundId) return
    const json = {
      BaseInfo: {
        ID: this.state.baseId,
        ORG_ID: this.props.login.OrgId,
        NAME: this.state.name,
        ABB_NAME: this.state.abbName,
        LEGAL_PERSON: this.state.legalPerson,
        CREDIT_CODE: this.state.creditCode,
        PLACE_ID: this.state.placeId,
        IS_CENTER: this.state.isCenter,
        PROP_ENUM_ITEM_ID: this.state.propId,
        INDUSTRY_ENUM_ITEM_ID: this.state.industryId,
        FUND_ENUM_ITEM_ID: this.state.fundId,
        CAPITAL: this.state.capital,
        GDP: this.state.GDP,
      },
      BaseAdd: {
        ID: this.state.localId,
        ORG_ID: this.props.login.OrgId,
        LONGITUDE: this.state.lng,
        LATITIDE: this.state.lat,
        HIERARCHY: this.state.level,
        ADDRESS: this.state.address
      },
      BaseEnergy: {
        ID: this.state.energyId,
        ORG_ID: this.props.login.OrgId,
        IS_ENERGY: this.state.isEnergy,
        ENERGY_MANAGEMENT: this.state.energyManagement,
        ENERGY_LEADER: this.state.energyLeader,
        LEADER_POSITION: this.state.leaderPosition,
        LEADER_TEL: this.state.leaderTel,
        ENERGY_CHARGE: this.state.energyCharge,
        CHARGE_TEL: this.state.chargeTel,
        IS_MANAGEMENT_SYS: this.state.isManagementSys,
        AUTH_DATE: this.state.authDate,
        AUTH_MECHANISM: this.state.authMechanism
      }
    }
    this.props.dispatch({
      type: 'app/getDataByPost',
      url: 'FM/FMBaseInfo/PostComPanyForm',
      payload: json,
      onlyData: false,
      onComplete: (re) => {
        if (re && re.IsSuccessful && re.Data) {
          message.success("保存成功！")
          return
        }
      }
    })
  }

  //地址搜索
  searchMap = () => {
    if (!this.state.address) return
    window.localSearch.search(this.state.address)
    window.localSearch.enableAutoViewport()
    window.localSearch.setSearchCompleteCallback((searchResult) => {
      var poi = searchResult.getPoi(0)
      if (!poi) {
        window.localSearch.search(this.state.address)
        return
      }
      this.setState({
        lng: poi.point.lng,
        lat: poi.point.lat,
        level: this.state.level
      })

      var lng = this.state.lng
      var lat = this.state.lat
      var point = new BMap.Point(lng, lat)
      bdMap.centerAndZoom(point, this.state.level)
      var marker = new BMap.Marker(point)  // 创建标注
      bdMap.addOverlay(marker)              // 将标注添加到地图中
      bdMap.panTo(point)
    })
  }

  onChange = (type, value) => {
    this.setState({
      [type]: value
    })
    if (type == "cityId") {
      this.setState({
        placeId: value,
      })
    }
  }

  onIndustryChange = (value) => {
    this.setState({
      defaultValue: value,
      industryId: value[value.length - 1]
    })
  }
  renderTabBar = () => {
    const { activeKey } = this.state
    const panels = [
      { ID: 'entryprise-tabs-1', LABEL_NAME: '基本信息' },
      { ID: 'entryprise-tabs-2', LABEL_NAME: '地图定位' },
      { ID: 'entryprise-tabs-3', LABEL_NAME: '能耗配置' }
    ]
    return (
      <div className={styles.tabBar__wrap}>
        {
          panels.map(item => {
            return (
              <div
                key={`${item.ID}--customTabBar`}
                onClick={() => this.setState({ activeKey: item.ID })}
                className={classNames(styles.tabBar__tab, { [styles.activated]: item.ID === activeKey })}>
                {item.LABEL_NAME}
              </div>
            )
          })
        }
      </div>
    )
  }

  render () {
    const { Option } = Select
    const dateFormat = 'YYYY-MM-DD'
    const { TabPane } = Tabs
    const { activeKey } = this.state
    const wrapStyle = {
      backgroundColor: '#ffffff',
      padding: '0.16rem 0.2rem 0.85rem 0.2rem'
    }
    const formWrap = {
      padding: '0 0.34rem'
    }
    return (
      <Tabs
        activeKey={activeKey}
        animated={false}
        renderTabBar={this.renderTabBar}
        className='combination-page__mainTab'>
        <TabPane tab='基本信息' key='entryprise-tabs-1'>
          <div className={styles.mainTabContent} style={wrapStyle}>
            <div style={{ textAlign: 'right', marginBottom: '0.1rem', ...formWrap }}>
              <Button type='primary' onClick={this.postForm}>保存</Button>
            </div>
            <Form name='entrypriseBaseForm' layout='vertical' style={formWrap}>
              <Row gutter={24}>
                <Col span='8'>
                  <Form.Item label='企业名称'>
                    <Input
                      placeholder="请输入企业名称"
                      value={this.state.name}
                      onChange={(evt) => this.onChange('name', evt.target.value)}
                    />
                  </Form.Item>
                </Col>
                <Col span='8'>
                  <Form.Item label='企业简称'>
                    <Input
                      placeholder="请输入企业简称"
                      value={this.state.abbName}
                      onChange={(evt) => this.onChange('abbName', evt.target.value)}
                    />
                  </Form.Item>
                </Col>
                <Col span='8'>
                  <Form.Item label='公示法人'>
                    <Input
                      placeholder="请输入公示法人"
                      value={this.state.legalPerson}
                      onChange={(evt) => this.onChange('legalPerson', evt.target.value)}
                    />
                  </Form.Item>
                </Col>
              </Row>
              <Row gutter={24}>
                <Col span='8'>
                  <Form.Item label='统一社会信用代码'>
                    <Input
                      placeholder="请输入统一社会信用代码"
                      value={this.state.creditCode}
                      onChange={(evt) => this.onChange('creditCode', evt.target.value)}
                    />
                  </Form.Item>
                </Col>
                <Col span='8'>
                  <Form.Item
                    label='所属区域'
                    required
                    validateStatus={!this.state.provId || !this.state.cityId ? 'error' : ''}
                  >
                    <Row gutter={16}>
                      <Col span={12}>
                        <Select
                          value={this.state.provId}
                          onChange={this.getCityData}
                          placeholder="选择省份"
                        >
                          {this.state.proviences.map(item => <Option value={item.ID}>{item.NAME}</Option>)}
                        </Select>
                      </Col>
                      <Col span={12}>
                        <Select
                          value={this.state.cityId}
                          onChange={(val) => this.onChange('cityId', val)}
                          placeholder="选择地区"
                        >
                          {this.state.cities.map(item => <Option value={item.ID}>{item.NAME}</Option>)}
                        </Select>
                      </Col>
                    </Row>
                  </Form.Item>
                </Col>
                <Col span='8'>
                  <Form.Item label='是否央企'>
                    <Checkbox
                      checked={this.state.isCenter}
                      onChange={(evt) => this.onChange('isCenter', evt.target.checked)}
                    />
                  </Form.Item>
                </Col>
              </Row>
            </Form>
            <Divider />
            <Form name='entrypriseBaseForm' layout='vertical' style={formWrap}>
              <Row gutter={24}>
                <Col span='8'>
                  <Form.Item
                    label='企业属性'
                    required
                    validateStatus={!this.state.propId ? 'error' : ''}
                  >
                    <Select
                      value={this.state.propId}
                      onChange={(val) => this.onChange('propId', val)}
                      placeholder="请选择"
                    >
                      {this.state.propEnum.map(item => <Option value={item.ID}>{item.NAME}</Option>)}
                    </Select>
                  </Form.Item>
                </Col>
                <Col span='8'>
                  <Form.Item
                    label='所属行业'
                    required
                    validateStatus={!this.state.industryId ? 'error' : ''}
                  >
                    <Cascader
                      style={{ width: '100%' }}
                      fieldNames={{ label: 'Label', value: 'Value', children: 'Children' }}
                      value={this.state.defaultValue}
                      options={this.state.options}
                      allowClear={false}
                      placeholder='请选择行业'
                      onChange={this.onIndustryChange}
                      changeOnSelect
                      displayRender={label => (label[label.length - 1])}
                    />
                  </Form.Item>
                </Col>
                <Col span='8'>
                  <Form.Item label='注册时间'>
                    <DatePicker
                      allowClear={false}
                      value={moment(this.state.createTime, dateFormat)}
                      onChange={(evt, ds) => this.onChange('createTime', ds)}
                      placeholder="请选择注册时间"
                    />
                  </Form.Item>
                </Col>
              </Row>
              <Row gutter={24}>
                <Col span='8'>
                  <Form.Item
                    label='注册资金'
                    required
                    validateStatus={!this.state.fundId ? 'error' : ''}
                  >
                    <Input
                      value={this.state.capital}
                      onChange={(evt) => this.onChange('capital', evt.target.value)}
                      addonAfter={
                        <Select
                          value={this.state.fundId}
                          onChange={(val) => this.onChange('fundId', val)}
                          style={{ width: 80 }}
                        >
                          {this.state.fundEnum.map(item => <Option value={item.ID}>{item.NAME}</Option>)}
                        </Select>
                      }
                    />
                  </Form.Item>
                </Col>
                <Col span='8'>
                  <Form.Item label='GDP'>
                    <Input
                      value={this.state.GDP}
                      onChange={(evt) => this.onChange('GDP', evt.target.value)}
                    />
                  </Form.Item>
                </Col>
              </Row>
            </Form>
          </div>
        </TabPane>
        <TabPane tab='地图定位' key='entryprise-tabs-2' forceRender>
          <div className={styles.mainTabContent} style={wrapStyle}>
            <div className={styles.mainTipZone} style={{ marginBottom: '0.16rem' }}>
              <span>
                <Icon type="info-circle" style={{ marginRight: 4, verticalAlign: 'middle' }} />
                <span style={{ verticalAlign: 'middle' }}>定位设置：点击下方百度地图即可设置企业的经纬度和层级！</span>
              </span>
              <Button type='primary' onClick={this.postForm}>保存</Button>
            </div>
            <Row>
              <Col span={6}>
                <Form name='entrypriseBaseForm' layout='vertical' style={formWrap}>
                  <Form.Item label='地址'>
                    <Search
                      enterButton="搜索"
                      value={this.state.address}
                      onChange={(evt) => this.onChange('address', evt.target.value)}
                      onSearch={this.searchMap}
                    />
                  </Form.Item>
                  <Form.Item label='百度地图经度数值'>
                    <Input value={this.state.lng} readOnly />
                  </Form.Item>
                  <Form.Item label='百度地图纬度数值'>
                    <Input value={this.state.lat} readOnly />
                  </Form.Item>
                  <Form.Item label='层级'>
                    <Input value={this.state.level} readOnly />
                  </Form.Item>
                </Form>
              </Col>
              <Col span={18}>
                <div id="map" style={{ height: "500px" }}></div>
              </Col>
            </Row>
          </div>
        </TabPane>
        <TabPane tab='能耗配置' key='entryprise-tabs-3' forceRender>
          <div className={styles.mainTabContent} style={wrapStyle}>
            <div style={{ textAlign: 'right', marginBottom: '0.1rem', ...formWrap }}>
              <Button type='primary' onClick={this.postForm}>保存</Button>
            </div>
            <Form name='entrypriseBaseForm' layout='vertical' style={formWrap}>
              <Row gutter={24}>
                <Col span='8'>
                  <Form.Item label='能管机构'>
                    <Input
                      value={this.state.energyManagement}
                      onChange={(evt) => this.onChange('energyManagement', evt.target.value)}
                    />
                  </Form.Item>
                </Col>
                <Col span='8'>
                  <Form.Item label='主管节能领导'>
                    <Input
                      value={this.state.energyLeader}
                      onChange={(evt) => this.onChange('energyLeader', evt.target.value)}
                    />
                  </Form.Item>
                </Col>
              </Row>
              <Row gutter={24}>
                <Col span='8'>
                  <Form.Item label='主管节能领导职位'>
                    <Input
                      value={this.state.leaderPosition}
                      onChange={(evt) => this.onChange('leaderPosition', evt.target.value)}
                    />
                  </Form.Item>
                </Col>
                <Col span='8'>
                  <Form.Item label='主管节能领导联系电话'>
                    <Input
                      value={this.state.leaderTel}
                      onChange={(evt) => this.onChange('leaderTel', evt.target.value)}
                    />
                  </Form.Item>
                </Col>
              </Row>
              <Row gutter={24}>
                <Col span='8'>
                  <Form.Item label='能管负责人姓名'>
                    <Input
                      value={this.state.energyCharge}
                      onChange={(evt) => this.onChange('energyCharge', evt.target.value)}
                    />
                  </Form.Item>
                </Col>
                <Col span='8'>
                  <Form.Item label='能管负责人电话'>
                    <Input
                      value={this.state.chargeTel}
                      onChange={(evt) => this.onChange('chargeTel', evt.target.value)}
                    />
                  </Form.Item>
                </Col>
                <Col span='8'>
                  <Form.Item label='是否矿山安全加工转换类企业'>
                    <Checkbox
                      checked={this.state.isEnergy}
                      onChange={(evt) => this.onChange('isEnergy', evt.target.checked)}
                    />
                  </Form.Item>
                </Col>
              </Row>
            </Form>
            <Divider />
            <Form name='entrypriseBaseForm' layout='vertical' style={formWrap}>
              <Row gutter={24}>
                <Col span='8'>
                  <Form.Item label='认证日期'>
                    <DatePicker
                      allowClear={false}
                      value={moment(this.state.authDate, dateFormat)}
                      onChange={(evt, ds) => this.onChange('authDate', ds)}
                      placeholder="请选择认证日期"
                    />
                  </Form.Item>
                </Col>
                <Col span='8'>
                  <Form.Item label='认证机构'>
                    <Input
                      value={this.state.authMechanism}
                      onChange={(evt) => this.onChange('authMechanism', evt.target.value)}
                    />
                  </Form.Item>
                </Col>
                <Col span='8'>
                  <Form.Item label='是否通过矿山安全管理体系认证'>
                    <Checkbox
                      checked={this.state.isManagementSys}
                      onChange={(evt) => this.onChange('isManagementSys', evt.target.checked)}
                    />
                  </Form.Item>
                </Col>
              </Row>
            </Form>
          </div>
        </TabPane>
      </Tabs>
    )
  }
}

export default connect(({ login, loading, EMemOrder, custom, app }) => ({ login, loading, EMemOrder, custom, app }))(Form.create()(FMEnterpriseInfoPage))