Преглед изворни кода

Merge remote-tracking branch 'origin/pro_zn' into dev/new1

# Conflicts:
#	src/components/SpreadDrop/index.jsx
zhouna пре 5 година
родитељ
комит
79aa0d093d

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

@@ -123,13 +123,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>;
     }
     

+ 35 - 7
src/components/SpreadDrop/index.jsx

@@ -2,8 +2,9 @@ import React,{Component} from 'react';
 import classNames from 'classnames';
 import config from '@config/index.js';
 import style from './index.less';
-import {deepClone,filterArr,handleEnter,isIE,windowEventHandler,filterDataArr,getIds} from '@utils/tools.js';
+import {deepClone,filterArr,handleEnter,isIE,windowEventHandler,filterDataArr,getIds,getPageCoordinate} from '@utils/tools.js';
 import {Notify} from '@commonComp';
+import ScrollArea from 'react-scrollbar';
 import $ from 'jquery';
 /****
  * 标签组合下拉,选中的项目展开
@@ -44,9 +45,11 @@ class SpreadDrop extends Component{
       ban:{},  //放'伴'字段
       editable:false,      //双击编辑
       labelVal:'',  //存放标签原有的值--主诉字数限制用
+      left:'auto',
       tmpDom:null
     };
     this.$div = React.createRef();
+    this.$list = React.createRef();
     this.handleSelect = this.handleSelect.bind(this);
     this.clearState = this.clearState.bind(this);
     this.handleClear = this.handleClear.bind(this);
@@ -68,6 +71,12 @@ class SpreadDrop extends Component{
         ++num
       }
     });
+    const listWidth = 30+$(this.$list.current).width();
+    if(num >= 5 && windowWidth-getPageCoordinate(e).boxLeft < listWidth){
+      this.setState({
+        left:windowWidth-listWidth-150
+      })
+    }
     // window.event? window.event.cancelBubble = true : e.stopPropagation();
      this.setStateInit();      //恢复初始选中状态
     const that = this;
@@ -342,7 +351,7 @@ class SpreadDrop extends Component{
 
   render(){
     const {placeholder,value,show,data,order} = this.props;
-    const {tmpDom} = this.state
+    const {tmpDom,left} = this.state
     if(!show&&tmpDom){
       $(tmpDom).parent().prev().attr({"contentEditable":true})
     }
@@ -361,7 +370,7 @@ class SpreadDrop extends Component{
         onInput={this.onChange}
         onkeydown={handleEnter}
         >{value||placeholder}</div>
-          <ListItems data={data} order={order}
+          <ListItems parDiv={this.$list} data={data} order={order} left={left}
              show={show} handleSelect={this.handleSelect} handleConfirm={this.handleConfirm} handleClear={this.handleClear} {...this.state}></ListItems>
       </div>
   }
@@ -370,6 +379,7 @@ class SpreadDrop extends Component{
 class ListItems extends Component{
   constructor(props){
     super(props);
+    this.$cont = React.createRef();
   }
   getLabels(){
     const {data,handleSelect} = this.props;
@@ -398,14 +408,15 @@ class ListItems extends Component{
     return list;
   }
   getStyle(){
-    const {show} = this.props;
+    const {show,left} = this.props;
     return {
-      display:show?'block':'none'
+      display:show?'block':'none',
+      left:left
     }
   }
   render (){
-    const {handleClear,handleConfirm,order} = this.props;
-    return <div className={style["drop-list"]} style={this.getStyle()} contentEditable="false" onClick={(e)=>{e.stopPropagation();}}>
+    const {handleClear,handleConfirm,order,parDiv} = this.props;
+    return <div className={style["drop-list"]} ref={parDiv} style={this.getStyle()} contentEditable="false" onClick={(e)=>{e.stopPropagation();}}>
         <p className={style['orderTips']}>按{order?'从左到右从上到下':'点击'}顺序成文</p>
         {this.getLabels()}
         <div className="oper clearfix">
@@ -474,13 +485,30 @@ class ListItem extends Component{
   render(){
     const {datas,isSpecialPos} = this.props;
     const pos = isSpecialPos?style['independent']:'';
+    const contStyle={
+      opacity:'0.4',
+      right:'0',
+      top:'1px',
+      zIndex:'15',
+      width:'6px',
+      background:'#f1f1f1'};
+    const barStyle={background:'#777',width:'100%'};
     return <ul className={classNames(style['row'],pos)} onBlur={(e)=>e.stopPropagation()}>
+    <ScrollArea speed={0.8}
+    horizontal={false}
+    stopScrollPropagation={true}
+    style={{maxHeight:'330px'}}
+    className={style["area"]}
+    verticalContainerStyle={contStyle}
+    verticalScrollbarStyle={barStyle}
+    contentClassName="content">
       {datas&&datas.map((it,i)=>{
         if(isSpecialPos){
           return <li onClick={(e)=>this.handleClick(e,it,i)} className={this.getClass(it.id)}>{it.name}</li>
         }
         return <li onClick={(e)=>this.handleClick(e,it,i)} className={this.getClass(it.id)} title={it.name.length>8?it.name:''}>{it.name&&it.name.length>8?it.name.slice(0,8)+'...':it.name}</li>
       })}
+      </ScrollArea>
     </ul>;
   }
 }

+ 1 - 1
src/components/SpreadDrop/index.less

@@ -12,7 +12,7 @@
     // width: 200px;
     vertical-align: top;
     margin-left: 8px;
-    max-height: 326px;
+    max-height: 330px;
     overflow-y: auto;
   }
   .independent{

+ 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