Jelajahi Sumber

弹窗拖拽,化验项灰色显示,右侧推送化验到左侧显示bug,先推送数据有误,待验证

Luolei 6 tahun lalu
induk
melakukan
7bf2694e36

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

@@ -185,9 +185,9 @@ class EditableSpan extends Component{
         obj.focus();
       }
     }
-    ele = document.activeElement;
-    boxTop = target.innerText?getPageCoordinate(e).boxTop:$(ele).offset().top+30;
-    setSearchLocation(boxTop,ele.offsetLeft)     //搜索框的位置动态获取
+    // ele = document.activeElement;
+    // boxTop = target.innerText?getPageCoordinate(e).boxTop:$(ele).offset().top+30;
+    // setSearchLocation(boxTop,ele.offsetLeft)     //搜索框的位置动态获取
   }  
   handleKeyup(e){
     const {boxMark,handleKeydown,i,value,removeId,handleClear,delSingleLable,setSearchLocation} = this.props;

+ 1 - 1
src/common/components/InspectCommon/index.jsx

@@ -16,7 +16,7 @@ class InspectCommon extends React.Component {
             {children}
             <div className={style.btnWrap}>
                 <span className={style.clear + ' red'} onClick={handleClear}>清空选项</span>
-                <span className={style.sure} onClick={handleConfirm}>确 定</span>
+                <span className={style.sure} onClick={handleConfirm}>确定</span>
             </div>
         </div>
     }

+ 3 - 1
src/common/components/InspectCommon/index.less

@@ -24,10 +24,12 @@
     .sure {
         float: right;
         color: @blue;
-        border: 1px solid @blue;
+        font-weight: bold;
     }
     .clear {
         float: left;
+        // font-weight: bold;
+        bottom: 0;
     }
 }
 

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

@@ -31,7 +31,7 @@ class SlideExcel extends Component {
     })
   }
   render() {
-    const {items,item,idx} = this.props;
+    const {items,item,idx,dateTime} = this.props;
     const {show} = this.state;
     return (
       <li className={styles.excelDataLis} style={{border:items.lisExcelRes.length-1 == idx? 0:''}}>
@@ -46,7 +46,7 @@ class SlideExcel extends Component {
                       <td style={{width:'25%'}}>
                           {normalVal(value.min,value.max)}
                       </td>
-                      <td style={{width:'25%'}}>{value.time == ''?('导入时间: '+this.state.dateTime):'化验时间: '+this.toTime(value.time)}</td>
+                      <td style={{width:'25%'}}>{value.time == ''?('导入时间: '+dateTime):'化验时间: '+this.toTime(value.time)}</td>
                   </tr>
                 })):(item.lisExcelItem && item.lisExcelItem.map((value,idx)=>{
                   if(idx < 4){
@@ -56,7 +56,7 @@ class SlideExcel extends Component {
                         <td style={{width:'25%'}}>
                             {normalVal(value.min,value.max)}
                         </td>
-                        <td style={{width:'25%'}}>{value.time == ''?('导入时间: '+this.state.dateTime):'化验时间: '+this.toTime(value.time)}</td>
+                        <td style={{width:'25%'}}>{value.time == ''?('导入时间: '+dateTime):'化验时间: '+this.toTime(value.time)}</td>
                     </tr>
                   }
                 }))

+ 1 - 0
src/components/AddInspect/index.less

@@ -118,6 +118,7 @@
     margin-bottom: 5px;
     border-top: 1px solid #EAEDF1;
     overflow: hidden;
+    box-sizing: border-box;
 }
 .itemPart {
     height: 28px;

+ 7 - 3
src/components/PreviewBody/index.jsx

@@ -3,6 +3,7 @@ import style from "./index.less";
 import { normalVal, filterDataArr, filterOtherDataArr,timestampToTime } from '@utils/tools';
 import Notify from '@commonComp/Notify';
 import $ from "jquery";
+import { relative } from "path";
 
 (function ($) {
   var opt;
@@ -235,9 +236,12 @@ class PreviewBody extends Component {
               }
               {
                 dataJson.lis.labelList && dataJson.lis.labelList.map((item, idx) => {
-                  if (item.show) {
+                  // if (item.show) {
                     return <table style={{ margin: '8px 0', width: '100%' }}>
-                      <tr style={{ fontSize: '14px', lineHeight: '1.5' }}><td><span style={{ borderBottom: '1px solid #666666' }}>{item.name}</span></td></tr>
+                      {
+                        item.show?<tr style={{ fontSize: '14px', lineHeight: '1.5' }}><td><span style={{ borderBottom: '1px solid #666666' }}> {item.name} </span></td></tr>:
+                        <tr style={{ fontSize: '14px', lineHeight: '1.5' }}><td><span style={{ color: '#767676',position:'relative',left:'-10px' }}>「{item.name}」</span></td></tr>
+                      }
                       {
                         item.details.map((val) => {
                           if (val.value && val.value != '') {
@@ -253,7 +257,7 @@ class PreviewBody extends Component {
                         })
                       }
                     </table>
-                  }
+                  // }
                 })
               }
             </td>

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

@@ -78,12 +78,17 @@ class PushItems extends Component {
       value:''
     }
     if(checkedAssay.length > 0){
-      let assayArr = []
+      let assayArr = [],tmpDetail=[]
       for(let i = 0;i < checkedAssay.length;i++){
         let tmpObj = JSON.parse(JSON.stringify(obj));
+        if (checkedAssay[i].controlType == 0) {
+          tmpDetail = checkedAssay[i].questionMapping
+        }else if(checkedAssay[i].controlType == 1 || checkedAssay[i].controlType == 6){
+          tmpDetail.push(checkedAssay[i])
+        }
         tmpObj.questionId = checkedAssay[i].id
         tmpObj.name = checkedAssay[i].name
-        tmpObj.details = checkedAssay[i].questionMapping
+        tmpObj.details = tmpDetail
         assayArr.push(tmpObj)
       }
       store.dispatch(addLabel(assayArr))

+ 17 - 62
src/components/Treat/index.jsx

@@ -3,6 +3,7 @@ import style from './index.less';
 import GeneralTreat from './GeneralTreat/index.jsx';
 import DrugTreat from './DrugTreat/index.jsx';
 import TreatDesc from '@components/TreatDesc'
+import {dragBox,windowRemoveEventHandler} from '@utils/tools'
 import DrugInfo from '@components/TreatDesc/DrugInfo';
 import Notify from '@commonComp/Notify'
 import close from './img/close.png';
@@ -13,70 +14,23 @@ import $ from "jquery";
 class Treat extends Component {
     constructor(props){
         super(props);
+        this.state = {
+          zIndex:301
+        }
         this.hideTreat = this.hideTreat.bind(this);
         this.handlePrescription = this.handlePrescription.bind(this);
         this.handleDetermine = this.handleDetermine.bind(this);
+        this.setTreatBox = this.setTreatBox.bind(this);
     }
     componentDidMount(){
-        let wrap = document.getElementById('treatWrapper')
-        let drag = document.getElementById('dragTreatTitle')
-        let width = $(window).width();
-        let height = $(window).height();
-        let mouseX = 0,mouseY = 0,dragX = 0,dragY = 0,isDrag = false,isMove = false;
-        
-        let maxDragX = width - wrap.offsetWidth
-        let maxDragY = height - wrap.offsetHeight
-        drag.onmousedown = (event)=>{    //鼠标位置获取,计算点击位置到拖拽元素左边的距离
-          let e = event || window.event;
-          mouseX = e.pageX - wrap.offsetLeft
-          mouseY = e.pageY - wrap.offsetTop
-          isDrag = true
-        }
-        document.onmousemove = (event)=>{      //移动的
-          let e = event || window.event;
-          if(isDrag){
-            dragX = e.pageX - mouseX
-            dragY = e.pageY - mouseY
-            if(dragX < 0){      //不能超出左边界
-              dragX = 0
-            }
-            if(dragY < 0){      //不能超出上边界
-              dragY = 0
-            }
-            // if(wrap.offsetLeft >= maxDragX){
-            //   dragX = maxDragX
-            // }else{
-            //   dragX = e.pageX - mouseX
-            // }
-
-            // if(height-drag.offsetHeight > wrap.offsetTop){
-            //   dragY = height-drag.offsetHeight
-            // }
-            isMove = true
-            wrap.style.left = dragX + 'px'
-            wrap.style.marginLeft = 0 + 'px'
-            wrap.style.top = dragY + 'px'
-          }
-        }
-        document.onmouseup = ()=>{
-          if(isMove){
-            wrap.style.left = dragX + 'px'
-            wrap.style.top = dragY + 'px'
-          }else{
-            wrap.style.left = '50%'
-            wrap.style.top = '10%'
-            wrap.style.marginLeft = '-340px'
-          }
-          isDrag = false
-          return false
-        }
+      dragBox('treatWrapper','dragTreatTitle')
     }
+    
     hideTreat() {
         const { hideTreat,clearTreat } = this.props;
         clearTreat && clearTreat();
         hideTreat && hideTreat();
-        // document.onmousemove = null
-        // document.onmouseup = null
+        // windowRemoveEventHandler('mousemove',handleMove,document)
     }
     handlePrescription() {
         Notify.info('该功能即将上线,敬请期待。', 2000)
@@ -91,16 +45,21 @@ class Treat extends Component {
         const {  showDrugInfo } = this.props;
         showDrugInfo && showDrugInfo();
     }
-
+    setTreatBox(idx){
+      this.setState({
+        zIndex:idx == 300?300 : 500
+      })
+    }
     render(){
         const { generalTreat, treatment, treatItem, surgeryTreat, selectDrug, drugInfo, treatDesc, setOtherRecommend, setDrugInfo, showDrug, showDrugInfo,hideDrugInfo, title, drugInfoList, hideDrugInfoMore} = this.props;
         const { setDrugInfoMore } = this.props
+        const { zIndex } = this.state
         return(
             <div   className={style['treat-wrapper']}>
                 <div className={style['treat-mask']} onClick={this.hideTreat}>
                 </div>
-                <div id="treatWrapper" className={style['treat-box']}  onselectstart="return false">
-                    <div id="dragTreatTitle" className={style['treat-title']}>治疗方案 ({treatItem.name})<img onClick={this.hideTreat} src={close}/></div>
+                <div id="treatWrapper" className={style['treat-box']}  onselectstart="return false" style={{zIndex:zIndex}}>
+                    <div onMouseDown={this.setTreatBox} id="dragTreatTitle" className={style['treat-title']}>治疗方案 ({treatItem.name})<img onClick={this.hideTreat} src={close}/></div>
 
                     <div className={style['treat-inner-box']}>
                         <GeneralTreat icon={generalIcon} title='一般治疗'   generalTreat={generalTreat}></GeneralTreat>
@@ -128,14 +87,10 @@ class Treat extends Component {
                     </TreatDesc>}
                 </div>
                 
-                
-                {showDrug && drugInfo && <DrugInfo drugInfo = {drugInfo} hideDrugInfo = {hideDrugInfo}></DrugInfo>}
+                {showDrug && drugInfo && <DrugInfo setTreatBox={this.setTreatBox} drugInfo = {drugInfo} hideDrugInfo = {hideDrugInfo}></DrugInfo>}
                 {/* 查询多个药品说明书 (添加数据查看药品说明书用)*/}
                 {/* {showDrug && <DrugInfo drugInfoList = {drugInfoList} hideDrugInfoMore = {hideDrugInfoMore}></DrugInfo>} */}
             </div>
-                
-            
-        
         )
     }
 }

+ 17 - 10
src/components/TreatDesc/DrugInfo/index.jsx

@@ -2,14 +2,20 @@ import React, { Component } from 'react';
 import style from './index.less';
 import close from './../img/close.png';
 import $ from "jquery";
+import {dragBox} from '@utils/tools'
 
 
 class DrugInfo extends Component {
     constructor(props) {
         super(props);
         this.state = {
-            currentIndex: 0
+            currentIndex: 0,
+            zIndex:301
         }
+        this.setDragBox = this.setDragBox.bind(this)
+    }
+    componentDidMount(){
+      dragBox('drugWrapper','drugTitle')
     }
     handleClickMenu(index, item, drugDesc) {
         const that = this
@@ -40,12 +46,18 @@ class DrugInfo extends Component {
             }
         }
     }
-
+    setDragBox(){
+      const {zIndex,setTreatBox} = this.props
+      setTreatBox(300)
+      this.setState({
+        zIndex:zIndex+10
+      })
+    }
     render() {
         const { drugInfo, hideDrugInfo, drugInfoList,hideDrugInfoMore } = this.props
-        const { currentIndex } = this.state
-        return (<div className={style['drug-info-wrapper']}>
-                <h3 className={style['drug-title']}>{drugInfo.title}说明书  <img src={close} onClick={hideDrugInfo} className={style['close-drug-desc']}/> </h3>
+        const { currentIndex,zIndex } = this.state
+        return (<div className={style['drug-info-wrapper']} id="drugWrapper" style={{zIndex:zIndex}}>
+                <h3 onMouseDown={this.setDragBox} id="drugTitle" className={style['drug-title']}>{drugInfo.title}说明书  <img src={close} onClick={hideDrugInfo} className={style['close-drug-desc']}/> </h3>
                 { drugInfo && drugInfo.drugDesc.length > 0 && <div className={style['drug-desc-wrapper']} id='drugDesc' onScroll={this.handleScrollModal.bind(this,  drugInfo.drugDesc)}>
                     <div className={style['drug-title1']} >{drugInfo.title}说明书</div>
                     {drugInfo.drugDesc.map((item, index) =>{
@@ -55,7 +67,6 @@ class DrugInfo extends Component {
                         </div>
                     })}
                     <div className={style['content-menu-box']}>
-                        
                         <div className={style['content-menu']}>
                             {drugInfo.drugDesc.map((item, index) => {
                                 return (<div >
@@ -67,18 +78,14 @@ class DrugInfo extends Component {
                                     </div>
                                 </div>)
                             })}
-
                         </div>
-                    
                     </div>
                 </div> }
                 { !drugInfo || (drugInfo && drugInfo.drugDesc.length === 0) && <div className={style['drug-desc-wrapper']}>
                     <div>
                         该药品暂无说明
                     </div>
-                    
                 </div> }
-
         </div>)
 
 

+ 8 - 0
src/components/TreatDesc/DrugInfo/index.less

@@ -24,6 +24,14 @@
     line-height: 40px;
     padding: 0 40px;
     border-bottom: 1px solid #979797;
+    cursor: move;
+    moz-user-select: -moz-none;
+    -moz-user-select: none;
+    -o-user-select:none;
+    -khtml-user-select:none;
+    -webkit-user-select:none;
+    -ms-user-select:none;
+    user-select:none;
 }
 .close-drug-desc {
     position: absolute;

+ 2 - 1
src/store/actions/diagnosticList.js

@@ -55,7 +55,7 @@ export const getDiagnosticStr = (state, action) => {
     let diagnosticStrNoType = ''
     for (let i = 0; i < diagnosticList.length; i++) {
         diagnosticStr = diagnosticStr + diagnosticList[i].name + '(' + getDiagType(diagnosticList[i].type) + '); '
-        diagnosticStrNoType = diagnosticStrNoType + diagnosticList[i].name + ';'
+        diagnosticStrNoType = diagnosticStrNoType + diagnosticList[i].name + ','
     }
     res.diagnosticStrNoType = diagnosticStrNoType
     res.diagnosticStr = diagnosticStr
@@ -67,6 +67,7 @@ export const setDiagToMainSuit = (state, action) => {
     res.mainSuitStr = action.data;
     return res;
 }
+
 export const clearAllDiag = (state, action) => {
     const res = Object.assign({}, state);
     res.diagnosticList = action.data

+ 2 - 2
src/utils/config.js

@@ -1,7 +1,7 @@
 // const host='http://192.168.3.100:5050';//王峰
 // const host='http://192.168.3.101:5050';//任国宾
-// const host='http://192.168.2.241:5050';//后端接口访问地址
-const host='http://192.168.2.236:5050';//后端接口访问地址
+const host='http://192.168.2.241:5050';//后端接口访问地址
+// const host='http://192.168.2.236:5050';//后端接口访问地址
 //const host='http://192.168.2.164:8080';
 // const host='http://192.168.3.117:8080'; //周铁刚
 // const newIcssVisitUrl = '223.93.170.82:13000';    //icss服务访问地址(跳转目的地),不能加http://

+ 67 - 1
src/utils/tools.js

@@ -693,6 +693,70 @@ function timestampToTime(timestamp) {     //excel导入2019年5月1日会转换
   var s = date.getSeconds();
   return Y+M+D+h+m+s;
 }
+function getPageLength(event) {     //兼容ie8获取页面距离左和上的距离,包括滚动距离
+  let e = event || window.event;
+  let scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; 
+  let scrollY = document.documentElement.scrollTop || document.body.scrollTop; 
+  let x = e.pageX || e.clientX + scrollX; 
+  let y = e.pageY || e.clientY + scrollY;
+  let page = {
+    pageX:x,
+    pageY:y
+  }
+  return page;
+}
+function dragBox(domWrap,domDrag){
+  let wrap = document.getElementById(domWrap);//呗拖拽的元素
+  let drag = document.getElementById(domDrag);//拖拽区域
+  let width = window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;//屏幕宽度
+  let height = window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;//屏幕高度
+  let mouseX = 0,mouseY = 0,dragX = 0,dragY = 0,isDrag = false,isMove = false;
+  let maxDragX = width - wrap.offsetWidth;//最大可推拽x方向距离
+  let maxDragY = height - wrap.offsetHeight;//最大可拖拽y方向距离
+  windowEventHandler('mousedown',(event)=>{    //鼠标位置获取,计算点击位置到拖拽元素左边的距离
+    wrap = document.getElementById(domWrap);
+    drag = document.getElementById(domDrag);
+    let page = getPageLength(event);
+    mouseX = page.pageX - wrap.offsetLeft      //鼠标到拖拽元素的左边界的距离
+    mouseY = page.pageY - wrap.offsetTop       //鼠标到拖拽元素的上边界的距离
+    isDrag = true
+  },drag)
+  // windowEventHandler('mousemove',handleMove,document)
+  windowEventHandler('mousemove',(event)=>{      //移动的
+    let page = getPageLength(event);
+    if(isDrag){
+      dragX = page.pageX - mouseX          //鼠标可拖拽到左边的最大距离
+      dragY = page.pageY - mouseY          //鼠标可拖拽到上边的最大距离
+      if(dragX < 0){      //不能超出左边界
+        dragX = 0
+      }
+      if(dragY < 0){      //不能超出上边界
+        dragY = 0
+      }
+      if(width-dragX < wrap.offsetWidth){    //不能超出右边界
+        dragX = maxDragX
+      } 
+      if(height-dragY < wrap.offsetHeight){     //不能超出下边界
+        dragY = maxDragY
+      }
+      isMove = true
+      wrap.style.left = dragX + 'px'
+      wrap.style.marginLeft = 0 + 'px'
+      wrap.style.top = dragY + 'px'
+    }
+  },document)
+  windowEventHandler('mouseup',(event)=>{
+    if(isMove){ //有move就设置位置没有移动就不处理
+      wrap.style.left = dragX + 'px'
+      wrap.style.top = dragY + 'px'
+    }
+    isDrag = false
+    return false
+  },document)
+}
+// function handleMove(event,mouseX){
+//     console.log(event)
+// }
 module.exports = {
     checkType: Type.checkType,
     regexp,
@@ -720,5 +784,7 @@ module.exports = {
     normalVal,
     getPageCoordinate,
     windowRemoveEventHandler,
-    timestampToTime
+    timestampToTime,
+    getPageLength,
+    dragBox,
 };