Browse Source

Merge branch 'optimize-ll' into optimize-zxc

zhangxc 6 years ago
parent
commit
7346d73ed5

+ 6 - 6
src/common/components/ComplexModal/index.jsx

@@ -2,7 +2,7 @@ import React, { Component } from "react";
 import ReactDom from "react-dom";
 import style from "./index.less";
 import close from '@common/images/icon_close.png';
-import { dragBox } from '@utils/tools';
+import { dragBox } from '@utils/drag';
 /**
  * title:标题
  * children:弹窗内容
@@ -20,7 +20,7 @@ class ComplexModal extends Component {
     super(props);
   }
   componentDidMount(){
-    // dragBox('complexModalWrap','complexModalTitle','complexModalWrapMove')
+    dragBox('dragModalWrap','dragModalTitle','add')
   }
 
   render() {
@@ -28,13 +28,13 @@ class ComplexModal extends Component {
     const marginLeft = width? -parseInt(width)/2 : '';
     //const marginTop = height? -parseInt(height)/2: '';
     const domNode = document.getElementById('root');
-    return ReactDom.createPortal(<div className={style['container']} id="complexModalWrapMove">
+    return ReactDom.createPortal(<div className={style['container']}>
       <div className={style['shade']} onClick={shadeClose===false?'':onclose}></div>
-      <div id="complexModalWrap" className={style['modal']} style={{width: width?width:'auto', marginLeft:marginLeft, top:top?top+'px':'',bottom:bottom?bottom+'px':''}}>
-        <div className={`${style['close']} drag-title`} id="complexModalTitle">
+      <div id="dragModalWrap" className={style['modal']} style={{width: width?width:'auto', marginLeft:marginLeft, top:top?top+'px':'',bottom:bottom?bottom+'px':''}}>
+        <div className={`${style['close']} drag-title`} id="dragModalTitle">
           {icon?<img src={icon} />:''}
           {title}
-          <img src={close} onClick={onclose} className={style['closeIcon']} />
+          <img src={close} onClick={onclose} className={style['closeIcon']}/>
         </div>
         <div className={style["content"]} style = {{width: width?width:'auto'}}>{children}</div>
         <div className={style['footer']} style = {{width: width?width:'auto'}}>{footer}</div>

+ 1 - 1
src/common/components/ComplexModal/index.less

@@ -1,8 +1,8 @@
 @import "~@less/mixin.less";
 .container {
   // position: relative;
+  // padding-top: 40px;  //改为绝对定位,拖拽元素不在监听document,改为这个
   z-index: 2000;
-  // padding-top: 40px;
   position: absolute;
   width: 100%;
   height: 100%;

+ 2 - 2
src/components/CopyRight/CopyModalSon/index.jsx

@@ -1,14 +1,14 @@
 import React, { Component } from "react";
 import style from "../index.less";
 import close from '../../../common/images/icon_close.png'
-import { dragBox } from '@utils/tools';
+import { dragBox } from '@utils/drag';
 
 class DiscontentSon extends Component {
   constructor(props) {
     super(props);
   }
   componentDidMount(){
-    dragBox('CopyModalWrap','CopyModalTitle')
+    dragBox('CopyModalWrap','CopyModalTitle','add')
   }
 
   render() {

+ 2 - 2
src/components/CopyRight/DiscontentSon/index.jsx

@@ -1,14 +1,14 @@
 import React, { Component } from "react";
 import style from "../index.less";
 import close from '../../../common/images/icon_close.png'
-import { dragBox } from '@utils/tools';
+import { dragBox } from '@utils/drag';
 
 class DiscontentSon extends Component {
   constructor(props) {
     super(props);
   }
   componentDidMount(){
-    dragBox('disContentWrap','DisclatmerTitle')
+    dragBox('disContentWrap','DisclatmerTitle','add')
   }
 
   render() {

+ 4 - 1
src/components/CopyRight/index.jsx

@@ -2,6 +2,7 @@ import React, { Component } from "react";
 import style from "./index.less";
 import close from '../../common/images/icon_close.png'
 import { storageLocal } from "../../utils/tools"
+import { dragBox } from "@utils/drag"
 import DiscontentSon from "./DiscontentSon"
 import CopyModalSon from "./CopyModalSon"
 
@@ -32,6 +33,7 @@ class CopyRight extends Component {
 
   closeCopyModal() {
     this.props.closeCopyModal();
+    dragBox('CopyModalWrap','CopyModalTitle','del')
   }
 
   showDisclatmerModal(){
@@ -39,7 +41,8 @@ class CopyRight extends Component {
   }
 
   closeDisclatmerModal(){
-      this.props.closeDisclatmerModal()
+    dragBox('disContentWrap','DisclatmerTitle','del')
+    this.props.closeDisclatmerModal()
   }
   disclatmerContent() {
     const { disContent } = this.props.copyRight;

+ 3 - 0
src/components/DiagnosticList/index.jsx

@@ -11,6 +11,7 @@ import Treat from '@containers/Treat'
 import store from '@store';
 import { initItemList ,setInitHistory} from '@store/async-actions/historyTemplates';
 import { pushAllDataList,inspectAndAssist ,deepClone} from '@utils/tools';
+import { dragBox } from '@utils/drag';
 import iconRadioDefault from '@common/images/icon-radio-default.png'
 import iconRadioActive from '@common/images/icon-radio-active.png'
 import AssessResult from '@containers/AssessResult';
@@ -204,6 +205,7 @@ class DiagnosticList extends Component {
               showAssess:false,
               isAssessConfirm:false,
             });
+            dragBox('dragModalWrap','dragModalTitle','del')
         }
     }
     handleSavePossible(obj){
@@ -222,6 +224,7 @@ class DiagnosticList extends Component {
           showAssess:false
         });
       });
+      dragBox('dragModalWrap','dragModalTitle','del')
     }
     componentWillReceiveProps(nextprops) {
       if (this.props.diagnosticStr != nextprops.diagnosticStr) {

+ 2 - 2
src/components/HistoryCaseContainer/HistoryList/index.jsx

@@ -6,7 +6,7 @@ import sort from "./img/sort.png"
 import close from "./img/close.png";
 import PreviewBody from '@components/PreviewBody';
 import Empty from '@components/Empty'
-import { dragBox } from '@utils/tools';
+import { dragBox } from '@utils/drag';
 
 
 class HistoryCaseContainer extends React.Component {
@@ -14,7 +14,7 @@ class HistoryCaseContainer extends React.Component {
         super(props);
     }
     componentDidMount(){
-      dragBox('hisWrapMove','closeHis')
+      dragBox('hisWrapMove','closeHis','add')
     }
     render(){
         const { items,handleCaseClick,handleQuoteClick,handleSortClick,showHistoryBox,activeHistory,preInfo } = this.props;

+ 1 - 1
src/components/HistoryCaseContainer/HistoryList/index.less

@@ -51,7 +51,7 @@
             height: 100%;
             span {
                 display: inline-block;
-                max-width: 130px;
+                max-width: 120px;
                 overflow: hidden;
                 text-overflow: ellipsis;
                 white-space: nowrap;

+ 4 - 2
src/components/HistoryCaseContainer/index.jsx

@@ -9,6 +9,7 @@ import { ConfirmModal } from '@commonComp';
 import { pushAllDataList } from '@utils/tools';
 import { CONFIRM_TYPE } from "@store/types/typeConfig";
 import {billing} from '@store/async-actions/pushMessage';
+import { dragBox } from '@utils/drag';
 
 class HistoryCaseContainer extends React.Component {
     constructor(props){
@@ -26,6 +27,7 @@ class HistoryCaseContainer extends React.Component {
         store.dispatch({type: CONFIRM_TYPE, confirmType: baseObj.sign});
         pushAllDataList(baseObj.sign,'push',baseObj,'history')       //引用
         store.dispatch(billing())
+        dragBox('hisWrapMove','closeHis','del')
     }
     close(){
       store.dispatch(visibleHistory(false));
@@ -34,7 +36,7 @@ class HistoryCaseContainer extends React.Component {
         const { visible,showHistoryCases,showHistoryBox,items,handleCaseClick,handleQuoteClick,handleSortClick,activeHistory,preInfo } = this.props;
         const domNode = document.getElementById('root');
         return ReactDom.createPortal(
-            <div className={styles.historyCaseWrap} style={{display:showHistoryCases?'block':'none'}}>
+              showHistoryCases?<div className={styles.historyCaseWrap}>
                 <div className={styles.maskHistory} onClick={showHistoryBox}></div>
                 <HistoryList 
                     items={items}
@@ -58,7 +60,7 @@ class HistoryCaseContainer extends React.Component {
                 >
                     <p className={styles['center']}>确认引用该病历?</p>
                 </ConfirmModal>
-            </div>
+            </div>:null
         ,domNode)
     }
 }

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

@@ -9,6 +9,7 @@ import { ConfirmModal, Notify } from '@commonComp';
 import check_circle from './img/check-circle.png';
 import check_right from './img/check-right.png';
 import {getAllDataList,getAllDataStringList,isAllClear,filterDataArr,readyKeepHistory} from '@utils/tools';
+import {dragBox} from '@utils/drag';
 import store from '@store';
 import $ from 'jquery';
 
@@ -49,6 +50,7 @@ class Operation extends Component {
       zIndex:40
     })
     this.props.closePrintPreview()
+    dragBox('previewPrintWrapper','previewPrintStatic','del')
   }
 
 
@@ -58,12 +60,13 @@ class Operation extends Component {
     })
     this.props.showPreview()
   }
-
+  
   closePreview() {
     this.setState({
       zIndex:40
     })
     this.props.closePreview()
+    dragBox('previewWrapper','previewStatic','del')
   }
 
   saveAll(type) {
@@ -320,8 +323,9 @@ class Operation extends Component {
       <span className={style['preButton']} onClick={() => { this.saveHis(3) }}><img src={saveHistory} /> 保存病历模板</span>
       <span className={winWidth<=1082?`${style['saveButton']} ${style['minstyle']}`: style['saveButton']} onClick={() => { this.saveAll(1) }}>保存</span>
       <span className={winWidth<=1082?`${style['clearButton']} ${style['saveButton']} ${style['minstyle']}`:`${style['clearButton']} ${style['saveButton']}`} onClick={() => { this.clearAll(2) }}>清除</span>
-      <PrintPreviewContainer visible={visible} onClose={closePrint} />
-      <PreviewContainer visible={preVisible} onClose={closePreview} />
+      {visible?<PrintPreviewContainer visible={visible} onClose={closePrint} />:null}
+      {preVisible?<PreviewContainer visible={preVisible} onClose={closePreview} />:null}
+      
       <ConfirmModal
         visible={diagShow}        //改为全局控制
         confirm={() => { this.makeSure() }}

+ 3 - 2
src/components/Preview/index.jsx

@@ -1,5 +1,6 @@
 import React, { Component } from "react";
-import {getAllDataList,getAllDataStringList,dragBox} from '@utils/tools';
+import {getAllDataList,getAllDataStringList} from '@utils/tools';
+import {dragBox} from '@utils/drag';
 import PreviewBody from '../PreviewBody';
 import store from '@store';
 import style from "./index.less";
@@ -10,7 +11,7 @@ class Preview extends Component {
     super(props)
   }
   componentDidMount(){
-    dragBox('previewWrapper','previewStatic')
+    dragBox('previewWrapper','previewStatic','add')
   }
   render() {
     const { onClose, visible,preInfo } = this.props;

+ 3 - 2
src/components/PrintPreview/index.jsx

@@ -1,5 +1,6 @@
 import React, { Component } from "react";
-import { getAllDataList, getAllDataStringList,dragBox } from '@utils/tools';
+import { getAllDataList, getAllDataStringList } from '@utils/tools';
+import { dragBox } from '@utils/drag';
 import style from "./index.less";
 import PreviewBody from "../PreviewBody";
 import store from '@store';
@@ -12,7 +13,7 @@ class PrintPreview extends Component {
         super(props)
     }
     componentDidMount(){
-      dragBox('previewPrintWrapper','previewPrintStatic')
+      dragBox('previewPrintWrapper','previewPrintStatic','add')
     }
     render() {
         const { onClose, visible, preInfo,save } = this.props;

+ 3 - 2
src/components/PushItems/DetailsModal/index.jsx

@@ -4,7 +4,7 @@ import NewPortal from './NewPortal'
 import close from "./../img/close.png";
 import $ from "jquery";
 import { imageUrlPrefix } from '@utils/config.js';
-import { dragBox } from '@utils/tools';
+import { dragBox } from '@utils/drag';
 class DetailsModal extends Component {
     constructor(props) {
         super(props);
@@ -14,11 +14,12 @@ class DetailsModal extends Component {
         this.hideTips = this.hideTips.bind(this)
     }
     componentDidMount(){
-      dragBox('detailsContentWrap','detailsContentTitle')
+      dragBox('detailsContentWrap','detailsContentTitle','add')
     }
     hideTips() {
         const { hideTips } = this.props;
         hideTips && hideTips();
+        dragBox('detailsContentWrap','detailsContentTitle','del')
     }
     handleClickMenu(index, item, tipsDetails) {
         const that = this

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

@@ -61,6 +61,7 @@ class PushItems extends Component {
       name: '',
       questionId: '',
       showType: 1,
+      uniqueName:''
     }
     let obj1 = {  //添加辅检
       name: '',
@@ -81,6 +82,7 @@ class PushItems extends Component {
         tmpObj.questionId = checkedAssay[i].id
         tmpObj.name = checkedAssay[i].name
         tmpObj.details = tmpDetail
+        tmpObj.uniqueName = checkedAssay[i].uniqueName||''
         assayArr.push(tmpObj)
       }
       store.dispatch(addLabel(assayArr))

+ 1 - 1
src/components/Treat/DrugTreat/index.jsx

@@ -74,7 +74,7 @@ class DrugTreat extends Component {
     
     showTreatDesc() {
         $('#treatDescBox').css({'display': 'block'});
-        $('#treatWrapper').animate({'margin-left': '-471px','left':'50%'}, 300);
+        $('#dragModalWrap').animate({'margin-left': '-471px','left':'50%'}, 300);
         $('#treatDescBox').animate({'width': '260px'}, 500);
     }
 

+ 6 - 6
src/components/Treat/index.jsx

@@ -6,7 +6,6 @@ import DrugHistory from './DrugHistory/index.jsx';
 import FollowUp from './FollowUp/index.jsx';
 import AdverseReactions from './AdverseReactions/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';
@@ -16,6 +15,7 @@ import followUpIcon from './img/followUp.png';
 import drugIcon from './img/drug.png';
 import adverseReactionIcon from './img/adverseReaction.png';
 import $ from "jquery";
+import {dragBox} from '@utils/drag';
 
 class Treat extends Component {
     constructor(props){
@@ -29,7 +29,7 @@ class Treat extends Component {
         this.setTreatBox = this.setTreatBox.bind(this);
     }
     componentDidMount(){
-      dragBox('treatWrapper','dragTreatTitle')
+      dragBox('dragModalWrap','dragModalTitle','add','treatDescBox')
     }
     
     hideTreat() {
@@ -38,7 +38,7 @@ class Treat extends Component {
         clearTreat && clearTreat();
         hideTreat && hideTreat();
         hideDrugInfo && hideDrugInfo();
-        // windowRemoveEventHandler('mousemove',handleMove,document)
+        dragBox('dragModalWrap','dragModalTitle','del')
     }
     handlePrescription() {
         Notify.info('该功能即将上线,敬请期待。', 2000)
@@ -57,7 +57,7 @@ class Treat extends Component {
     }
    
     setTreatBox(){
-      $('#treatWrapper').css({'z-index': 302});
+      $('#dragModalWrap').css({'z-index': 302});
       $('#drugWrapper').css({'z-index': 301});
     }
     render(){
@@ -69,9 +69,9 @@ class Treat extends Component {
             <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="dragModalWrap" className={style['treat-box']}  onselectstart="return false">
                     <img className={style.close} onClick={this.hideTreat} src={close}/>
-                    <div onMouseDown={this.setTreatBox} id="dragTreatTitle" className={style['treat-title']}>治疗方案 ({treatItem.name})</div>
+                    <div onMouseDown={this.setTreatBox} id="dragModalTitle" className={style['treat-title']}>治疗方案 ({treatItem.name})</div>
 
                     <div className={style['treat-inner-box']}>
                         <GeneralTreat icon={generalIcon} title='一般治疗'   generalTreat={generalTreat}></GeneralTreat>

+ 3 - 3
src/components/TreatDesc/DrugInfo/index.jsx

@@ -2,7 +2,7 @@ import React, { Component } from 'react';
 import style from './index.less';
 import close from './../img/close.png';
 import $ from "jquery";
-import {dragBox} from '@utils/tools';
+import {dragBox} from '@utils/tools'
 import { imageUrlPrefix } from '@utils/config.js';
 
 
@@ -17,7 +17,7 @@ class DrugInfo extends Component {
         this.setDragBox = this.setDragBox.bind(this)
     }
     componentDidMount(){
-      dragBox('drugWrapper','drugTitle')
+      dragBox('drugWrapper','drugTitle','add')
     }
     handleClickMenu(index, item, drugDesc) {
         const that = this
@@ -49,7 +49,7 @@ class DrugInfo extends Component {
         }
     }
     setDragBox(){
-      $('#treatWrapper').css({'z-index': 301});
+      $('#dragModalWrap').css({'z-index': 301});
       $('#drugWrapper').css({'z-index': 302});
     }
     render() {

+ 1 - 4
src/components/TreatDesc/index.jsx

@@ -58,7 +58,7 @@ class TreatDesc extends Component {
     hideTreatDesc() {
         $('#treatDescBox').css({'display': 'none'});
         $('#treatDescBox').animate({'display': 'none'}, 500);
-        $('#treatWrapper').animate({'margin-left': '-340px','left':'50%'}, 500);
+        $('#dragModalWrap').animate({'margin-left': '-340px','left':'50%'}, 500);
     }
 
     render(){
@@ -73,7 +73,6 @@ class TreatDesc extends Component {
                         return (<div className={style['drug-desc-item']} dangerouslySetInnerHTML ={{__html: item.content}}>
                         </div>)
                     })}
-                    
                 </div> } */}
                 { otherDrugIndex > -1 && <div  className={style['similar-drug']}>
                     <h3 className={style['drug-desc-title']}><span className={style['drug-desc-class-title']} title={'同类药物(' + treatment[otherDrugIndex].bigdrugsName + ')'}>同类药物({treatment[otherDrugIndex].bigdrugsName})</span>  <img src={packUp} onClick={this.hideTreatDesc} className={style['close-drug-desc']} /></h3>
@@ -121,8 +120,6 @@ class TreatDesc extends Component {
                     })}
                 </div> }
             </div>: '' } */}
-            
-            
         </div>)
     }
 }

+ 7 - 1
src/containers/ChronicInfo.js

@@ -8,6 +8,7 @@ import {saveClickNum} from '@store/async-actions/homePage';
 import { getFormulaResult } from '@store/async-actions/fetchModules'
 import {deepClone} from '@utils/tools';
 import Notify from '@commonComp/Notify';
+import {dragBox} from '@utils/drag';
 
 function mapStateToProps(state){
   const {pushMessage,assessResult} = state;
@@ -43,6 +44,9 @@ function mapDispatchToProps(dispatch){
         value:param.value,
         item:item?Object.assign({},item):undefined
       })
+      if(!param.value){
+        dragBox('dragModalWrap','dragModalTitle','del')
+      }
     },
     getScaleInfo(item){
       dispatch(getScaleInfo(item))
@@ -122,4 +126,6 @@ function mapDispatchToProps(dispatch){
 }
 
 const ChronicInfoContainer = connect(mapStateToProps,mapDispatchToProps)(ChronicInfo);
-export default ChronicInfoContainer;
+export default ChronicInfoContainer;
+
+

+ 2 - 0
src/containers/HistoryCases.js

@@ -3,6 +3,7 @@ import { connect } from 'react-redux';
 import HistoryCaseContainer from '@components/HistoryCaseContainer';
 import { showHistory,sortHistory,activeHistory,visibleHistory } from '@store/actions/historyTemplates'
 import {keepPushData} from '@store/actions/tabTemplate';
+import { dragBox } from '@utils/drag';
 
 function mapStateToProps(state) {
     return {
@@ -18,6 +19,7 @@ function mapStateToProps(state) {
 function mapDispatchToProps(dispatch) {
     return {
         showHistoryBox(){
+            dragBox('hisWrapMove','closeHis','del')
             dispatch(showHistory(false))
         },
         handleCaseClick(e,val){

+ 1 - 0
src/containers/Treat.js

@@ -67,6 +67,7 @@ function mapDispatchToProps(dispatch) {
             
         },
         hideDrugInfo: () =>{
+            
             dispatch({
                 type: CLEAR_DRUG_INFO
             })

+ 3 - 2
src/store/actions/inspect.js

@@ -15,9 +15,10 @@ export const addLabel = (lis) => ({          //右侧开单
     type:ADD_LABEL,
     lis
 })
-export const resetLabel = (list) => ({          //搜索后点击选中的结果重组
+export const resetLabel = (list,uniqueName) => ({          //搜索后点击选中的结果重组
     type:RESET_LABEL,
-    list
+    list,
+    uniqueName
 })
 
 export const fillActived = (id,idx) => ({

+ 0 - 1
src/store/async-actions/diagnosticSearch.js

@@ -14,7 +14,6 @@ export const getSearchList = (val) => {
     return (dispatch, getState) => {
         const state = getState();
         const diagnosticList = state.diagnosticList.diagnosticList
-        console.log('diagnosticList', diagnosticList)
         let noIds = []
         for(let i = 0; i < diagnosticList.length; i++) {
             if(diagnosticList[i].conceptId) {

+ 3 - 3
src/store/async-actions/inspect.js

@@ -37,15 +37,15 @@ export const getSublableList = (id,idx) => {
         .then((res)=>{
             const data = res.data.data;
             if (data.controlType == 0) {
-                dispatch(resetLabel(data.questionMapping,idx));
+                dispatch(resetLabel(data.questionMapping,data.uniqueName||''));
             }else if(data.controlType == 1){
                 let arr = [];
                 arr[0] = data;
-                dispatch(resetLabel(arr,idx));
+                dispatch(resetLabel(arr));
             }else if(data.controlType == 6) {
                 let arr =[];
                 arr[0] = data;
-                dispatch(resetLabel(arr,idx));
+                dispatch(resetLabel(arr));
             } 
         })
     }

+ 2 - 1
src/store/reducers/inspect.js

@@ -11,7 +11,7 @@ import {
     DEL_EXCEL_LIST,
     ADD_LABEL
 } from '../types/inspect';
-import store from '@store'
+import store from '@store';
 import {dateParser} from '@utils/tools.js';
 
 const initSearchList = {
@@ -63,6 +63,7 @@ export default (state = initSearchList, action) => {
         const newState = Object.assign({}, state);
         const tempArr = newState.labelList;
         tempArr[tempArr.length-1].details = action.list;
+        tempArr[tempArr.length-1].uniqueName = action.uniqueName;
         return newState;
     } 
     if (action.type == ADD_LABEL) {             //右侧推送的化验辅检项,点击开单放到左侧化验辅检的位置上

+ 1 - 0
src/utils/config.js

@@ -1,6 +1,7 @@
 // const host='http://192.168.3.1:5050';//赵
 // const host='http://192.168.3.100:5050';//王峰
 // const host='http://192.168.2.241:5050';//后端接口访问地址
+// const host='http://192.168.2.121:5050';//后端接口访问地址
 const host='http://192.168.2.236:5050';//后端接口访问地址
 // const host='http://192.168.3.11:5050';//王宇
 //const host='http://192.168.2.164:8080';

+ 92 - 89
src/utils/drag.js

@@ -1,102 +1,105 @@
+/**
+ * 弹窗页面同一时间只能渲染一个,可拖拽元素的id都一样'dragModalWrap','dragModalTitle'
+ * 保证能在关闭的时候移除move事件
+ */
 import $ from 'jquery';
-import { getWindowInnerHeight,getWindowInnerWidth,getPageCoordinate } from './tools'
+import {
+  getWindowInnerHeight,
+  getWindowInnerWidth,
+  getPageCoordinate
+} from './tools'
+
+let width = '',//屏幕宽度
+  height = '', //屏幕高度
+  dragWrapper = '',//拖拽元素
+  mouseX = 0,//鼠标距离页面左侧
+  mouseY = 0,//鼠标距离页面上部
+  dragX = 0,//鼠标可拖拽到左边的最大距离(元素定位左侧距离)
+  dragY = 0,//鼠标可拖拽到上边的最大距离(元素定位上边距离)
+  isDrag = false,//元素是否处于拖拽中
+  addPart = null;//展开区域,这个展开的宽度应当是固定宽度了
 /**
  * 
- * @param {被拖动的元素} domWrap 
- * @param {可拖动的区域} domDrag 
- * @param {鼠标滑动监听的区域} dragMove 
- * @param {拖动元素/清除拖动事件监听} type 
+ * @param {事件对象} event 
+ * @param {被拖动的元素} dragModalWrap 
+ * @param {可拖动的区域} dragModalTitle 
  */
-
-function dragBox(domWrap,domDrag,dragMove){
-  // console.log(domWrap,domDrag,'拖拽')
-  let drag = $("#"+domDrag);
-  let wrap = $("#"+domWrap);
-  let wrapHeight = wrap.height();//被拖拽的元素高度
-  let wrapWidth = wrap.width();//被拖拽的元素宽度
-  let width = getWindowInnerHeight();//屏幕宽度
-  let height = getWindowInnerWidth();//屏幕高度
-  let mouseX = 0,mouseY = 0,dragX = 0,dragY = 0,isDrag = false,isMove = false;
-  // windowEventHandler('mousedown',function(event){    //鼠标位置获取,计算点击位置到拖拽元素左边的距离
-  //   let page = getPageCoordinate(event,'0');
-  //   mouseX = page.boxLeft - wrap.offsetLeft      //鼠标到拖拽元素的左边界的距离
-  //   mouseY = page.boxTop - wrap.offsetTop       //鼠标到拖拽元素的上边界的距离
-  //   isDrag = true
-  //   // isMove = false
-  // },drag)
-  drag.on('mousedown',function(event){
-    let page = getPageCoordinate(event,'0');
-    mouseX = page.boxLeft - wrap.offsetLeft      //鼠标到拖拽元素的左边界的距离
-    mouseY = page.boxTop - wrap.offsetTop       //鼠标到拖拽元素的上边界的距离
-    isDrag = true
-  })
-  $(document).on('mousemove',handleMove)
-  $(document).on('mouseup',function(){
-    isDrag = false
-    return false
-  })
-  // windowEventHandler('mousemove',handleMove,document)
-  // windowEventHandler('mouseup',()=>{
-  //   // if(isMove){ //有move就设置位置没有移动就不处理
-  //   //   console.log(dragX)
-  //   //   wrap.style.left = dragX + 'px'
-  //   //   wrap.style.top = dragY + 'px'
-  //   // }
-  //   isDrag = false
-  //   return false
-  // },document)
-
-  function handleMove(event){      //移动的
-    console.log(99)
-    let dragDes = document.getElementById('treatDescBox');//展開区域
-    let page = getPageCoordinate(event,'0');
-    let maxDragX = 0,dragDesWidth = 0;
-    let maxDragY = height - wrapHeight;//最大可拖拽y方向距离
-    wrapHeight = wrap.offsetHeight;
-    wrapWidth = wrap.offsetWidth;
-    if(domDrag == 'dragTreatTitle'){//最大可推拽x方向距离
-      if(dragDes != null){
-        dragDesWidth = dragDes.offsetWidth
-      }else{
-        dragDesWidth = 0
-      }
-      maxDragX = width - wrapWidth - dragDesWidth
-    }else{
-      maxDragX = width - wrapWidth
+function handleMove(event) {
+  let wrap = $("#"+dragWrapper); //被拖拽的元素
+  let dragDes = $("#"+addPart); //展開区域
+  let page = getPageCoordinate(event, '0');//获取鼠标位置
+  let maxDragX = 0,dragDesWidth = 0;
+  let wrapHeight = wrap[0].offsetHeight;//直接用.height()获取的高度不准确
+  let wrapWidth = wrap[0].offsetWidth;
+  let maxDragY = height - wrapHeight; //最大可拖拽y方向距离
+  if (dragDes[0]) { //存在就有类似治疗方案的弹窗,最大可推拽x方向距离
+    dragDesWidth = dragDes[0].offsetWidth//展开元素的宽度
+    maxDragX = width - wrapWidth - dragDesWidth
+  } else {
+    maxDragX = width - wrapWidth
+  }
+  if (isDrag) {
+    dragX = page.boxLeft - mouseX //鼠标可拖拽到左边的最大距离
+    dragY = page.boxTop - mouseY //鼠标可拖拽到上边的最大距离
+    if (dragX < 0) { //不能超出左边界
+      dragX = 0
     }
-    if(isDrag){
-      dragX = page.boxLeft - mouseX          //鼠标可拖拽到左边的最大距离
-      dragY = page.boxTop - mouseY          //鼠标可拖拽到上边的最大距离
-      if(dragX < 0){      //不能超出左边界
-        dragX = 0
-      }
-      if(dragY < 0){      //不能超出上边界
-        dragY = 0
-      }
-      if(domDrag == 'dragTreatTitle'){
-        if(width-dragX-dragDesWidth < wrapWidth){    //不能超出右边界
-          dragX = maxDragX
-        }
-      }else{
-        // console.log(width,dragX,maxDragX,wrapWidth)
-        if(width-dragX < wrapWidth){    //不能超出右边界
-          dragX = maxDragX
-        }
+    if (dragY < 0) { //不能超出上边界
+      dragY = 0
+    }
+    if (dragDes[0]) {
+      if (width - dragX - dragDesWidth < wrapWidth) { //不能超出右边界
+        dragX = maxDragX
       }
-      if(height-dragY < wrapHeight){     //不能超出下边界
-        dragY = maxDragY
+    } else {
+      if (width - dragX < wrapWidth) { //不能超出右边界
+        dragX = maxDragX
       }
-      // isMove = true
-      wrap.style.left = dragX + 'px'
-      wrap.style.marginLeft = 0 + 'px'
-      wrap.style.top = dragY + 'px'
     }
+    if (height - dragY < wrapHeight) { //不能超出下边界
+      dragY = maxDragY
+    }
+    // isMove = true
+    wrap.css({
+      left: dragX + 'px',
+      marginLeft: 0 + 'px',
+      top: dragY + 'px'
+    })
+  }
+}
+/**
+ * 鼠标弹起弹窗不在跟随鼠标移动
+ */
+function handleUp(){
+  isDrag = false
+  return
+}
+/**
+ * @param {拖动元素/清除拖动事件监听} type add:添加事件监听  del:移除事件监听
+ * @param {展开元素id} addDom 
+ */
+function dragBox(dragWrap,dragTop,type,addDom) {
+  let drag = $("#"+dragTop); //拖拽区域
+  let wrap = $("#"+dragWrap); //被拖拽的元素
+  width = getWindowInnerWidth(); 
+  height = getWindowInnerHeight();
+  addPart = addDom||null;
+  dragWrapper = dragWrap;
+  if (type === 'del') {
+    $(document).off('mousemove', handleMove)
+    $(document).off('mouseup', handleUp)
+  } else {
+    drag.on('mousedown', function (event) {
+      let page = getPageCoordinate(event, '0');
+      mouseX = page.boxLeft - wrap.offset().left; //鼠标到拖拽元素的左边界的距离
+      mouseY = page.boxTop - wrap.offset().top; //鼠标到拖拽元素的上边界的距离
+      isDrag = true
+    })
+    $(document).on('mousemove', handleMove)
+    $(document).on('mouseup', handleUp)
   }
-  setTimeout(() => {
-    // windowRemoveEventHandler('mousemove',handleMove,document)
-  }, 6000);
 }
 
 module.exports = {
   dragBox
-}
+}

+ 0 - 1
src/utils/jqprint.js

@@ -1,5 +1,4 @@
 import $ from 'jquery';
-
 (function ($) {
   var opt;
   $.fn.jqprint = function (options) {

+ 36 - 45
src/utils/tools.js

@@ -739,6 +739,10 @@ function normalVal(min,max){
       return null;
   }
 }
+/**
+ * 
+ * @param {弹窗显示位置是否往下设置} stic 
+ */
 function getPageCoordinate(event,stic){//获取鼠标点击的位置
     let e = event || window.event;
     var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
@@ -761,50 +765,25 @@ function timestampToTime(timestamp) {     //excel导入2019年5月1日会转换
   var s = date.getSeconds();
   return Y+M+D+h+m+s;
 }
-function dragBox(domWrap,domDrag,dragMove){
+function dragBox(domWrap,domDrag,type){
   // console.log(domWrap,domDrag,'拖拽')
-  let drag = document.getElementById(domDrag);//拖拽区域
-  let wrap = document.getElementById(domWrap);//被拖拽的元素
-  let move = document.getElementById(dragMove);//被拖拽的元素
-  let wrapHeight = wrap.offsetHeight;//被拖拽的元素高度
-  let wrapWidth = wrap.offsetWidth;//被拖拽的元素宽度
-  let width = window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;//屏幕宽度
-  let height = window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;//屏幕高度
+  let drag = $("#"+domDrag);//拖拽区域
+  let wrap = $("#"+domWrap);//被拖拽的元素
+  let wrapHeight = wrap[0].offsetHeight;//被拖拽的元素高度
+  let wrapWidth = wrap[0].offsetWidth;//被拖拽的元素宽度
+  let width = getWindowInnerWidth();//屏幕宽度
+  let height = getWindowInnerHeight();//屏幕高度
   let mouseX = 0,mouseY = 0,dragX = 0,dragY = 0,isDrag = false,isMove = false;
-  windowEventHandler('mousedown',function(event){    //鼠标位置获取,计算点击位置到拖拽元素左边的距离
-    let page = getPageCoordinate(event,'0');
-    mouseX = page.boxLeft - wrap.offsetLeft      //鼠标到拖拽元素的左边界的距离
-    mouseY = page.boxTop - wrap.offsetTop       //鼠标到拖拽元素的上边界的距离
-    isDrag = true
-    // isMove = false
-  },drag)
-  // $(move).mouseup(()=>{
-  //   console.log(123)
-  //   isDrag = false
-  //   return false
-  // })
-  // $(move).mousemove(handleMove)
-  windowEventHandler('mousemove',handleMove,document)
-  windowEventHandler('mouseup',()=>{
-    // if(isMove){ //有move就设置位置没有移动就不处理
-    //   console.log(dragX)
-    //   wrap.style.left = dragX + 'px'
-    //   wrap.style.top = dragY + 'px'
-    // }
-    isDrag = false
-    return false
-  },dragMove)
-
   function handleMove(event){      //移动的
-    let dragDes = document.getElementById('treatDescBox');//展開区域
+    let dragDes = $('#treatDescBox');//展開区域
     let page = getPageCoordinate(event,'0');
     let maxDragX = 0,dragDesWidth = 0;
+    wrapHeight = wrap[0].offsetHeight;
+    wrapWidth = wrap[0].offsetWidth;
     let maxDragY = height - wrapHeight;//最大可拖拽y方向距离
-    wrapHeight = wrap.offsetHeight;
-    wrapWidth = wrap.offsetWidth;
-    if(domDrag == 'dragTreatTitle'){//最大可推拽x方向距离
-      if(dragDes != null){
-        dragDesWidth = dragDes.offsetWidth
+    if(domDrag == 'dragModalTitle'){//最大可推拽x方向距离
+      if(dragDes[0]){
+        dragDesWidth = dragDes[0].offsetWidth
       }else{
         dragDesWidth = 0
       }
@@ -821,7 +800,7 @@ function dragBox(domWrap,domDrag,dragMove){
       if(dragY < 0){      //不能超出上边界
         dragY = 0
       }
-      if(domDrag == 'dragTreatTitle'){
+      if(domDrag == 'dragModalTitle'){
         if(width-dragX-dragDesWidth < wrapWidth){    //不能超出右边界
           dragX = maxDragX
         }
@@ -835,14 +814,24 @@ function dragBox(domWrap,domDrag,dragMove){
         dragY = maxDragY
       }
       // isMove = true
-      wrap.style.left = dragX + 'px'
-      wrap.style.marginLeft = 0 + 'px'
-      wrap.style.top = dragY + 'px'
+      wrap.css({
+        left:dragX + 'px',
+        marginLeft:0 + 'px',
+        top:dragY + 'px'
+      })
     }
   }
-  setTimeout(() => {
-    // windowRemoveEventHandler('mousemove',handleMove,document)
-  }, 2000);
+    drag.on('mousedown',function(event){
+      let page = getPageCoordinate(event,'0');
+      mouseX = page.boxLeft - wrap.offset().left;      //鼠标到拖拽元素的左边界的距离
+      mouseY = page.boxTop - wrap.offset().top;       //鼠标到拖拽元素的上边界的距离
+      isDrag = true
+    })
+    $(document).on('mousemove',handleMove)
+    $(document).on('mouseup',function(){
+      isDrag = false
+      return false
+    })
 }
 
 function getCurrentDate(){
@@ -875,6 +864,7 @@ function inspectAndAssist(){
       name: '',
       questionId: '',
       showType: 1,
+      uniqueName:''
     }
     if (tmpInspect[i].controlType == 0) {
       tmpDetail = tmpInspect[i].questionMapping
@@ -884,6 +874,7 @@ function inspectAndAssist(){
     tmpObj.questionId = tmpInspect[i].id
     tmpObj.name = tmpInspect[i].name
     tmpObj.details = tmpDetail
+    tmpObj.uniqueName = tmpInspect[i].uniqueName || ''
     assayArr.push(tmpObj)
   }
   for(let i = 0;i < tmpAssist.length;i++){//辅检数据处理