import React, {
	Component
} from 'react';
import {
	observer
} from 'mobx-react';
import {
	Row,
	Button
} from 'antd';
import {WeaLocaleProvider} from 'ecCom';
const getLabel = WeaLocaleProvider.getLabel;

@observer
export default class Result extends Component {
	render(){
		const {store: {onBreak, resultMessage, transferCount, toTargetParam, selectedMatrixInfo, selectedTargetInfo, selectedToInfo}} = this.props;
		const {fromtime = '', totime = '', timecount = ''} = resultMessage || {};
		const {valueSpan: matrixName} = selectedMatrixInfo || {};
		const {valueSpan: fromName} = selectedTargetInfo || {};
		const {valueSpan: toName} = selectedToInfo || {};
		const {optflag = 0} = toTargetParam || {};
		let finishedInfo = getLabel(383951, '从{beginTime}开始至{endTime}结束，共用时：{processTime}').replace('{beginTime}', ` <span class='fromtime'>${fromtime}</span> `)
			.replace('{endTime}', ` <span class='totime'>${totime}</span> `)
			.replace('{processTime}', ` <span class='info'>${timecount}${getLabel('501531','秒')}</span> `);
		let analysisInfo = getLabel('509528','共计{param}个单元格的值受影响！').replace('{param}', ` <span class='transferCount'>${transferCount || 0}</span> `)
		return (
			<div className='result'>
                <div className='content'>
					<div className='spinContainer'>
						<div className='complateIcon icon-coms-Upload-successfully'></div>
						<div className='msg'>{getLabel('509527','调整完成！')}</div>
					</div>
					<div className='list'>
						<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@mp2aui`} dangerouslySetInnerHTML={{ __html: finishedInfo}}/>
						<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@g8r467`}>
							<span>{getLabel('34066','矩阵')}：</span>
							<span className='info'>{matrixName || ''}</span>
							{
								optflag == 0 ?
								[
									<span style={{marginLeft: '10px'}}>{fromName || ''}</span>,
									<span className='info'>{getLabel('83020','替换为')}</span>,
									<span>{toName || ''}</span>
								]
								:
								[
									<span className='info' style={{marginLeft: '10px'}}>{getLabel(131966, '删除')}</span>,
									<span>{fromName || ''}</span>,
								]
							}
						</Row>
						<Row ecId={`${this && this.props && this.props.ecId || ''}_Row@nq1n2t`} dangerouslySetInnerHTML={{ __html: analysisInfo}} />
					</div>
					<div className='goBack'>
						<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@dtzcnq`} type='primary' onClick={() => onBreak()}>{getLabel('1290','返回')}</Button>
					</div>
                </div>
            </div>
		)
	}
}