import {
  inject,
  observer,
} from 'mobx-react';

import {
  WeaLocaleProvider,
} from 'ecCom';

import {
  downloadCvs2Img
} from './util'

const getLabel = WeaLocaleProvider.getLabel;

@inject('hrmUsedemand')
@observer
export default class Query extends React.Component {
  constructor(props) {
    super(props);
  }

  downloadImg = (index, title) => {
    const cvs = document.getElementsByTagName('canvas');

    downloadCvs2Img({
      cvs: cvs[cvs.length - 1],
      title: title
    });
  }

  render() {
    const {
      title,
      index,
      bl1,
    } = this.props;

    return (<div style={{textAlign: 'right'}}>
              <i 
                className='icon-coms-download2 wea-f14' 
                style={{marginRight: 15,cursor:'pointer'}}
                onClick={() => bl1 && this.downloadImg( index,title)}
              />
          </div>)

  }

}