Prechádzať zdrojové kódy

常用显示bug修改2788,2785

zhouna 5 rokov pred
rodič
commit
a6fa532c52

+ 2 - 29
src/components/CommonSymptom/index.jsx

@@ -26,7 +26,6 @@ class CommonSymptom extends Component{
     this.handleSelect = this.handleSelect.bind(this);
     this.handleClear = this.handleClear.bind(this);
     this.handleConfirm = this.handleConfirm.bind(this);
-    this.handleOuter = this.handleOuter.bind(this);
   }
   getClass(){
     let isHide = this.props.show?'':style['hide'];
@@ -34,7 +33,7 @@ class CommonSymptom extends Component{
   }
 
   handleSelect(e,item){
-    // e.stopPropagation();
+    e.stopPropagation();
     let {select,ids,conceptId} = this.state;
     const id = item.questionId||item.id; //缓存localStorage中的数据有id
     const copid = item.conceptId
@@ -86,37 +85,11 @@ class CommonSymptom extends Component{
     onSelect&&onSelect({select,ids,conceptId});
   }
 
-  handleOuter(e){
-    e.stopPropagation();
-    let itemBox = $('#mainSuit')[0]; //主诉框
-    if(this.div.current.contains(e.target) || e.target == itemBox){
-      this.setState({
-        hide:false
-      })
-    }else{
-      this.setState({
-        hide:true,
-        select:[],
-        ids:[],
-        conceptId:[]
-      })
-    }
-  }
-
-  componentDidMount() {
-    window.addEventListener('click', this.handleOuter);
-  }
-
-  componentWillUnmount() {
-    window.removeEventListener('click', this.handleOuter);
-  }
-
   render(){ 
     const {data,isCurrent} = this.props;
-    const {hide} = this.state;
     const mainSymp = storageLocal.get('mainSymp');
     const mainHis = mainSymp?JSON.parse(mainSymp).reverse():[];
-    return <div className={this.getClass()} contenteditable="false" style={{'display':hide?'none':'block',left:isCurrent?"auto":undefined}} ref={this.div} onClick={this.handleOuter}>
+    return <div className={this.getClass()} contenteditable="false" style={{left:isCurrent?"auto":undefined}} ref={this.div}>
       <ul className={style["listBox"]}>
         {mainHis.length>0?<ul className={style["his"]}>
           <div className='clearfix'>

+ 4 - 9
src/components/MainSuit/index.jsx

@@ -45,20 +45,18 @@ class MainSuit extends Component{
 
 
   handleFocus(e){
-    //e.stopPropagation();
-    const {getCommonSymptoms,datas,clearDiagnose} = this.props;
+    const {getCommonSymptoms,datas,clearDiagnose,handleShow} = this.props;
     let innerText = e.target.innerText || e.target.innerHTML;//兼容火狐43
     clearDiagnose&&clearDiagnose();//清除复诊数据
     if(!isIE()){//IE会触发onfocus和onblur事件
       if(!innerText.trim()){//有内容就走搜索接口
         getCommonSymptoms && getCommonSymptoms();
+        handleShow&&handleShow({ikey:'common'});
         this.setState({
-          symptom:true,
           inpText:innerText
         })    
       }else{
         this.setState({
-          symptom:false,
           inpText:innerText
         }) 
       }
@@ -68,9 +66,6 @@ class MainSuit extends Component{
       // if(datas.length==0 && !innerText.trim()){
       if(datas.length==0 && innerText == '<br>'){
         getCommonSymptoms && getCommonSymptoms();
-        this.setState({
-          symptom:true
-        })  
       }
     }
     
@@ -272,7 +267,7 @@ class MainSuit extends Component{
       }
   }*/
   render(){
-    const {saveChronic,readMode,type,CommonSymptoms,searchData,fetchPushInfos,isRead,totalHide,handleInput,fuzhen,saveText,editClear,datas,commSymHide} = this.props;
+    const {saveChronic,readMode,type,CommonSymptoms,searchData,fetchPushInfos,isRead,totalHide,handleInput,fuzhen,saveText,editClear,datas,commSymHide,showArr} = this.props;
     const {symptom,boxLeft,boxTop} = this.state;
     const symptomFlag = CommonSymptoms.length>0 ? true : false;
     const searchFlag = searchData.length>0 ? true : false;
@@ -298,7 +293,7 @@ class MainSuit extends Component{
         {''}{datas.length>0?<div style={{display:'inline-block'}}>{this.getInlineTag()}</div>:(saveText[0]?saveText[0]:'')}
       </ItemBox>
       {/*没有推送结果就不显示*/}
-      {symptomFlag && !searchFlag ? <CommonSymptom data={CommonSymptoms} show={!totalHide&&symptom} onSelect={this.handleSelect} /> : ( searchFlag ? <SearchDrop data={searchData} show={!commSymHide} onSelect={this.handleSearchSelect} left={boxLeft1} top={boxTop1} mainEmpty={datas.length==0?true:false}/>:"")}
+      {symptomFlag && !searchFlag&&datas.length===0 ? <CommonSymptom data={CommonSymptoms} show={!totalHide&&showArr['common']} onSelect={this.handleSelect} /> : ( searchFlag ? <SearchDrop data={searchData} show={!commSymHide} onSelect={this.handleSearchSelect} left={boxLeft1} top={boxTop1} mainEmpty={datas.length==0?true:false}/>:"")}
     </div>
   }
 }

+ 3 - 2
src/components/SpreadDrop/index.jsx

@@ -394,9 +394,10 @@ class SpreadDrop extends Component{
   render(){
     const {placeholder,value,show,data,order,type,tagType,pos,defaulted,showVal,CommonSymptoms} = this.props;
     const {tmpDom,left} = this.state;
-    let showDefaulted = this.ifDefault();
+    let showDefaulted = this.ifDefault();console.log(data)
     let showV = showDefaulted&&value===undefined?showVal:value;       //未选中过值时展示默认选中
-    const showCommonData = (+type===2)&&(+tagType===11)&&CommonSymptoms.length>0?true:false;
+    const noPushData = (+tagType===11)&&(!data[1]||data[1].questionDetailList.length===0);    //无推送数据
+    const showCommonData = (+type===2)&&(+tagType===11)&&noPushData&&CommonSymptoms.length>0?true:false;
     if(!show&&tmpDom){
       $(tmpDom).parent().prev().attr({"contentEditable":true})
     }

+ 11 - 2
src/containers/MainSuit.js

@@ -2,7 +2,7 @@ import React from 'react';
 import { connect } from 'react-redux';
 import MainSuit from '@components/MainSuit';
 import {CLEAR_COMSYMPTOMS,SHOW_TAIL,INSERT_MAIN,CLEAR_SEARCH,SET_SEARCH,SAVE_FREE,SET_DATA,INSERT_SEARCH,SETTEXTMODEVALUE,SET_FEATURE,SAVE_CHRONIC,SHOW_HISTORY_BOX,HIDE_HISTORY_BOX} from '@store/types/mainSuit';
-import {RESET,CLICKCOUNT,ISREAD,MODI_LOADING} from '@store/types/homePage.js';
+import {RESET,CLICKCOUNT,ISREAD,MODI_LOADING,SETDROPSHOW} from '@store/types/homePage.js';
 import {getCommSymptoms,getCommSymptomPush} from '@store/async-actions/mainSuit.js'
 import {CLEAR_DIAGNOSE} from '@store/types/diagnosticList';
 import {getSearch,getFeature,autoFillModules} from '@store/async-actions/fetchModules';
@@ -216,7 +216,16 @@ function mapDispatchToProps(dispatch) {
       },
       autoFillModules() {//自动填充模板
         dispatch(autoFillModules())
-      }
+      },
+      handleShow(obj) {
+        dispatch({
+          type:SETDROPSHOW,
+          data:obj
+        });
+        dispatch({
+          type: RESET
+        });
+      },
     }
 }