import React from "react";
import style from "../index.less";

class WrapModalTable extends React.Component {
  constructor(props) {
    super(props)
  }
  
  shouldComponentUpdate(nextProps,nextState){
    if(JSON.stringify(nextProps.hospitalInspect) == JSON.stringify(this.props.hospitalInspect)){
      return false
    }
    return true
  }
  render() {
    const { hospitalInspect, handleGetSonList } = this.props;
    return <div className={style['modalTable']}>
      <div className={style.tablePubP}>
        <table>
          <tr className={style.head}>
            <td className={`${style.fst} ellipsOver`}>编号</td>
            <td className={`${style.sec} ellipsOver`}>标本类型</td>
            <td className={`${style.trd} ellipsOver`}>组名称</td>
            <td className={`${style.four} ellipsOver`}>送检医生</td>
            <td className={`${style.fif} ellipsOver`}>送检时间</td>
            <td className={`${style.six} ellipsOver`}>报告时间</td>
            <td className={`${style.sev} ellipsOver`} style={{ display: hospitalInspect.length > 5 ? '' : 'none' }}></td>
          </tr>
        </table>
      </div>
      <div className={`${style.parentTable} ${style.tablePubP}`}>
        <table>
          {
            hospitalInspect && hospitalInspect.map((item, idx) => {
              return <tr onClick={() => handleGetSonList(item.groupName,item.reportTime)}>
                <td className={`${style.fst} ellipsOver`}>{idx + 1}</td>
                <td title={item.specimenType} className={`${style.sec} ellipsOver`}>{item.specimenType}</td>
                <td title={item.groupName} className={`${style.trd} ellipsOver`}>{item.groupName}</td>
                <td title={item.inspectDoctor} className={`${style.four} ellipsOver`}>{item.inspectDoctor}</td>
                <td title={item.inspectTime} className={`${style.fif} ellipsOver`}>{item.inspectTime}</td>
                <td title={item.reportTime} className={`${style.six} ellipsOver`}>{item.reportTime}</td>
              </tr>
            })
          }
        </table>
      </div>
    </div>
  }
}

export default WrapModalTable;
