weaver_trunk_cli/pc4mobx/hrmAttendance/components/Home.js

81 lines
2.4 KiB
JavaScript

import {
WeaPopoverHrm,
WeaLocaleProvider
} from 'ecCom';
import loadjs from 'loadjs';
import {
WeaLogView
} from 'comsMobx';
import {
isEnableMultiLang
} from '../apis/common';
const WeaLogViewComp = WeaLogView.Component;
const {
LogStore
} = WeaLogView;
class Home extends React.Component {
constructor(props) {
super(props);
this.state = {
key: new Date().getTime(),
visible: false,
logStore: new LogStore(),
logType: '4',
logSmallType: '',
// comsLoaded: false
}
window.setLogViewProps = this.setLogViewProps;
}
componentDidMount() {
isEnableMultiLang().then(data => {
window.inputType = {
inputType: 'NORMAL'
}
if (data.status === '1') {
if (data.isEnableMultiLang) {
window.inputType = {
inputType: 'MULTILANG',
isBase64: true
}
}
}
}, error => {
window.inputType = {
inputType: 'NORMAL'
}
});
// loadjs.isDefined('hrmComs') ? loadjs.ready('hrmComs', () => this.setState({comsLoaded: true})) : loadjs(["/spa/hrm/static4coms/hrmComs.js", "/spa/hrm/static4coms/hrmComs.css"], 'hrmComs', () => this.setState({comsLoaded: true}));
}
setLogViewProps = (props) => {
this.setState({
key: new Date().getTime(),
targetId: '',
visible: true,
logType: '4',
logStore: new LogStore(),
...props
});
}
onCancel = () => {
this.setState({
visible: false
})
}
render() {
return (
<div style={{height:"100%"}}>
<WeaPopoverHrm ecId={`${this && this.props && this.props.ecId || ''}_WeaPopoverHrm@m3tbok`} />
<WeaLogViewComp ecId={`${this && this.props && this.props.ecId || ''}_WeaLogViewComp@bhzfu0`} {...this.state} onCancel={this.onCancel}/>
<WeaLocaleProvider ecId={`${this && this.props && this.props.ecId || ''}_WeaLocaleProvider@dbokoh`}>
{/* {this.state.comsLoaded && this.props.children} */}
{this.props.children}
</WeaLocaleProvider>
</div>
)
}
}
export default Home