Browse Source

化验展开bug

Luolei 6 years ago
parent
commit
0292dbd4b6
1 changed files with 22 additions and 18 deletions
  1. 22 18
      src/components/AddInspect/SlideSelect/index.jsx

+ 22 - 18
src/components/AddInspect/SlideSelect/index.jsx

@@ -36,7 +36,7 @@ class SlideSelect extends Component {
   render() {
   render() {
     const {handleConfirm,changeActivePart,handleDelClick,getItemList,date,item,idx,handleFillShow,showDetails,handleLabelSub,showFill,changeShowFill,handlePush,dateTime,currentIdx,currentData,fillActive,handleShowDate,handleChangeDate} = this.props;
     const {handleConfirm,changeActivePart,handleDelClick,getItemList,date,item,idx,handleFillShow,showDetails,handleLabelSub,showFill,changeShowFill,handlePush,dateTime,currentIdx,currentData,fillActive,handleShowDate,handleChangeDate} = this.props;
     const {show} = this.state;
     const {show} = this.state;
-    let numPlus = 0;
+    let numPlus = 0,numPlus1 = 0;
     return (
     return (
       <li key={item.questionId} className={styles.slideLi}> 
       <li key={item.questionId} className={styles.slideLi}> 
         {
         {
@@ -49,6 +49,14 @@ class SlideSelect extends Component {
                 <i data-flg="current" onClick={(e) => { handleLabelSub(e,item.questionId,idx); handleFillShow(e,idx) }}>{item.name}</i>
                 <i data-flg="current" onClick={(e) => { handleLabelSub(e,item.questionId,idx); handleFillShow(e,idx) }}>{item.name}</i>
             </p>
             </p>
         }
         }
+        
+        {
+          item.details && item.details.map((val)=>{
+            if(val.value && val.value != ''){
+                numPlus = ++numPlus
+              }
+            })
+          }
         {
         {
             item.show ? 
             item.show ? 
                 <table className={styles.table}>
                 <table className={styles.table}>
@@ -65,30 +73,26 @@ class SlideSelect extends Component {
                                 </tr>
                                 </tr>
                             }
                             }
                         })):(item.details.map((val,num)=>{
                         })):(item.details.map((val,num)=>{
-                          if(val.value && val.value != '' && num < 4 ){
-                              return <tr>
-                                  <td style={{width:'30%'}}>{val.name}</td>
-                                  {showDetails(val)}
-                                  <td style={{width:'25%'}}>
-                                      {normalVal(val.minValue,val.maxValue)}
-                                  </td>
-                                  <td style={{width:'25%'}}>{'化验时间:'+item.time}</td>
-                              </tr>
+                          if(val.value && val.value != '' ){
+                              ++numPlus1;
+                              if(numPlus1 < 5){
+                                return <tr>
+                                    <td style={{width:'30%'}}>{val.name}</td>
+                                    {showDetails(val)}
+                                    <td style={{width:'25%'}}>
+                                        {normalVal(val.minValue,val.maxValue)}
+                                    </td>
+                                    <td style={{width:'25%'}}>{'化验时间:'+item.time}</td>
+                                </tr>
+                              }
                           }
                           }
                       }))
                       }))
                     }
                     }
                 </table>:null
                 </table>:null
         }
         }
         {
         {
-          item.details && item.details.length > 5 ?  
+          numPlus > 4 ?  
           <div className={styles.slides} onClick={this.handleSlide}>
           <div className={styles.slides} onClick={this.handleSlide}>
-              {
-                item.details.map((val)=>{
-                  if(val.value && val.value != ''){
-                    numPlus = ++numPlus
-                  }
-                })
-              }
               {
               {
                 show ? <span>收起</span> :<span>剩余<span className={styles.num}>{numPlus-4}</span>项</span>
                 show ? <span>收起</span> :<span>剩余<span className={styles.num}>{numPlus-4}</span>项</span>
               }
               }