Bladeren bron

弹出超出bug修改2117

zhouna 5 jaren geleden
bovenliggende
commit
fd1ffc83ca

+ 5 - 2
src/components/CheckBody/index.jsx

@@ -44,7 +44,7 @@ class CheckBody extends Component{
     return false;
   }
   getLabels(){
-    const {data,showArr,saveText,selecteds,importLabel} = this.props;
+    const {data,showArr,saveText,selecteds,importLabel,setHighter} = this.props;
     let arr = [],list=[];
     const {boxMark,showAll} = this.state;
     const moreNum =data.length-[...data].reverse().findIndex((it)=>it.showInCheck)-1;//被隐藏的位置
@@ -60,7 +60,7 @@ class CheckBody extends Component{
     if(showData){
       list = showData;
       arr = list.map((it,i)=>{
-        return chooseType({item:it,boxMark,i,showArr,saveText,selecteds,importLabel});
+        return chooseType({item:it,boxMark,i,showArr,saveText,selecteds,importLabel,setHighter});
       });
     }
     showMoreBtn&&arr.push(more);      //是否显示收起展开按钮
@@ -118,4 +118,7 @@ class CheckBody extends Component{
   }
 }
 
+CheckBody.contextTypes = {
+  scrollArea: React.PropTypes.object
+};
 export default CheckBody;

+ 2 - 2
src/components/EMRContainer/index.jsx

@@ -54,7 +54,7 @@ class EMRContainer extends Component {
         const barStyle={background:'#777',width:'100%',marginLeft:'0'};
         return <div className={style['EMR-container']}
                     ref={this.$cont} id="addScrollEvent">
-          <ScrollArea speed={0.8}
+          <ScrollArea speed={1}
                       horizontal={false}
                       className={style["area"]}
                       verticalContainerStyle={contStyle}
@@ -66,7 +66,7 @@ class EMRContainer extends Component {
                 <CurrentIll></CurrentIll>
                 <OtherHistory></OtherHistory>
                 <div>
-                  <CheckBody></CheckBody>
+                  <CheckBody setHighter={this.setHighter}></CheckBody>
                 </div>
                 <Inspect setHighter={this.setHighter}></Inspect>
                 <AssistCheck setHighter={this.setHighter}></AssistCheck>

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

@@ -2,7 +2,7 @@ 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,getPageCoordinate} from '@utils/tools.js';
+import {setPosition,deepClone,filterArr,handleEnter,isIE,windowEventHandler,filterDataArr,getIds,getPageCoordinate} from '@utils/tools.js';
 import {Notify} from '@commonComp';
 import ScrollArea from 'react-scrollbar';
 import $ from 'jquery';
@@ -63,7 +63,7 @@ class SpreadDrop extends Component{
   }
   handleShow(e){//单击
     e&&e.stopPropagation();
-    const {ikey,handleShow,placeholder,flag,id,value,tagType,type,data,windowWidth} = this.props;
+    const {ikey,handleShow,placeholder,flag,id,value,tagType,type,data,windowWidth,setHighter} = this.props;
     let num = 0;//判断为五类切超出页面
     data && data.map((item)=>{
       if(item.formPosition != 1){
@@ -76,6 +76,8 @@ class SpreadDrop extends Component{
         left:windowWidth-listWidth-150
       })
     }
+    //高度超出时,增加左侧大容器padding
+    setPosition(e,this.$list.current,setHighter);
     // window.event? window.event.cancelBubble = true : e.stopPropagation();
      this.setStateInit();      //恢复初始选中状态
     const that = this;
@@ -342,7 +344,12 @@ class SpreadDrop extends Component{
       },this);
     }
   }
-
+  /*componentWillReceiveProps(nextProps){
+    const {setHighter} = this.props;
+    if(!nextProps.show){console.log(22)
+      setHighter&&setHighter(48);
+    }
+  }*/
   render(){
     const {placeholder,value,show,data,order} = this.props;
     const {editable,left} = this.state;

+ 2 - 1
src/containers/eleType.js

@@ -129,11 +129,12 @@ function multLabels(params){
 //多选标签展开型
 function multCheckLabels(params,tagType){
   const data = params.item;
-  const {i,boxMark,showArr,selecteds,importLabel} = params;
+  const {i,boxMark,showArr,selecteds,importLabel,setHighter} = params;
   let isHigh=importLabel&&importLabel.includes(data.id);
   const showInx = boxMark+"-"+i+'-0';
   return <SpreadDrop data={data.questionMapping}
                      ikey={showInx}
+                     setHighter={setHighter}
                      placeholder={data.name}
                      value={data.value}
                      copyType={data.copyType}

+ 2 - 0
src/utils/tools.js

@@ -1378,6 +1378,8 @@ function setPosition (e,dom,setHighter){
     // console.log(wrapHt,clickHt,scrollHt,btmHt,contHt)
     if(btmHt<contHt){
       setHighter(contHt-btmHt+20);
+    }else{
+      setHighter&&setHighter(48);       //标签填写单连续点击弹出,未超出需要恢复
     }
     // $(e.target)[0].scrollIntoView(true);
   },10);