import React from 'react'
import { connect } from 'dva'
import { Form, Empty } from 'antd'
import config from "../../../config.js"
import storage from '../../../utils/storage'
class BDWordPage extends React.Component {
  render() {
    const tenant = storage('lacal').getItem('Tenant').val
    const orgId = storage('lacal').getItem('webOrgId').val
    const code = this.props.data.isParentRecord == '1' ? this.props.data.parentRecord[this.props.data.code] : this.props.data[this.props.data.code]
    const url = config.hmiUrl + "a4" + (this.props.data.isPreview == "1" ? "-preview" : "") + "?code=" + code + "&sysCode=optiEnergy&canBack=true&tenant=" + tenant + "&orgId="+orgId
    return (
      <div style={{ height: '100%' }}>
        {
          code ? <iframe style={{ width: '100%', height: '100%', border: 'none' }} title='word' src={url}></iframe> : <Empty />
        }
      </div>
    )
  }
}

BDWordPage.propTypes = {
}

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