import React, { Component } from "react";
import style from "../index.less";
import { Radio} from '@commonComp';
/****
 * 大数据推送出的类型
 * 要素：名称、选项、推荐选择
 *
 * ****/
class ChooseItem extends Component {
  constructor(props) {
    super(props)
  }
  render() {
    const {title,data  } = this.props;
    return <div className={style['assess-item']}>
        <h2>{title}</h2>
        <div className={style['item-content']}>
          <ul>
            {data&&data.map((it)=>{
              return <li>
                <span>{it.name}：</span>
                <div className={style['row']}>
                  {it.details&&it.details.map((i)=> {
                    if(it.controltype ==1){
                      return <div className={style['choose-item']}><Radio name={i.detailName} value={i.detailName} handleClick={null}></Radio>{i.state?<i>（智能推荐）</i>:''}</div>;
                    }else{
                      return <span className={style['choose-item']}>
                                <input id={i.detailName} value={i.detailName} name={it.name} type="checkbox" />
                                <label htmlFor={i.detailName}>{i.detailName}</label>
                                {i.state?<i>（智能推荐）</i>:''}
                              </span>;
                    }
                  })}
                </div>
                {/*<div className={style["recommend"]}>
                  推荐选择：正常
                </div>*/}
              </li>
            })}
          </ul>
        </div>
      </div>;
  }
}

export default ChooseItem;