import React from 'react';
import {
  inject,
  observer
} from 'mobx-react';
import {
  WeaTop,
  WeaTab,
  WeaOrgTree,
  WeaEchart,
  WeaYear,
  WeaDialog,
  WeaPopoverHrm,
  WeaCheckbox,
  WeaRadioGroup,
  WeaRightMenu,
  WeaTools,
  WeaErrorPage,
  WeaAlertPage,
  WeaDatePicker,
  WeaBrowser,
  WeaNewScroll,
  WeaSearchGroup
} from 'ecCom';

import {
  WeaTableNew
} from 'comsMobx';
const WeaTable = WeaTableNew.WeaTable;
import {
  Modal,
  Row,
  Col,
  Button,
  Spin,
  Icon,
  Calendar,
  Tooltip,
  Timeline
} from 'antd';
import '../style/checking.less';
import '../style/outside.less';
import * as mobx from 'mobx';
import isEmpty from 'lodash/isEmpty';
import cloneDeep from 'lodash/cloneDeep';
import toString from 'lodash/toString';
import moment from 'moment';
import * as Util from '../util/index';
import Map from '../coms/Map';
import loadjs from 'loadjs';
import {
  i18n
} from '../public/i18n';
import {
  WeaLocaleProvider
} from 'ecCom';
import {
  carousel
} from '../util/index'
const getLabel = WeaLocaleProvider.getLabel;
const toJS = mobx.toJS;

@observer
export default class OutSideTabkey3 extends React.Component{

    reRenderColumns = (columns, store) => {
        const {
          handleViewClick
        } = store;    
        columns.map(c => {
          if (c.dataIndex === 'canViewSignImg') {
            c.render = function(text, record) {
              const {
                randomFieldId,
                canViewSignImgspan
              } = record;
              if (canViewSignImgspan === '1') {
                return <a onClick={() => handleViewClick(randomFieldId)}>{getLabel(33564,'查看')}</a>
              } else {
                return <span />
              }
            }
          }
        });
      }

    render() {
        const {
          hrmOutside
        } = this.props;
        let {
          config,
          table,
          onRadioGroupChange               
        } = hrmOutside;
        config = toJS(config);
        return <div className="radio-search-group">
         {/* <WeaRadioGroup config={config()} onChange={(params)=> {console.debug(1);hrmOutside.radioGroupParams=params;hrmOutside.getData(params)}}/> */}
         <WeaRadioGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaRadioGroup@ovq1fp`} config={toJS(config)} onChange={(params)=> {console.debug(1);hrmOutside.radioGroupParams=params;onRadioGroupChange(params)}}/>
         <WeaSearchGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaSearchGroup@ocj3rq`} needTigger={true} title={getLabel('19325',"明细表")} showGroup={true}>
          <WeaTable ecId={`${this && this.props && this.props.ecId || ''}_WeaTable@8wnjxp`}
            comsWeaTableStore={table}
            hasOrder={true}
            needScroll={true}
            getColumns={columns => this.reRenderColumns(columns,hrmOutside)}
            />
          </WeaSearchGroup>
         </div>       
      }
}