index.jsx 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. import React from "react";
  2. import style from "../index.less";
  3. import check_circle from '../img/check-circle.png';
  4. import check_right from '../img/check-right.png';
  5. import {getStatusImg} from '@utils/tools';
  6. class WrapModalTableSon extends React.Component {
  7. constructor(props) {
  8. super(props);
  9. this.state = {
  10. msg:'选中异常值数据'
  11. }
  12. this.getImgPath = this.getImgPath.bind(this)
  13. this.selectWaring = this.selectWaring.bind(this)
  14. this.allCheckImportIns = this.allCheckImportIns.bind(this)
  15. this.selectOneCheck = this.selectOneCheck.bind(this)
  16. }
  17. selectOneCheck(name,groupName,item){
  18. const {selectOneCheck,allCheck} = this.props
  19. selectOneCheck&&selectOneCheck(name,groupName,item)
  20. setTimeout(() => {
  21. console.log(allCheck,78787)
  22. }, 1000);
  23. }
  24. getImgPath(name,groupName,item){
  25. const { checkedList } = this.props;
  26. let num = 0;
  27. for(let k = 0;k < checkedList.length;k++){
  28. let tmpLis = checkedList[k];
  29. if(tmpLis == name){
  30. return <img className={style.check} onClick={()=>this.selectOneCheck(name,groupName,item)} src={check_right} alt="" />
  31. }else{
  32. ++num
  33. }
  34. }
  35. if(num == checkedList.length){
  36. return <img className={style.check} onClick={()=>this.selectOneCheck(name,groupName,item)} src={check_circle} alt="" />
  37. }
  38. }
  39. selectWaring(){
  40. let tmpMsg = this.state.msg
  41. const { selectWaring,hospitalSonInspect,checkedList,allCheck } = this.props;
  42. // console.log(checkedList)
  43. // let tmpAll = false,num=0;
  44. // if(hospitalSonInspect&&hospitalSonInspect.lisExcelWrapper){
  45. // for(let i = 0;i < hospitalSonInspect.lisExcelWrapper.length;i++){
  46. // for(let j = 0;j < checkedList.length;j++){
  47. // if(hospitalSonInspect.lisExcelWrapper[i].itemName == checkedList[j]&&hospitalSonInspect.lisExcelWrapper[i].type!=0){
  48. // num++
  49. // }
  50. // }
  51. // }
  52. // }
  53. // console.log(num,'sssssssssssssss')
  54. // this.setState({
  55. // msg:(num == 0)?'取消选中异常值数据集':'选中异常值数据'
  56. // },()=>{
  57. // selectWaring&&selectWaring()
  58. // })
  59. this.setState({
  60. msg:tmpMsg=='取消选中异常值数据集'?'选中异常值数据':'取消选中异常值数据集'
  61. })
  62. selectWaring&&selectWaring()
  63. }
  64. allCheckImportIns(){
  65. const { allCheckImportIns,allCheck } = this.props;
  66. if(!allCheck){
  67. this.setState({
  68. msg:'取消选中异常值数据集'
  69. })
  70. }else{
  71. this.setState({
  72. msg:'选中异常值数据'
  73. })
  74. }
  75. allCheckImportIns&&allCheckImportIns()
  76. }
  77. render() {
  78. const { hospitalSonInspect,allCheck } = this.props;
  79. return <div className={style['modalTable']}>
  80. <div className={style.sonTitle}>
  81. <span>组名称 : {hospitalSonInspect.groupName}</span><span className={style.btn} onClick={this.selectWaring}>{this.state.msg}</span>
  82. </div>
  83. <div className={`${style.SonTable}`}>
  84. <table>
  85. <tr className={style.head}>
  86. <td className={`${style.fst}`} onClick={this.allCheckImportIns}><img className={style.check} src={allCheck?check_right:check_circle} alt="" />全选</td>
  87. <td className={`${style.sec}`}>编号</td>
  88. <td className={`${style.trd}`}>项目名称</td>
  89. <td className={`${style.four}`}>结果</td>
  90. <td className={`${style.fif}`}>单位</td>
  91. <td className={`${style.six}`}>参考值</td>
  92. <td className={`${style.sev}`} style={{display:(hospitalSonInspect && hospitalSonInspect.lisExcelWrapper && hospitalSonInspect.lisExcelWrapper.length)>5?'':'none'}}></td>
  93. </tr>
  94. </table>
  95. </div>
  96. <div className={`${style.parentTable} ${style.parentTables} ${style.SonTable}`}>
  97. <table>
  98. {/* {type-0正常1异常2上升3下降} */}
  99. {
  100. hospitalSonInspect && hospitalSonInspect.lisExcelWrapper && hospitalSonInspect.lisExcelWrapper.map((item, idx) => {
  101. return <tr>
  102. <td className={`${style.fst}`}>
  103. {
  104. this.getImgPath(item.itemName,hospitalSonInspect.groupName,item)
  105. }
  106. </td>
  107. <td className={`${style.sec}`}>{idx+1}</td>
  108. <td title={item.itemName} className={`${style.trd}`}>{item.itemName}</td>
  109. <td title={item.value} className={`${style.four}`}>
  110. {
  111. getStatusImg(item.type,item.value,1)
  112. }
  113. </td>
  114. <td title={item.unit} className={`${style.fif}`}>{item.unit}</td>
  115. <td title={`${item.min}-${item.max}`} className={`${style.six}`}>{item.min}-{item.max}</td>
  116. </tr>
  117. })
  118. }
  119. </table>
  120. </div>
  121. </div>
  122. }
  123. }
  124. export default WrapModalTableSon;