42 lines
1.3 KiB
JavaScript
42 lines
1.3 KiB
JavaScript
|
|
import Add from './add'
|
||
|
|
import { inject, observer} from 'mobx-react';
|
||
|
|
import {WeaAlertPage} from 'ecCom';
|
||
|
|
import {i18n} from '../../public/i18n';
|
||
|
|
|
||
|
|
@inject('hrmAdd')
|
||
|
|
|
||
|
|
@observer
|
||
|
|
class Main extends React.Component {
|
||
|
|
constructor(props) {
|
||
|
|
super(props);
|
||
|
|
}
|
||
|
|
componentDidMount() {
|
||
|
|
const { hrmAdd } = this.props;
|
||
|
|
const departmentid = this.props.location.query.departmentid || '';
|
||
|
|
hrmAdd.departmentid = departmentid;
|
||
|
|
hrmAdd.checkRight();
|
||
|
|
}
|
||
|
|
render() {
|
||
|
|
const { hrmAdd } = this.props;
|
||
|
|
const {verified, hasRight} = hrmAdd;
|
||
|
|
if(window.location.href.indexOf("/spa/hrm/index_mobx.html")>-1){
|
||
|
|
document.title= i18n.module.createResource();
|
||
|
|
}
|
||
|
|
if (verified && hasRight) {
|
||
|
|
return <Add ecId={`${this && this.props && this.props.ecId || ''}_Add@ei0t43`} {...this.props}/>
|
||
|
|
}
|
||
|
|
if (verified && !hasRight) {
|
||
|
|
return (<WeaAlertPage ecId={`${this && this.props && this.props.ecId || ''}_WeaAlertPage@im9are`} >
|
||
|
|
<div style={{color : '#000'}}>
|
||
|
|
{i18n.message.authFailed()}
|
||
|
|
</div>
|
||
|
|
</WeaAlertPage>
|
||
|
|
)
|
||
|
|
}
|
||
|
|
return (
|
||
|
|
<div></div>
|
||
|
|
)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
export default Main;
|