import React from 'react'
import {inject,observer} from 'mobx-react';
import {WeaAlertPage, WeaDatePicker } from 'ecCom'
import isEmpty from 'lodash/isEmpty'
import {
WeaReportGroup,
WeaTop,
WeaTab,
WeaRightMenu,
WeaDialog,
WeaInput,
WeaFormItem,
WeaTools,
WeaRadioGroup,
WeaNewScroll,
WeaTable} from 'ecCom'
import {Tabs,Button,Spin,Table} from 'antd'
import * as mobx from 'mobx';
import { toJS } from 'mobx';
import '../../style/schedulediffmonthattdetail.less';
import {routerShape} from 'react-router';
import debounce from 'lodash/debounce'
import moment from 'moment';
import {i18n} from '../../public/i18n';
@inject('hrmScheduleDiffMonthAttDetail')
@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 { hrmScheduleDiffMonthAttDetail } = this.props;
hrmScheduleDiffMonthAttDetail.resetConfig();
this.init();
}
componentWillReceiveProps(nextProps) {
const { hrmScheduleDiffMonthAttDetail } = this.props;
if(this.props.location.key !== nextProps.location.key) {
hrmScheduleDiffMonthAttDetail.resetConfig();
this.init();
}
}
init(){
const { hrmScheduleDiffMonthAttDetail } = this.props;
let {pDate} = hrmScheduleDiffMonthAttDetail;
hrmScheduleDiffMonthAttDetail.getSearchCondition({}, (config)=> {
let yearmonth = config[0];
const com =
hrmScheduleDiffMonthAttDetail.changeDate(value)}
/>
{/* */}
yearmonth.options = [];
yearmonth.com = com;
});
}
doSearch(){
const { hrmScheduleDiffMonthAttDetail } = this.props;
hrmScheduleDiffMonthAttDetail.getData();
}
exportExcel(){
const { hrmScheduleDiffMonthAttDetail } = this.props;
hrmScheduleDiffMonthAttDetail.exportExcel();
}
getRightMenu(){
const { hrmScheduleDiffMonthAttDetail } = this.props;
let btns =[];
const btnImportExcel = {
icon: ,
content:i18n.button.export()
};
btns.push(btnImportExcel);
return btns;
}
onRightMenuClick(key){
const { hrmScheduleDiffMonthAttDetail } = this.props;
switch(key){
case '0':
this.exportExcel();
break;
case '1':
break;
}
}
getTopButtons() {
const { hrmScheduleDiffMonthAttDetail } = this.props;
let btns =[];
const btnExportExcel = ;
btns.push(btnExportExcel);
return btns;
}
getTableRow(){
const { hrmScheduleDiffMonthAttDetail } = this.props;
let {reportdata} = hrmScheduleDiffMonthAttDetail;
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 => {
let params = {};
let backgroundColor = cell.backgroundColor||'';
let title = cell.title||'';
if(cell.resourceid){
params.resourceId = cell.resourceid;
params.curDate = cell.currentdate;
cells.push({this.getDetial(params)}}>{cell.value} | );
}else{
cells.push({cell.value} | );
}
})
rows.push({cells}
);
})
return rows;
}
getDetialBtns() {
return [];
}
getDetailRightMenu = () => {
const { hrmScheduleDiffReport } = this.props;
let rightMenu = [];
return rightMenu;
}
getDetial(params){
const { hrmScheduleDiffMonthAttDetail } = this.props;
hrmScheduleDiffMonthAttDetail.getTableData(params);
hrmScheduleDiffMonthAttDetail.updateVisible(true);
}
getReportData(params){
const { hrmScheduleDiffMonthAttDetail } = this.props;
hrmScheduleDiffMonthAttDetail.getReportData(params);
}
render(){
const { hrmScheduleDiffMonthAttDetail } = this.props;
let { title,form,config, loading, reportdata,visible,dialogTitle,table,table1,showFList} = hrmScheduleDiffMonthAttDetail;
reportdata = toJS(reportdata);
let cols =[];
!isEmpty(reportdata.titlerows) && reportdata.titlerows.forEach(row =>{
let width="3%";
cols.push();
})
return(
hrmScheduleDiffMonthAttDetail.updateVisible(false)}
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()}}
>
500?500:window.innerHeight-250} ref="scrollBar">
{
!isEmpty(table) &&
}
{
showFList && !isEmpty(table1) &&
}
}
iconBgcolor='#217346'
buttons={this.getTopButtons()}
buttonSpace={10}
showDropIcon={true}
dropMenuDatas={this.getRightMenu()}
onDropMenuClick={this.onRightMenuClick.bind(this)}
>
{
!isEmpty(config) &&
}
{
!isEmpty(reportdata) &&
{cols}
{this.getTableRow()}
}
);
}
}
export default Main