import React from 'react' import {inject,observer} from 'mobx-react'; import {WeaAlertPage} from 'ecCom' import { WeaReportGroup, WeaTop, WeaTab, WeaRightMenu, WeaDialog, WeaInput, WeaFormItem, WeaTools, WeaRadioGroup, WeaNewScroll} from 'ecCom' import {Tabs,Button,Spin} from 'antd' import * as mobx from 'mobx'; import { toJS } from 'mobx'; import {WeaTableNew} from 'comsMobx'; import '../../style/schedulediffreport.less'; import {routerShape} from 'react-router'; import debounce from 'lodash/debounce' const WeaTable = WeaTableNew.WeaTable; const TabPane = Tabs.TabPane; import * as Util from '../../util/index'; import {i18n} from '../../public/i18n'; import isEmpty from 'lodash/isEmpty'; @inject('hrmScheduleDiffReport') @observer class Main extends React.Component{ static contextTypes = { router: routerShape } constructor(props) { super(props); const funcs = ['getReportData']; funcs.forEach(f=> this[f] = this[f].bind(this)); } componentDidMount() { const { hrmScheduleDiffReport } = this.props; this.init(); } componentWillReceiveProps(nextProps) { const { hrmScheduleDiffReport } = this.props; if(this.props.location.key !== nextProps.location.key) { this.init(); } } init(){ const { hrmScheduleDiffReport } = this.props; hrmScheduleDiffReport.getSearchCondition(); } doSearch(){ const { hrmScheduleDiffReport } = this.props; hrmScheduleDiffReport.getData(); } getRightMenu(){ const { hrmScheduleDiffReport } = this.props; let btns =[]; const btnImportExcel = { icon: , content:i18n.button.export() }; btns.push(btnImportExcel); return btns; } onRightMenuClick(key){ const { hrmScheduleDiffReport } = this.props; switch(key){ case '0': hrmScheduleDiffReport.exportExcel(); break; case '1': break; } } getTopButtons() { const { hrmScheduleDiffReport } = this.props; let btns =[]; const btnExportExcel = ; btns.push(btnExportExcel); return btns; } getTableRow(){ const { hrmScheduleDiffReport } = this.props; let {reportdata} = hrmScheduleDiffReport; reportdata = toJS(reportdata); let rows =[]; !isEmpty(reportdata.titlerows) && reportdata.titlerows.forEach(row =>{ let cells = []; !isEmpty(row) && row.forEach( cell => { cells.push({cell.value}); }) rows.push({cells}); }) !isEmpty(reportdata.datarows) && reportdata.datarows.forEach(row =>{ let cells = []; !isEmpty(row) && row.forEach( cell => { cells.push({cell.value}); }) rows.push({cells}); }) return rows; } getBtns() { return [ (), (), (), (), (), (), (), (), (), (), () ] return btns; } getDetialBtns() { const { hrmScheduleDiffReport } = this.props; let btns =[]; const btnExportExcel = ; btns.push(btnExportExcel); return btns; } getDetailRightMenu = () => { const { hrmScheduleDiffReport } = this.props; let rightMenu = []; rightMenu.push({ key: '1', content: i18n.button.export(), icon: , onClick: ()=>hrmScheduleDiffReport.exportDetialExcel() }); return rightMenu; } getDetial(stsType){ const { hrmScheduleDiffReport } = this.props; hrmScheduleDiffReport.stsType=stsType; hrmScheduleDiffReport.getTabTableData(); hrmScheduleDiffReport.updateVisible(true); } getReportData(params){ const { hrmScheduleDiffReport } = this.props; hrmScheduleDiffReport.getReportData(params); } render(){ const { hrmScheduleDiffReport } = this.props; let { title,form,table, config, loading, reportdata,visible,dialogTitle, lastname,selectedKey,setSelectedKey,topTab} = hrmScheduleDiffReport; let qSize = reportdata.qSize; reportdata = toJS(reportdata); let cols =[]; for(let i=0;i); } return(
hrmScheduleDiffReport.updateVisible(false)} onClo closable style={{width: 900, height: window.innerHeight-250>500?500:window.innerHeight-250}} title = {dialogTitle} icon="icon-coms-hrm" iconBgcolor='#217346' buttons = {this.getDetialBtns()} moreBtn={{datas: this.getDetailRightMenu()}} > {/* {hrmScheduleDiffReport.getTableData()}} onSearchChange={v => { hrmScheduleDiffReport.lastname = v; }} /> */} {!isEmpty(topTab) && setSelectedKey(key)} /> } 500?500:window.innerHeight-250} ref="scrollBar"> } iconBgcolor='#217346' buttons={this.getTopButtons()} buttonSpace={10} showDropIcon={true} dropMenuDatas={this.getRightMenu()} onDropMenuClick={this.onRightMenuClick.bind(this)} >
{ !isEmpty(config) && }
{ !isEmpty(reportdata) &&
{cols} {this.getTableRow()}
{reportdata.title}
{i18n.label.reportDate()}:{Util.DateFormat(new Date(), "yyyy-MM-dd") }
}
{ !isEmpty(reportdata) &&
{this.getBtns()}
}
); } } export default Main