Ver código fonte

搜索结果下拉滚动条自定义

zhouna 5 anos atrás
pai
commit
e1b21961a8

+ 2 - 2
src/common/components/EditableSpan/index.jsx

@@ -122,13 +122,13 @@ class EditableSpan extends Component{
     const {boxMark,handleClear,handleChange,i} = this.props;
     e.stopPropagation();
     // 延时清空搜索结果,不延时会影响选中
-    clearTimeout(this.state.clearTimer);
+    /*clearTimeout(this.state.clearTimer);
     const clearTimer = setTimeout(function(){
       handleClear && handleClear({boxMark})
     },config.delayTime);
     this.setState({
       clearTimer
-    });
+    });*/
   }
 
   moveEnd(obj) {

+ 2 - 7
src/components/MainSuit/index.jsx

@@ -226,11 +226,6 @@ class MainSuit extends Component{
     if(!isIE()){
       inner?(e.target.innerText=""):(e.target.innerHTML="")
       freeText && freeText(data.trim());
-      // 慢病模板获取:精确匹配"糖尿病复诊",储存慢病字段
-      /*let flg = this.ifClear();
-      if((data.trim()=='糖尿病复诊'||data.trim()=='糖尿病(复诊)'||data.trim()=='糖尿病(复诊)') && !flg){
-        saveChronic && saveChronic({name:'糖尿病',conceptId:21773});
-      }*/
     }else{
       if(datas.length==0){
         const ev = e || window.event;
@@ -240,10 +235,10 @@ class MainSuit extends Component{
       }
     }
     // 延时关闭常见症状下拉、清空搜索结果,不延时会影响选中
-      const clearTimer = setTimeout(function(){
+     /* const clearTimer = setTimeout(function(){
         clearSearch && clearSearch();
         clearTimeout(clearTimer);
-      },config.delayTime-200); 
+      },config.delayTime-200); */
   }
   /*componentWillReceiveProps(nextProps){   //主诉高度变化不会出现滚动内容看不见的情况,因为已经是最顶部,所以可以不必更新滚动条
       const contHeightDiff =  nextProps.data&&this.props.data&&nextProps.data.length!==this.props.data.length;

+ 27 - 0
src/components/SearchDrop/index.jsx

@@ -1,5 +1,6 @@
 import React,{Component} from 'react';
 import classNames from 'classnames';
+import ScrollArea from 'react-scrollbar';
 
 import style from "./index.less";
 /****
@@ -56,24 +57,50 @@ class SearchDrop extends Component{
   render(){
     const {mainEmpty} = this.props;
     let litext = '';
+    const contStyle={
+      opacity:'0.4',
+      right:'0',
+      top:'1px',
+      zIndex:'15',
+      width:'14px',
+      background:'#f1f1f1'};
+    const barStyle={background:'#777',width:'100%'};
     if(mainEmpty){
       return <div className={this.getClass()} id="searchBox" style={this.getStyle()}>
+        <ScrollArea speed={0.8}
+                    horizontal={false}
+                    stopScrollPropagation={true}
+                    style={{maxHeight:'225px'}}
+                    className={style["area"]}
+                    verticalContainerStyle={contStyle}
+                    verticalScrollbarStyle={barStyle}
+                    contentClassName="content">
           <ul>
             {this.props.data&&this.props.data.map((it)=>{
               litext = it.showType==1?it.name:it.name+'('+it.retrievalName+')';
               return <li onClick={(e)=>this.handleSelect(e,it)} title={litext}>{litext}</li>
             })}
           </ul>
+        </ScrollArea>
         </div>
     }else{
       
       return <div className={this.getClass()} id="searchBox" style={this.getStyle()}>
+        <ScrollArea speed={0.8}
+                    horizontal={false}
+                    stopScrollPropagation={true}
+                    style={{maxHeight:'225px'}}
+                    className={style["area"]}
+                    verticalContainerStyle={contStyle}
+                    verticalScrollbarStyle={barStyle}
+                    contentClassName="content">
           <ul>
             {this.props.data&&this.props.data.map((it)=>{
               litext = it.showType==1?it.name:it.name+'('+it.retrievalName+')';
               return <li onClick={(e)=>this.handleSelect(e,it)} title={litext}>{litext}</li>
             })}
           </ul>
+        </ScrollArea>
         </div>;
     }
     

+ 18 - 2
src/modules/HomePage/index.jsx

@@ -5,6 +5,10 @@ import BannerContainer from '@containers/TypeConfigContainer';
 import BodyContainer from "@components/BodyContainer";
 
 import {HIDEDROP,SETMINSCREEN,SETSYSTEMCONFIG} from '@store/types/homePage.js';
+import {CLEAR_SEARCH} from '@types/mainSuit';
+import {CURRENT_CLEAR} from '@types/currentIll';
+import {OTHERHIS_CLEAR} from '@types/otherHistory';
+import {CHECKBODY_CLEAR} from '@types/checkBody';
 import style from './index.less';
 import {getInitModules,getChronic,getSystemConfig} from '@store/async-actions/homePage.js';
 import { getUrlArgObject,parseNameVal } from "@utils/tools";
@@ -15,7 +19,8 @@ class HomePage extends Component {
         super();
         this.state={
             timer:null,
-        }
+        };
+        this.hidePops = this.hidePops.bind(this);
     }
     componentDidMount(){
         const {setWindow,getChronicList,getConfig} = this.props;
@@ -43,9 +48,14 @@ class HomePage extends Component {
             } 
         })
     }
+    hidePops(){
+        const {hideAllDrop,handleClear } = this.props;
+        hideAllDrop();        //隐藏填写单
+        handleClear&&handleClear();       //清空搜索结果
+    }
     render() {
         const {flag} = this.props;
-        return <div className={style['home-page']} onClick={this.props.hideAllDrop}>
+        return <div className={style['home-page']} onClick={this.hidePops}>
             <BannerContainer />
             {/* <InfoTitle /> */}
             <BodyContainer></BodyContainer>
@@ -63,6 +73,12 @@ const mapStateToProps = function (state) {
 };
 const mapDispatchToProps = function (dispatch) {
     return {
+      handleClear(){//清空搜索结果
+           dispatch({type:CLEAR_SEARCH});
+           dispatch({type:CURRENT_CLEAR});
+           dispatch({type:OTHERHIS_CLEAR});
+           dispatch({type:CHECKBODY_CLEAR});
+      },
         hideAllDrop(){
             dispatch({
               type:HIDEDROP