import React, {
	Component
} from 'react';
import {
    WeaFormItem,
    WeaNewScroll,
    WeaLocaleProvider
} from 'ecCom';
import {Row, Col} from 'antd';
import { i18n } from '../../../public/i18n';
import '../../../style/checkContent.less';
import map from 'lodash/map';

export default class CheckContent extends Component {
	constructor(props) {
		super(props);
	}

	componentDidMount() {
        $('.ant-confirm-content').css('padding', '0px');
	}

	componentWillReceiveProps(nextProps) {}

	render(){
        const {orgTreeSelectedDatas, selectedFields, type} = this.props;
        let rs = i18n.label.adjustResult().replace('{param1}', `<span className='count'>${orgTreeSelectedDatas.count}</span>`);
        rs = rs.replace('{param2}', i18n.label[type]());
        rs = rs.replace('{param3}', `<span className='count'>${selectedFields.length}</span>`);
        return (
            <WeaNewScroll ecId={`${this && this.props && this.props.ecId || ''}_WeaNewScroll@htwejc`} height={424}>
                <div className='checkContent'>
                    <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@bjkvtt`} className='rowItem checkInfoMsg'>{i18n.confirm.checkAdjust()}</Row>
                    <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@w7lpzd`} className='rowItem rowTitle'>{i18n.label.adjustTarget()}</Row>
                    <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@kr8r3f`} className='rowItem rowTarget' dangerouslySetInnerHTML={{__html: orgTreeSelectedDatas.names.join(',')}}></Row>
                    <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@ema4w6`} className='rowItem rowTitle rowTargetF'>{i18n.label.adjustObject()}</Row>
                    {
                        selectedFields.map((item, index) => {
                            const v = WeaLocaleProvider.formatMultiLang(item.value);
                            
                            return (
                                <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@md353p@${index}`} className='rowItem rowField'>
                                    <WeaFormItem ecId={`${this && this.props && this.props.ecId || ''}_WeaFormItem@sdj9n8@${index}`}
                                        label={item.name}
                                        labelCol={{span: 10}}
                                        wrapperCol={{span: 14}}>
                                        <div className='value' dangerouslySetInnerHTML={{__html: v}}></div>
                                    </WeaFormItem>
                                </Row>
                            )
                        })
                    }
                    <Row ecId={`${this && this.props && this.props.ecId || ''}_Row@vvqc0g`} className='rowItem rowResult' dangerouslySetInnerHTML={{__html: rs}}></Row>
                </div>
            </WeaNewScroll>
        )
	}
}