import React from 'react';
import {
inject,
observer
} from 'mobx-react';
import {
WeaTop,
WeaTab,
WeaOrgTree,
WeaLeftRightLayout,
WeaEchart,
WeaYear,
WeaDialog,
WeaPopoverHrm,
WeaRightMenu,
WeaTools,
WeaErrorPage,
WeaAlertPage,
WeaDatePicker,
WeaBrowser,
WeaNewScroll
} 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 * as mobx from 'mobx';
import isEmpty from 'lodash/isEmpty';
import cloneDeep from 'lodash/cloneDeep';
import toString from 'lodash/toString';
import moment from 'moment';
import debounce from 'lodash/debounce'
import * as Util from '../util/index';
import {
win32
} from 'path';
import {
i18n
} from '../public/i18n';
import {
WeaLocaleProvider
} from 'ecCom';
const getLabel = WeaLocaleProvider.getLabel;
const toJS = mobx.toJS;
@inject('hrmOldChecking')
@observer
class main extends React.Component {
constructor(props) {
super(props);
this.state = {
iWidth: window.innerWidth,
oHeight: 300
}
if (window.innerHeight > 850) {
this.state.oHeight = 450;
} else if (window.innerHeight > 600) {
this.state.oHeight = window.innerHeight / 2 - 100;
} else {
this.state.oHeight = 200;
}
const {
hrmOldChecking
} = this.props;
hrmOldChecking.init();
}
componentDidMount() {
const {
hrmOldChecking
} = this.props;
hrmOldChecking.hrmId = this.props.params.hrmId || '';
this.getData();
hrmOldChecking.getHrmNewWorkflwList();
//document.title = hrmOldChecking.title;
//窗口大小变化
jQuery(window).resize(() => {
this.setState({
iWidth: window.innerWidth
})
});
}
componentWillReceiveProps(nextProps) {
const {
hrmOldChecking
} = this.props;
if (this.props.location.key !== nextProps.location.key) {
hrmOldChecking.init();
this.getData();
}
}
getData = () => {
const {
hrmOldChecking
} = this.props;
const {
tabkey
} = hrmOldChecking;
hrmOldChecking.getData(() => {
tabkey == 1 && this.refs.chart && this.refs.chart.paint();
});
}
getRightMenu = () => {
const {
hrmOldChecking
} = this.props;
let btns = [];
btns.push({
key: "add",
icon: ,
content: getLabel('385037', "新建考勤流程"),
onClick: key => {
this.addChecking();
}
});
return btns;
}
addChecking = () => {
const {
hrmOldChecking
} = this.props;
hrmOldChecking.updateNewVisible(true);
}
getTopButtons = () => {
const {
hrmOldChecking
} = this.props;
let btns = [];
btns.push(
);
return btns;
}
chooseUser = (e) => {
const {
hrmOldChecking
} = this.props;
let hrmId = '',
hrmName = undefined;
if (e.selected) {
hrmId = e.node.props.id;
hrmName = e.node.props.name;
}
if (hrmId) {
hrmOldChecking.updateHrmId(hrmId);
if (hrmName) hrmOldChecking.updateHrmName(hrmName);
this.getData();
}
}
changeUserRoot = (ids, names, datas) => {
const {
hrmOldChecking
} = this.props;
hrmOldChecking.updateUserRoot(datas);
}
resetUserRoot = () => {
const {
hrmOldChecking
} = this.props;
hrmOldChecking.updateUserRoot();
hrmOldChecking.updateHrmId();
hrmOldChecking.updateHrmName();
this.getData();
}
changeTab = (key) => {
const {
hrmOldChecking
} = this.props;
hrmOldChecking.changeTabHandler(key);
this.getData();
}
changeDateTab = (key) => {
const {
hrmOldChecking
} = this.props;
hrmOldChecking.changeDateTabHandler(key);
this.getData();
}
reFresh = () => {
const {
hrmOldChecking
} = this.props;
this.getData();
}
changeDate = (v) => {
const {
hrmOldChecking
} = this.props;
const {
dateTabkey
} = hrmOldChecking;
if (dateTabkey == '2') {
v = new moment(v).format('YYYY-MM');
} else {
v = new moment(v).format('YYYY');
}
hrmOldChecking.changeDateHandler(v);
this.getData();
}
handlerStatusClick = (item) => {
const {
hrmOldChecking
} = this.props;
hrmOldChecking.handlerStatusClick(item.type);
}
renderLeft = () => {
const {
hrmOldChecking
} = this.props;
const {
oHeight
} = this.state;
let {
tabkey,
leftTitle,
userRoot
} = hrmOldChecking;
userRoot = toJS(userRoot);
const hrmId = this.props.params.hrmId || '';
let org =