weaver_trunk_cli/pc4mobx/hrm/components/add/index.js

42 lines
1.3 KiB
JavaScript
Raw Normal View History

2024-12-11 15:32:14 +08:00
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;