瀏覽代碼

填写单、化验添加等弹窗点击滚动条时不关闭2263

zhouna 5 年之前
父節點
當前提交
f5446a4afe

+ 19 - 9
src/components/AddAssistCheck/index.jsx

@@ -36,16 +36,16 @@ class AddAssistCheck extends React.Component {
       let _del = document.getElementById("delBox");   // 删除弹窗
       let _close = document.getElementById("assiClose");   // 删除icon
       let _closeTil = $('#delTit')[0];   // 弹窗标题
-      if (_con && searchWrapAssist != event.target && !_con.is(event.target) && _con.has(event.target).length === 0) { // Mark 1
-        if(this.state.show){
-          this.props.setHighter(48)
+      if(!this.isBar) {//onMousedown的目标为滚动条时,子项弹窗不关闭)
+        if (_con && searchWrapAssist != event.target && !_con.is(event.target) && _con.has(event.target).length === 0) { // Mark 1
+          if (this.state.show) {
+            this.props.setHighter(48)
+          }
+          this.setState({show: false});
+        }
+        if (!_cons.is(event.target) && _cons.has(event.target).length === 0 || event.target.isEqualNode(_close)) { // Mark 1
+          this.setState({date: false});
         }
-        this.setState({ show: false });
-      }
-      if (!_cons.is(event.target) && _cons.has(event.target).length === 0 || event.target.isEqualNode(_close)) { // Mark 1
-        this.setState({ date: false });
-      }
-      
       if(_del){
         if($(event.target).attr('id') != 'assiClose' &&!event.target.isEqualNode(_close) && !event.target.isEqualNode(_del)  && event.target.parentNode != _del && !event.target.isEqualNode(_closeTil)){
           this.setState({
@@ -55,6 +55,16 @@ class AddAssistCheck extends React.Component {
           })
         }
       }
+    }
+    });
+    const that = this;
+    document.addEventListener('mousedown',function(e){
+      //onMousedown的目标为滚动条时,标签填写单不关闭
+      if(e.target.className=='scrollbar'){
+        that.isBar = true;
+      }else{
+        that.isBar = false;
+      }
     });
     getCurrentDate(1);
   }

+ 12 - 3
src/components/AddInspect/index.jsx

@@ -88,7 +88,7 @@ class Inspect extends React.Component {
       let _impClose = $('#impClose')[0];         // 导入删除按钮
       let _addClose = $('#addClose')[0];         // 添加删除按钮
       let _closeTil = $('#delTit')[0];   // 弹窗标题
-      if (searchOption) {
+      if (searchOption&&!this.isBar) {//onMousedown的目标为滚动条时,添加弹窗不关闭
         if (searchOption != event.target && searchWrap != event.target && searchWrap != event.target.parentNode && !$.contains(searchOption, event.target)) { // Mark 1
           if(this.state.show){
             this.props.setHighter(48)
@@ -96,7 +96,7 @@ class Inspect extends React.Component {
           this.setState({ show: false });
         }
       }
-      if (inspectFill) {
+      if (inspectFill&&!this.isBar) {//onMousedown的目标为滚动条时,子项弹窗不关闭
         if ($(event.target).attr('id') != "getSureTime"&&event.target.getAttribute('data-flg') != 'current' && inspectFill != event.target && !$.contains(inspectFill, event.target)) { // Mark 1
           if(this.state.showFill){
             this.props.setHighter(48)
@@ -105,7 +105,7 @@ class Inspect extends React.Component {
         }
       }
 
-      if (_del) {
+      if (_del&&!this.isBar) {//onMousedown的目标为滚动条时,删除弹窗不关闭
         if (!event.target.isEqualNode(_impClose) && !event.target.isEqualNode(_addClose) && !event.target.isEqualNode(_del) && event.target.parentNode != _del && !event.target.isEqualNode(_closeTil)) {
           this.setState({
             id: null,
@@ -114,6 +114,15 @@ class Inspect extends React.Component {
         }
       }
     });
+    const that = this;
+    document.addEventListener('mousedown',function(e){
+      //onMousedown的目标为滚动条时,标签填写单不关闭
+      if(e.target.className=='scrollbar'){
+        that.isBar = true;
+      }else{
+        that.isBar = false;
+      }
+    });
     // this.setState({ dateTime: getCurrentDate(1) })
   }
   componentWillReceiveProps(nextProps) {

+ 10 - 8
src/components/DiagResultSearch/index.jsx

@@ -23,20 +23,22 @@ class DiagResultSearch extends Component {
       var addDiag = $('#addDiag')[0];
       var confirm = $('#confirm')[0];
       if (diagSearch) {
-        if (confirm) {
-
-        } else {
+        if (!confirm&&!that.isBar) {//onMousedown的目标为滚动条时,删除弹窗不关闭
           if (e.target != diagSearch && e.target != addDiag && e.target.parentNode != addDiag && !$.contains(diagSearch, e.target)) {
             that.props.hideSearch();
             that.props.setHighter(48)
           }
-
-
         }
-
       }
-
-    })
+    });
+    document.addEventListener('mousedown',function(e){
+      //onMousedown的目标为滚动条时,标签填写单不关闭
+      if(e.target.className=='scrollbar'){
+        that.isBar = true;
+      }else{
+        that.isBar = false;
+      }
+    });
   }
 
   getSearchList(searchResult) {

+ 16 - 4
src/modules/HomePage/index.jsx

@@ -48,14 +48,26 @@ class HomePage extends Component {
             } 
         })
     }
-    hidePops(){
+    hidePops(e){
         const {hideAllDrop,handleClear } = this.props;
-        hideAllDrop();        //隐藏填写单
-        handleClear&&handleClear();       //清空搜索结果
+    if(!this.isBar){    //onMousrdown的目标为滚动条时,标签填写单不关闭
+      hideAllDrop();        //隐藏填写单
+      handleClear&&handleClear();       //清空搜索结果
     }
+
+    }
+  setElem(e){
+      //onMousedown的目标为滚动条时,标签填写单不关闭
+    if(e.target.className=='scrollbar'){
+      this.isBar = true;
+    }else{
+      this.isBar = false;
+    }
+  }
     render() {
         const {flag} = this.props;
-        return <div className={style['home-page']} onClick={this.hidePops}>
+        return <div className={style['home-page']}
+                    onClick={this.hidePops} onmousedown={this.setElem.bind(this)}>
             <BannerContainer />
             {/* <InfoTitle /> */}
             <BodyContainer></BodyContainer>