import React from 'react';
import PayrollDetail from "./payrollDetail/index";
import PayrollDetailBp from "./payrollDetailBp/index";
import {message} from "antd";
import {WeaLocaleProvider} from 'ecCom';
const getLabel = WeaLocaleProvider.getLabel;

export default class PayrollDetailEntry extends React.Component {
	constructor(props){
		super(props);
		this.isLessIE11 = false;
		this.params = "";
	}

	componentWillMount() {
		const userAgent = navigator.userAgent;
		this.isLessIE11 = userAgent.indexOf('compatible') > -1 && userAgent.indexOf('MSIE') > -1;

		const {
			params,
			location
		} = this.props, {
			id
		} = params, {
			query
		} = location;

		this.params = {
			targetId:id,
			...query,
		};

		if (this.isLessIE11) {
			message.warning(getLabel(387088,"浏览器版本过低，请升级浏览器版本或者使用其他类型浏览器登录"))
		}
	}

	render() {
		return (
			!this.isLessIE11 ? <PayrollDetail ecId={`${this && this.props && this.props.ecId || ''}_PayrollDetail@znj6xu`} params={this.params}/> : <PayrollDetailBp ecId={`${this && this.props && this.props.ecId || ''}_PayrollDetailBp@h0364v`} params={this.params}/>
		);
	}
}