import React, { Fragment } from 'react';
import {
    inject,
    observer
} from 'mobx-react';
import {
    toJS
} from 'mobx';
import { Top, Authority} from '../../../pc4backstage/hrmengine/public/valhalla/components/index.js';
import '../style/sensitiveWordProcess.less'

@inject("senstiveWordProcessStore")
@observer
export default class SensitiveWordProcess extends React.Component {
	componentWillMount() {
		const {senstiveWordProcessStore: { setId },params:{id}} = this.props;
		setId(id);
	}
    componentWillReceiveProps(nextProps) {
        if (this.props.location.key !== nextProps.location.key) {
            this.init()
        }
    }

    componentDidMount() {
        this.init()
    }

    init = () => {
        const { senstiveWordProcessStore: { init } } = this.props;
        init();
    }


    render() {
        const { senstiveWordProcessStore: { topStore, formStore: { form }, searchGroupProps, authorityStore } } = this.props;

        return (
            <Authority ecId={`${this && this.props && this.props.ecId || ''}_Authority@0nbcjs`} store={authorityStore}>
                <Top ecId={`${this && this.props && this.props.ecId || ''}_Top@h78vuy`} store={topStore}>
                	<div className='sensitiveWordProcess'>
                		{form.render(searchGroupProps)}
                	</div>
                </Top>
            </Authority>
        );
    }
}