import {
inject,
observer,
} from 'mobx-react'
import {
WeaTop,
WeaTab,
WeaRightMenu,
WeaAlertPage,
WeaMoreButton,
} from 'ecCom'
import {
Row,
Col,
Spin,
Button,
} from 'antd'
import React from 'react'
import * as mobx from 'mobx'
import RgWrapper from './RgWrapper'
import Statistics from './Statistics'
import BarChart from './BarChart'
import PieChart from './PieChart'
import MoreWithAdSearch from './MoreWithAdSearch'
import More from './More'
import {
jumpToHrmCard,
jumpToHrmDept,
jumpToHrmSubCompany,
jumpToHrmPost,
jumpToHrmContract
} from '../../util/pulic-func'
import '../../style/report.css';
import {
i18n
} from '../../public/i18n';
const toJS = mobx.toJS;
@inject('hrmChangeReport')
@observer
class ChangeRelatedReport extends React.Component {
constructor(props) {
super(props);
}
componentWillMount() {
this.pre();
}
componentDidMount() {
this.init();
}
componentWillReceiveProps(nextProps) {
const {
hrmChangeReport
} = this.props;
if (this.props.location.key !== nextProps.location.key) {
this.pre(nextProps);
hrmChangeReport.optionReset();
hrmChangeReport.conditionReset();
hrmChangeReport.paramReset();
hrmChangeReport.tabkeyReset();
hrmChangeReport.apiFinishedStatusReset();
hrmChangeReport.getSearchCondition('radioGroup');
// this.refs.page.click();
this.init();
}
}
pre(nextProps) {
const {
hrmChangeReport
} = this.props;
let pathname;
if (!nextProps) {
pathname = this.props.location.pathname.split('/').pop();
} else {
pathname = nextProps.location.pathname.split('/').pop();
}
hrmChangeReport.setPathName(pathname);
hrmChangeReport.pathToTitle();
hrmChangeReport.getCurWindowWidth();
hrmChangeReport.setColIdUnusualStatus();
}
init() {
const {
hrmChangeReport
} = this.props, {
getRight
} = hrmChangeReport;
getRight();
hrmChangeReport.tabkeyReset();
}
handleMenuClick(key) {
if (key == '0') {
this.handleExportExcel();
}
}
getDeadline() {
const {
hrmChangeReport
} = this.props;
const {
deadline
} = hrmChangeReport;
return (
)
}
search(val) {
const {
hrmChangeReport
} = this.props;
if (val !== undefined) {
hrmChangeReport.setSingleSearchCondition(val);
hrmChangeReport.getTableInfo('more', true);
} else {
hrmChangeReport.getTableInfo('bar', true);
}
}
handleExportExcel() {
const {
hrmChangeReport
} = this.props;
hrmChangeReport.exportAll();
// hrmChangeReport.getTableInfo('more', false);
}
iconSet() {
const icons = [
(),
(),
(),
(),
(),
(),
(),
(),
(),
(),
(),
];
return icons;
}
getIcons(i) {
const {
hrmChangeReport
} = this.props;
const {
pathname
} = hrmChangeReport;
let icons = this.iconSet();
switch (pathname) {
case 'add':
return icons.slice(i, i + 1);
case 'confirmation':
return icons.slice(i + 3, i + 4);
case 'transfer':
if (i < 2) {
return icons.slice(i + 3, i + 4);
} else {
return icons.slice(6, 7);
}
case 'contract':
return icons.slice(i + 8, i + 9);
default:
if (i < 2) {
return icons.slice(i + 3, i + 4);
} else {
return icons.slice(7, 8);
}
}
}
render() {
const {
hrmChangeReport
} = this.props;
const {
title,
countDatas,
pathname,
option1,
option2,
option3,
chartTitle1,
chartTitle2,
chartTitle3,
isLeftEchartsShow,
isRightEchartsShow,
isPieChartsShow,
ids,
idsForPie,
yAxisData,
linkList,
visible1,
visible2,
tableStore,
conditionOfAdSearch,
form,
strokeColor,
isNeedWeaTab,
isNeedPieChart,
tabKey,
tabDatas,
isApiOneFinished,
isApiTwoFinished,
winWidth,
gridData,
isColIdUnusual,
loading,
authorized,
exportAll,
} = hrmChangeReport;
const btn = [
(),
(),
(),
];
const btn1 = btn.slice(0, 1);
const btn2 = btn.slice(1, 3);
const dropMenuDatas = [{
key: '0',
content: i18n.button.export1(),
icon:
}, ]
if (!authorized) {
return (
{loading ?
:
{i18n.message.authFailed()}
}
)
} else {
return (
this.handleMenuClick(e)}
collectParams={{favname: title,favouritetype:5}}
>
}
iconBgcolor='#217346'
loading={true}
buttons={btn1}
showDropIcon={true}
dropMenuDatas={dropMenuDatas}
onDropMenuClick={(e) => this.handleMenuClick(e)}
>
{ isNeedWeaTab ? hrmChangeReport.tabClick(key)}
/>
: ''}
this.getIcons(i)}
isNeedLink={ (pathname == 'contract') ? true : false}
linkIndex={0}
setVisible={(arg, bool) => hrmChangeReport.setVisible(arg, bool)}
/>
hrmChangeReport.setVisible(arg, bool, dpId)}
/>
{ isNeedPieChart ? hrmChangeReport.setVisible(arg, bool, dpId)}
/>
: ''}
{this.getDeadline()}
hrmChangeReport.setVisible('1', false)}
search={(v) => this.search(v)}
tableStore={tableStore}
loading={tableStore.loading}
strokeColor={'#6FBCEA'}
/>
hrmChangeReport.setVisible('2', false)}
search={() => this.search()}
tableStore={tableStore}
loading={tableStore.loading}
searchsBaseValue={form.getFormParams().lastname}
condition={toJS(conditionOfAdSearch)}
form={form}
style={'hrm-report-scope'}
linkStyle={'hrm-report-linkStyle-table'}
isNeedReRender={true}
dataIndex={['resourcename', 'olddepartnemtname', 'oldsubcompanyname', 'oldjobtitlename', 'newdepartmentname', 'newjobtitlename', 'hrmname', 'typename', 'deptname', 'jobname']}
colId={['uid', 'departmentid', 'subcompanyid', 'jobid', 'newdepartnemtid', 'newjobid', 'olddepartnemtid', 'oldjobid', 'userid', 'typeid', 'deptid']}
jumpToHrmCard={jumpToHrmCard}
jumpToHrmDept={jumpToHrmDept}
jumpToHrmSubCompany={jumpToHrmSubCompany}
jumpToHrmPost={jumpToHrmPost}
jumpToHrmContract={jumpToHrmContract}
isColIdUnusual={isColIdUnusual}
onSearchChange={ (val) => form.updateFields({lastname: {value:val}})}
/>
)
}
}
}
export default ChangeRelatedReport