瀏覽代碼

Merge branch 'optimize-ll' into optimize

Luolei 6 年之前
父節點
當前提交
7d52d97783
共有 34 個文件被更改,包括 286 次插入264 次删除
  1. 6 6
      src/common/components/ComplexModal/index.jsx
  2. 1 1
      src/common/components/ComplexModal/index.less
  3. 2 2
      src/components/CopyRight/CopyModalSon/index.jsx
  4. 2 2
      src/components/CopyRight/DiscontentSon/index.jsx
  5. 4 1
      src/components/CopyRight/index.jsx
  6. 3 0
      src/components/DiagnosticList/index.jsx
  7. 2 2
      src/components/HistoryCaseContainer/HistoryList/index.jsx
  8. 1 1
      src/components/HistoryCaseContainer/HistoryList/index.less
  9. 4 2
      src/components/HistoryCaseContainer/index.jsx
  10. 7 3
      src/components/Operation/index.jsx
  11. 3 2
      src/components/Preview/index.jsx
  12. 3 2
      src/components/PrintPreview/index.jsx
  13. 3 2
      src/components/PushItems/DetailsModal/index.jsx
  14. 2 0
      src/components/PushItems/index.jsx
  15. 8 9
      src/components/Treat/AdverseReactions/index.jsx
  16. 3 3
      src/components/Treat/DrugHistory/LastDrug/index.jsx
  17. 3 4
      src/components/Treat/DrugTreat/index.jsx
  18. 6 6
      src/components/Treat/index.jsx
  19. 5 3
      src/components/TreatDesc/DrugInfo/index.jsx
  20. 3 7
      src/components/TreatDesc/index.jsx
  21. 7 1
      src/containers/ChronicInfo.js
  22. 2 0
      src/containers/HistoryCases.js
  23. 4 5
      src/containers/Treat.js
  24. 3 2
      src/store/actions/inspect.js
  25. 4 4
      src/store/actions/treat.js
  26. 0 1
      src/store/async-actions/diagnosticSearch.js
  27. 3 3
      src/store/async-actions/inspect.js
  28. 13 4
      src/store/async-actions/pushMessage.js
  29. 48 50
      src/store/async-actions/treat.js
  30. 2 1
      src/store/reducers/inspect.js
  31. 1 0
      src/utils/config.js
  32. 92 89
      src/utils/drag.js
  33. 0 1
      src/utils/jqprint.js
  34. 36 45
      src/utils/tools.js

+ 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))

+ 8 - 9
src/components/Treat/AdverseReactions/index.jsx

@@ -37,15 +37,16 @@ class AdverseReactions extends Component {
         this.setState({
             hasEnterImg: false
         })
-    }
+
+     }
     setDrugInfo(item) {
         const { setDrugInfo } = this.props;
-        setDrugInfo && setDrugInfo(item, 10, 6);
+        setDrugInfo && setDrugInfo({name: item.name, type: 10, position: 6});
     }
 
 
     render() {
-        const { icon, titleStyle,titleBg, filter, title,  adversReactionList, showDrugInfo, setDrugInfo } = this.props
+        const { icon, titleStyle,titleBg, filter, title,  adversReactionList, setDrugInfo } = this.props
         const  { currentIndex, hasEnterImg } = this.state
         return(
             <div className={style['last-treat-wrapper']}>
@@ -54,22 +55,20 @@ class AdverseReactions extends Component {
                 {/* {console.log('adversReactionList', adversReactionList)} */}
 
                 {adversReactionList.map((item, index) => {
-                    return (<div className={style['adverse-reactions-item']} key={item.id}>
-                    <span className={style['last-treat-name-box']}
-                        
-                    >   
+                    return (<div className={style['adverse-reactions-item']} key={item.conceptId}>
+                    <span className={style['last-treat-name-box']}>   
                         <span   
                                 className={style['last-treat-big-name-box']} 
                                 onMouseEnter={this.handleMouseEnterDrug.bind(this, index, item)}
                                 onMouseLeave = {this.handleMouseLeaveDrug}
                         >
-                            <span className={style['last-treat-big-name']} >{item.tagName}:
+                            <span className={style['last-treat-big-name']} >{item.name}:
                                 {<img className={style['info-img']}  
                                     style ={currentIndex === index  ? {display: "inline-block"} : {display: "none"}}
                                     src={currentIndex === index ?(hasEnterImg ? info3 : info2 ): info2} 
                                     onMouseEnter={this.handleMouseEnterImg.bind(this)}
                                     onMouseLeave = {this.handleMouseLeaveImg}
-                                    onClick={() =>{this.setDrugInfo(item);showDrugInfo();}}/>}
+                                    onClick={this.setDrugInfo.bind(this, item)}/>}
                             </span>
                         </span>
                         

+ 3 - 3
src/components/Treat/DrugHistory/LastDrug/index.jsx

@@ -39,12 +39,12 @@ class LastDrug extends Component {
     }
     setDrugInfo(item) {
         const { setDrugInfo } = this.props;
-        setDrugInfo && setDrugInfo(item,8,5);
+        setDrugInfo && setDrugInfo({name: item.medicitionName,type: 8,position: 5});
     }
 
 
     render() {
-        const { icon, titleStyle,titleBg, filter, title, lastDrugList, showDrugInfo } = this.props
+        const { icon, titleStyle,titleBg, filter, title, lastDrugList } = this.props
         const  { currentIndex, hasEnterImg } = this.state
         return(
              <div className={style['last-common-box']}>
@@ -63,7 +63,7 @@ class LastDrug extends Component {
                                 src={currentIndex === index ?(hasEnterImg ? info3 : info2 ): info2} 
                                 onMouseEnter={this.handleMouseEnterImg.bind(this)}
                                 onMouseLeave = {this.handleMouseLeaveImg}
-                                onClick={() =>{this.setDrugInfo(item);showDrugInfo();}}/>}
+                                onClick={this.setDrugInfo.bind(this, item)}/>}
                             {index == lastDrugList.length-1 ?  '' : <span>,</span>}
                         </span>
                     })}

+ 3 - 4
src/components/Treat/DrugTreat/index.jsx

@@ -67,15 +67,14 @@ class DrugTreat extends Component {
     }
     //搜索药品说明书(查看数据用)
     searchDrug() {
-        const { showDrugInfo, setDrugInfoMore } = this.props
+        const { setDrugInfoMore } = this.props
         const drugIdList = this.state.drugIdList.split(' ')
         setDrugInfoMore({drugIdList: drugIdList})
-        showDrugInfo && showDrugInfo();
     }
     
     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);
     }
 
@@ -110,7 +109,7 @@ class DrugTreat extends Component {
                                               src={currentIndex === index ? (ii === currentImg ? (hasEnterImg ? info3 : info2) : info2): info2} 
                                               onMouseEnter={this.handleMouseEnterImg.bind(this, ii, index)}
                                               onMouseLeave = {this.handleMouseLeaveImg}
-                                              onClick={() =>{this.setDrugInfo(it);showDrugInfo();}}/>}
+                                              onClick={this.setDrugInfo.bind(this,it)}/>}
                                         </span>
                                         
                                         

+ 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>

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

@@ -3,6 +3,8 @@ import style from './index.less';
 import close from './../img/close.png';
 import $ from "jquery";
 import {dragBox} from '@utils/tools'
+import { imageUrlPrefix } from '@utils/config.js';
+
 
 
 class DrugInfo extends Component {
@@ -15,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
@@ -47,7 +49,7 @@ class DrugInfo extends Component {
         }
     }
     setDragBox(){
-      $('#treatWrapper').css({'z-index': 301});
+      $('#dragModalWrap').css({'z-index': 301});
       $('#drugWrapper').css({'z-index': 302});
     }
     render() {
@@ -61,7 +63,7 @@ class DrugInfo extends Component {
                     {drugInfo.drugDesc.map((item, index) =>{
                         return <div className={style['drug-desc-item']} id={item.title.trim()}>
                             <div className={style['drug-desc-title']} >{item.title.trim()}</div> 
-                            <div className={style['drug-desc-content']} dangerouslySetInnerHTML ={{__html: item.content}}></div> 
+                            <div className={style['drug-desc-content']} dangerouslySetInnerHTML ={{__html: item.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix)}}></div> 
                         </div>
                     })}
                     <div className={style['content-menu-box']}>

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

@@ -58,15 +58,14 @@ 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(){
-        const  { treatment, treatDesc, setDrugInfo, showDrugInfo} = this.props
+        const  { treatment, treatDesc, setDrugInfo} = this.props
         const { title, basic, otherDrugIndex, drugDesc} = treatDesc
         const { currentIndex, hasEnterImg } = this.state
         return (treatment && treatment.length >0 && <div  className={style['treat-desc-box']}>
-            
             {title && title === '药品推荐' ? <div className={style['similar-drug-box']} id='treatDescBox'>
                 {/* { basic && basic.length > 0 && <div> //推荐依据不需要展示
                     <h3 className={style['recommend-title']}>推荐依据</h3>
@@ -74,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>
@@ -98,7 +96,7 @@ class TreatDesc extends Component {
                                 src={currentIndex === index ?  (hasEnterImg ? info3 : info2) : info2} 
                                 onMouseEnter={this.handleMouseEnterImg.bind(this, index)}
                                 onMouseLeave = {this.handleMouseLeaveImg}
-                                onClick={() =>{setDrugInfo(item,8,5);showDrugInfo();}}
+                                onClick={() =>{setDrugInfo({name: item.medicitionName, type: 8, position: 5})}}
                                 />}
                         </span>              
                         
@@ -122,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){

+ 4 - 5
src/containers/Treat.js

@@ -4,7 +4,7 @@ import Treat from '@components/Treat';
 import { SELECT_DRUG, SET_OTHER_DRUG, SET_DRUG_INFO, CLEAR_DRUG_INFO,HIDE_TREAT, CLEAR_TREAT, SHOW_DRUG_INFO, HIDE_DRUG_INFO, CHANGE_REACT,  DEL_REACT, SET_FOLLOW_UP } from '@store/types/treat.js';
 import { getInstroduce, getRecommendBasic, getInstroduceMore, commonTreatAddToAdvice, saveAllAdverseReactions, setAllFollowUp } from '@store/async-actions/treat';
 import { ADD_SCHEME } from '@store/types/pushMessage.js'
-import { showDrugInfo } from '../store/actions/treat';
+import { getConceptDetail } from '@store/async-actions/pushMessage';
 
 
 function mapStateToProps(state){
@@ -51,7 +51,7 @@ function mapDispatchToProps(dispatch) {
             // dispatch(getRecommendBasic(item))
         },
         setDrugInfo: (item) => {
-            dispatch(getInstroduce(item));
+            dispatch(getConceptDetail(item));
         },
         hideTreat: () => {
             dispatch({
@@ -64,11 +64,10 @@ function mapDispatchToProps(dispatch) {
             })
         },
         showDrugInfo: () => {
-            dispatch({
-                type: SHOW_DRUG_INFO
-            })
+            
         },
         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) => ({

+ 4 - 4
src/store/actions/treat.js

@@ -149,7 +149,7 @@ export const setALLAdverseReactions =(state, action) => {
     let allAdversReactionList = res.allAdversReactionList
     let hasAdversReactionList = false
     for( let i = 0; i < allAdversReactionList.length; i++) {
-        if (action.adversReactionList.id == allAdversReactionList[i].id) {
+        if (action.adversReactionList.conceptId == allAdversReactionList[i].conceptId) {
             allAdversReactionList[i] = action.adversReactionList
             hasAdversReactionList = true
         } 
@@ -179,7 +179,7 @@ export const delReact = (state, action) => {
     const res = JSON.parse(JSON.stringify(state));
     let allAdversReactionList = res.allAdversReactionList;
     for( let i = 0; i < allAdversReactionList.length; i++) {
-        if (action.item.id == allAdversReactionList[i].id) {
+        if (action.item.conceptId == allAdversReactionList[i].conceptId) {
             allAdversReactionList.splice(i, 1)
         } 
     }
@@ -202,7 +202,7 @@ export const setAllFollowUp = (state, action) => {
     let followUpList = res.followUpList
     let hasfollowUp = false
     for( let i = 0; i < followUpList.length; i++) {
-        if (action.followUp.id == followUpList[i].id) {
+        if (action.followUp.conceptId == followUpList[i].conceptId) {
             followUpList[i] = action.followUp
             hasfollowUp = true
         } 
@@ -218,7 +218,7 @@ export const delFollowUp = (state, action) => {
     const res = JSON.parse(JSON.stringify(state));
     let followUpList = res.followUpList;
     for( let i = 0; i < followUpList.length; i++) {
-        if (action.delItem.id == followUpList[i].id) {
+        if (action.delItem.conceptId == followUpList[i].conceptId) {
             followUpList.splice(i, 1)
         } 
     }

+ 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));
             } 
         })
     }

+ 13 - 4
src/store/async-actions/pushMessage.js

@@ -1,5 +1,6 @@
 import { get, post, json } from "@utils/ajax";
-import { BILLING_ADVICE, SET_TIPS, SET_TIPS_DETAILS ,SET_CHRONIC_TABLELIST,SET_SCALE_INFO,SET_CHRONIC_PUSHS,SHOW_TABLE_LIST} from '../types/pushMessage';
+import { BILLING_ADVICE, SET_TIPS, SET_TIPS_DETAILS ,SET_CHRONIC_TABLELIST,SET_SCALE_INFO,SET_CHRONIC_PUSHS,SHOW_TABLE_LIST} from '@store/types/pushMessage';
+import { SET_DRUG_INFO, SHOW_DRUG_INFO } from '@store/types/treat';
 import { SET_CLICK_DIAG } from '../types/diagnosticList';
 import {storageLocal,getEMRParams} from '@utils/tools';
 import {SET_IMPORT_CHECKBODY_LABEL,PRESET} from "../types/checkBody";
@@ -121,7 +122,7 @@ export const getConceptDetail = (item) => {
 
         json(api.getConceptDetail, params).then((res) => {
             if(res.data.code == '0') {
-                if(item.position == '1') {
+                if(item.position == '1') {  //右侧提示信息
                     if(item.type == '5' || item.type == '6') {
                         dispatch({
                             type: SET_TIPS,
@@ -135,8 +136,16 @@ export const getConceptDetail = (item) => {
                         })
                     }
                     
-                } else if(item.position == '2'){
-
+                } else if(item.position == '5' || item.position == '6'){    //药品或不良反应说明
+                    dispatch({
+                        type: SET_DRUG_INFO,
+                        instroduce: res.data.data.details,
+                        name: item.name,
+                        tagType: item.type
+                    })
+                    dispatch({
+                        type: SHOW_DRUG_INFO
+                    })
                 }
             } else {
                 Notify.info('提示信息未维护')

+ 48 - 50
src/store/async-actions/treat.js

@@ -19,7 +19,6 @@ export const addDiagnostic = (item) => {
             const state = getState();
             let url = api.pushTreatment;
             const emrData = getEMRParams();
-            console.log('emrData', emrData)
             const diagnosticList = state.diagnosticList.diagnosticList;
             let diag = '';
             if(diagnosticList) {
@@ -62,7 +61,7 @@ export const addDiagnostic = (item) => {
                     getChronic().then(() =>{
                     chronicList = JSON.parse(storageLocal.get('chronic'));
                         for(let i=0; i<chronicList.length; i++){
-                            if(chronicList[i].id==item.id&&chronicList[i].name==item.name){ //判断某个病是否为慢病
+                            if(chronicList[i].conceptId==item.conceptId&&chronicList[i].name==item.name){ //判断某个病是否为慢病
                                 params.disType = 1
                             }
                         }
@@ -71,7 +70,7 @@ export const addDiagnostic = (item) => {
                     });
                 } else {
                     for(let i=0; i<chronicList.length; i++){
-                        if(chronicList[i].id==item.id&&chronicList[i].name==item.name){
+                        if(chronicList[i].conceptId==item.conceptId&&chronicList[i].name==item.name){
                             params.disType = 1
                         }
                     }
@@ -170,7 +169,7 @@ export const getTreatResult = (item) =>{
                 getChronic().then(() =>{
                     chronicList = JSON.parse(storageLocal.get('chronic'));
                     for(let i=0; i<chronicList.length; i++){
-                        if(chronicList[i].id==item.id&&chronicList[i].name==item.name){
+                        if(chronicList[i].conceptId==item.conceptId&&chronicList[i].name==item.name){
                             params.disType = 1
                         }
                     }
@@ -179,7 +178,7 @@ export const getTreatResult = (item) =>{
                 });
             } else {
                 for(let i=0; i<chronicList.length; i++){
-                    if(chronicList[i].id==item.id&&chronicList[i].name==item.name){
+                    if(chronicList[i].conceptId==item.conceptId&&chronicList[i].name==item.name){
                         params.disType = 1
                     }
                 }
@@ -217,10 +216,10 @@ function getTreatment(item, dispatch, state,url,params, isChronic) {
                      const allAdversReactionList = state.treat.allAdversReactionList
                      if(allAdversReactionList) {
                          for(let i = 0; i < allAdversReactionList.length; i++) {
-                             if(item.id == allAdversReactionList[i].id) {    //判断是否存过不良反应
+                             if(item.conceptId == allAdversReactionList[i].conceptId) {    //判断是否存过不良反应
                                  for (let j = 0; j < adverseReactions.length; j++) { //判断不良反应是否有相同的不良反应,如果有,替换
                                      for(let z = 0; z < allAdversReactionList[i].adversReactionList.length; z++) {
-                                         if(adverseReactions[j].id == allAdversReactionList[i].adversReactionList[z].id) {
+                                         if(adverseReactions[j].conceptId == allAdversReactionList[i].adversReactionList[z].conceptId) {
                                              for(let x = 0; x < allAdversReactionList[i].adversReactionList[z].details.length; x++) {
                                                  for(let y = 0; y < adverseReactions[j].details.length; y++) {//判断每一项是否选择过
                                                      if(allAdversReactionList[i].adversReactionList[z].details[x].name == adverseReactions[j].details[y].name && allAdversReactionList[i].adversReactionList[z].details[x].select) {
@@ -241,7 +240,7 @@ function getTreatment(item, dispatch, state,url,params, isChronic) {
                  if(isChronic) {
                      let chronicList = JSON.parse(storageLocal.get('chronic'));
                      for(let i=0; i<chronicList.length; i++){
-                         if(chronicList[i].id==item.id&&chronicList[i].name==item.name){ //判断某个病是否为慢病
+                         if(chronicList[i].conceptId==item.conceptId&&chronicList[i].name==item.name){ //判断某个病是否为慢病
                              followUp = '2周';
                          }
                      }
@@ -251,7 +250,7 @@ function getTreatment(item, dispatch, state,url,params, isChronic) {
                      const followUpList = state.treat.followUpList
                      if(followUpList) {  //判断之前有没有保存过的回访时间,如果有替换掉
                          for(let i = 0; i < followUpList.length; i++) {
-                             if(item.id == followUpList[i].id) {
+                             if(item.conceptId == followUpList[i].conceptId) {
                                  followUp = followUpList[i].followUp
                              }
                          }
@@ -287,7 +286,7 @@ export const saveAllAdverseReactions = (item) => {
         dispatch({
             type: SET_ALL_ADVERSE_REACTIONS,
             adversReactionList: {
-                'id': item.id,
+                'conceptId': item.conceptId,
                 'adversReactionList': adversReactionList
             }
         })
@@ -303,7 +302,7 @@ export const setAllFollowUp = (item) => {
         dispatch({
             type: SET_ALL_FOLLOW_UP,
             followUp: {
-                'id': item.id,
+                'conceptId': item.conceptId,
                 'followUp': followUp
             }
         })
@@ -313,27 +312,26 @@ export const setAllFollowUp = (item) => {
 export const getInstroduce = (item, type, position)=>{
 
     return (dispatch, getState) =>{
-        const url = '/conceptDetail/getConceptDetail';
         const params = {
             name: item.name,
             type: item.type,
             position: item.position
         }
-        json(url, params)
+        json(api.getConceptDetail, params)
         .then((data)=>{
-                if(data.data.data) {
+                if(data.data.code == '0') {
                     dispatch({
                         type: SET_DRUG_INFO,
                         instroduce: data.data.data.introduceDetailList,
-                        name: type ==8 ?item.medicitionName : type == 10 ? item.tagName : '',
-                        tagType: type
+                        name: item.name,
+                        tagType: item.type
                     })
                 } else {
                     dispatch({
                         type: SET_DRUG_INFO,
                         instroduce: [],
-                        name: type ==8 ?item.medicitionName : type == 10 ? item.tagName : '',
-                        tagType: type
+                        name: item.name,
+                        tagType: item.type
                     })
                 }
                 
@@ -345,51 +343,51 @@ export const getInstroduce = (item, type, position)=>{
 
 }
 
-export const  getInstroduceMore = (drugIdList) =>{
-    return (dispatch, getState) =>{
-        let drugInfoList = [];
-        for (let i = 0; i < drugIdList.drugIdList.length; i++ ) {
-            const url = '/conceptDetail/getConceptDetail';
-            const params = {
-                questionId: drugIdList.drugIdList[i],
-                type: 8,
-                position: 5
-            }
-            json(url, params)
-            .then((data)=>{
-                    if(data.data.data) {
-                        drugInfoList.push(data.data.data)
-                        dispatch({
-                            type: SET_DRUG_INFO_LIST,
-                            drugInfoList: drugInfoList,
-                        })
-                    } else {
-                        drugInfoList.push([])
-                        dispatch({
-                            type: SET_DRUG_INFO_LIST,
-                            drugInfoList: drugInfoList,
-                        })
-                    }
+// export const  getInstroduceMore = (drugIdList) =>{
+//     return (dispatch, getState) =>{
+//         let drugInfoList = [];
+//         for (let i = 0; i < drugIdList.drugIdList.length; i++ ) {
+//             const url = '/conceptDetail/getConceptDetail';
+//             const params = {
+//                 questionId: drugIdList.drugIdList[i],
+//                 type: 8,
+//                 position: 5
+//             }
+//             json(url, params)
+//             .then((data)=>{
+//                     if(data.data.data) {
+//                         drugInfoList.push(data.data.data)
+//                         dispatch({
+//                             type: SET_DRUG_INFO_LIST,
+//                             drugInfoList: drugInfoList,
+//                         })
+//                     } else {
+//                         drugInfoList.push([])
+//                         dispatch({
+//                             type: SET_DRUG_INFO_LIST,
+//                             drugInfoList: drugInfoList,
+//                         })
+//                     }
                     
-            }).catch((e) => {
-                console.log(e)
-            })
+//             }).catch((e) => {
+//                 console.log(e)
+//             })
 
 
 
 
-        }
+//         }
         
 
-    }
-}
+//     }
+// }
 
 //一般治疗添加到医嘱
 export const commonTreatAddToAdvice = () => {
     return (dispatch, getState) => {
         const state = getState();
         const followUp = state.treat.followUp
-        if(state.treat.treatItem.id === state.diagnosticList.diagnosticList[0].id && state.treat.isFirstMainDiag) {
+        if(state.treat.treatItem.conceptId === state.diagnosticList.diagnosticList[0].conceptId && state.treat.isFirstMainDiag) {
             dispatch({
                 type: IS_FIRST_MAIN_DIAG
             })

+ 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++){//辅检数据处理