Преглед изворни кода

接口对接,弹窗代码优化

Luolei пре 6 година
родитељ
комит
34ccfe1772

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

@@ -20,7 +20,7 @@ class ComplexModal extends Component {
     super(props);
   }
   componentDidMount(){
-    dragBox('add')
+    dragBox('dragModalWrap','dragModalTitle','add')
   }
 
   render() {
@@ -34,7 +34,7 @@ class ComplexModal extends Component {
         <div className={`${style['close']} drag-title`} id="dragModalTitle">
           {icon?<img src={icon} />:''}
           {title}
-          <img src={close} onClick={onclose} className={style['closeIcon']} id="closeclose"/>
+          <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>

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

+ 287 - 294
src/components/DiagnosticList/index.jsx

@@ -5,12 +5,13 @@ import del_on from './img/delete-on.png'
 import diagUp from './img/diagUp.png'
 import diagDown from './img/diagDown.png'
 import manageIcon from '@common/images/manage.png';
-import { ConfirmModal, Message, ComplexModal, Footer } from '@commonComp';
+import {ConfirmModal, Message,ComplexModal,Footer,Loading} from '@commonComp';
 import Notify from '@commonComp/Notify';
 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 { 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';
@@ -19,312 +20,304 @@ import { CONFIRM_TYPE } from "@store/types/typeConfig";
 import $ from "jquery";
 
 class DiagnosticList extends Component {
-  constructor(props) {
-    super(props);
-    this.state = {
-      visible: false,
-      delItem: {},
-      treatTitle: '',
-      activeHistory: -1,
-      sign: -1,
-      showAssess: false,
-      assessId: '',
-      disName: '',
-      isAssessConfirm: false,
-      radioVal: {},  //可能结果选择内容
-      possible: {},  //可能结果
-      hasOndel: false
+    constructor(props) {
+        super(props);
+        this.state = {
+            visible: false,
+            delItem: {},
+            treatTitle: '',
+            activeHistory: -1,
+            sign:-1,
+            showAssess:false,
+            assessId:'',
+            disName:'',
+            isAssessConfirm:false,
+            radioVal:{},  //可能结果选择内容
+            possible:{},  //可能结果
+            hasOndel: false
+        }
+        this.deleteItem = this.deleteItem.bind(this);
+        this.cancel = this.cancel.bind(this);
+        this.close = this.close.bind(this);
+        this.showTreat = this.showTreat.bind(this);
+        this.handleClickDiag = this.handleClickDiag.bind(this);
+        this.referRecord = this.referRecord.bind(this);
+        this.noReferRecord = this.noReferRecord.bind(this);
+        this.getHistoryCase = this.getHistoryCase.bind(this);
+        this.closeHistoryCaseModal = this.closeHistoryCaseModal.bind(this);
+        this.referCase = this.referCase.bind(this);
+        this.handleSaveAssess = this.handleSaveAssess.bind(this);       //评估弹窗确定
+        this.handleSavePossible = this.handleSavePossible.bind(this);
+        this.onPrint = this.onPrint.bind(this);
+    }
+    onPrint() {
+      let dom = $("#AssistResult");
+      dom.jqprint({
+        debug: false,
+        importCSS: true,
+        printContainer: true,
+        operaSupport: false,
+      });
+    }
+    upDiagnostic(index) {
+        const { upDiagnostic } = this.props;
+        upDiagnostic && upDiagnostic(index)
+    }
+    downDiagnostic(index) {
+        const { downDiagnostic } = this.props;
+        downDiagnostic && downDiagnostic(index)
+    }
+    deleteItem() {
+        const { delItem } = this.state;
+        const { delDiagnostic, delReact,delFollowUp } = this.props;
+        delDiagnostic && delDiagnostic(delItem);
+        delReact && delReact(delItem);
+        delFollowUp && delFollowUp(delItem);
+        this.setState({
+            visible: false,
+        })
+        Notify.success('删除成功')
+    }
+    cancel() {
+        this.setState({
+            visible: false
+        })
+    }
+    close() {
+        this.setState({
+            visible: false
+        })
+    }
+    handleDeleteItem(item) {
+        this.setState({
+            visible: true,
+            delItem: item,
+        })
     }
-    this.deleteItem = this.deleteItem.bind(this);
-    this.cancel = this.cancel.bind(this);
-    this.close = this.close.bind(this);
-    this.showTreat = this.showTreat.bind(this);
-    this.handleClickDiag = this.handleClickDiag.bind(this);
-    this.referRecord = this.referRecord.bind(this);
-    this.noReferRecord = this.noReferRecord.bind(this);
-    this.getHistoryCase = this.getHistoryCase.bind(this);
-    this.closeHistoryCaseModal = this.closeHistoryCaseModal.bind(this);
-    this.referCase = this.referCase.bind(this);
-    this.handleSaveAssess = this.handleSaveAssess.bind(this);       //评估弹窗确定
-    this.handleSavePossible = this.handleSavePossible.bind(this);
-    this.onPrint = this.onPrint.bind(this);
-  }
-  onPrint() {
-    let dom = $("#AssistResult");
-    dom.jqprint({
-      debug: false,
-      importCSS: true,
-      printContainer: true,
-      operaSupport: false,
-    });
-  }
-  upDiagnostic(index) {
-    const { upDiagnostic } = this.props;
-    upDiagnostic && upDiagnostic(index)
-  }
-  downDiagnostic(index) {
-    const { downDiagnostic } = this.props;
-    downDiagnostic && downDiagnostic(index)
-  }
-  deleteItem() {
-    const { delItem } = this.state;
-    const { delDiagnostic, delReact, delFollowUp } = this.props;
-    delDiagnostic && delDiagnostic(delItem);
-    delReact && delReact(delItem);
-    delFollowUp && delFollowUp(delItem);
-    this.setState({
-      visible: false,
-    })
-    Notify.success('删除成功')
-  }
-  cancel() {
-    this.setState({
-      visible: false
-    })
-  }
-  close() {
-    this.setState({
-      visible: false
-    })
-  }
-  handleDeleteItem(item) {
-    this.setState({
-      visible: true,
-      delItem: item,
-    })
-  }
-  showTreat(item, index) {
-    // item.treatIndex = index
-    const { showTreat, getTreatResult } = this.props;
-    getTreatResult && getTreatResult(item);
-    // showTreat && showTreat();//添加loading,移到async-actions中
-    this.setState({
-      treatTitle: item.name
-    })
-  }
-  handleClickDiag(item) {
-    const { getTips } = this.props;
-    // getTips && getTips(item);
-    getTips && getTips({ id: item.id, type: 7, name: item.name, position: 1 });
-  }
-  referRecord() {
-    const { hideReferRecord, showHistoryCaseModal, chronicMagItem, hisTemplates, autoFillModules, typeConfig } = this.props
-    hideReferRecord && hideReferRecord()
-    // showHistoryCaseModal && showHistoryCaseModal()
-    // store.dispatch(initItemList(chronicMagItem))
-    initItemList(chronicMagItem).then((res) => {
-      const result = res.data;
-      if (result.code == 0 && result.data) {
-        store.dispatch(setInitHistory(result.data));
-        showHistoryCaseModal && showHistoryCaseModal();
-      } else {
-        if (typeConfig == 0) {
-          Notify.info("暂无历史病历,已默认展示慢病相关内容");
-          const timer = setTimeout(function () {
-            autoFillModules && autoFillModules();
-            clearTimeout(timer);
-          }, 1000) //需求要求延时
+    showTreat(item, index) {
+        // item.treatIndex = index
+        const  { showTreat, getTreatResult } = this.props;
+        getTreatResult && getTreatResult(item);
+        // showTreat && showTreat();//添加loading,移到async-actions中
+        this.setState({
+            treatTitle: item.name
+        })
+    } 
+    handleClickDiag(item) {
+        const { getTips } = this.props;
+        // getTips && getTips(item);
+        getTips && getTips({id:item.id, type:7, name: item.name, position: 1});
+    }
+    referRecord() {
+        const { hideReferRecord, showHistoryCaseModal ,chronicMagItem,hisTemplates,autoFillModules,typeConfig} = this.props
+        hideReferRecord && hideReferRecord()
+        // showHistoryCaseModal && showHistoryCaseModal()
+        // store.dispatch(initItemList(chronicMagItem))
+        initItemList(chronicMagItem).then((res)=>{
+            const result = res.data;
+            if(result.code==0 && result.data){
+              store.dispatch(setInitHistory(result.data));
+              showHistoryCaseModal && showHistoryCaseModal();
+            }else{
+              if(typeConfig==0){
+                Notify.info("暂无历史病历,已默认展示慢病相关内容");
+                const timer = setTimeout(function(){
+                  autoFillModules && autoFillModules();
+                  clearTimeout(timer);
+                },1000) //需求要求延时
+              }
+            }
+        })
+    }
+    noReferRecord() {
+        const { hideReferRecord ,autoFillModules,typeConfig} = this.props
+        hideReferRecord && hideReferRecord();
+        if(typeConfig==0){//智能推送模式才自动填充
+            autoFillModules&&autoFillModules();
         }
-      }
-    })
-  }
-  noReferRecord() {
-    const { hideReferRecord, autoFillModules, typeConfig } = this.props
-    hideReferRecord && hideReferRecord();
-    if (typeConfig == 0) {//智能推送模式才自动填充
-      autoFillModules && autoFillModules();
+        
     }
-
-  }
-  referCase() {
-    const { hideHistoryCaseModal, items, autoFillModules, typeConfig } = this.props
-    const { sign } = this.state;
-    hideHistoryCaseModal && hideHistoryCaseModal()
-    if (this.state.activeHistory === -1 && typeConfig == 0) {//没有选择历史病例直接点确定
-      Notify.info("未选择历史病历,已默认展示慢病相关内容");
-      const timer = setTimeout(function () {
-        autoFillModules && autoFillModules();
-        clearTimeout(timer);
-      }, 1000)
-      return
+    referCase() {
+        const { hideHistoryCaseModal, items ,autoFillModules,typeConfig} = this.props
+        const {sign} = this.state;
+        hideHistoryCaseModal && hideHistoryCaseModal()
+        if (this.state.activeHistory === -1 && typeConfig==0) {//没有选择历史病例直接点确定
+            Notify.info("未选择历史病历,已默认展示慢病相关内容");
+              const timer = setTimeout(function(){
+                autoFillModules && autoFillModules();
+                clearTimeout(timer);
+              },1000)
+            return
+        }
+        let baseList = store.getState();
+        
+        let baseObj = items[this.state.activeHistory];
+        // 切换模式
+        if(sign != typeConfig){
+          store.dispatch({type: CONFIRM_TYPE, confirmType: baseObj.sign});
+        }
+        pushAllDataList(baseObj.sign,'push',baseObj,'history')       //引用
+        this.props.getBilling();
+        this.setState({
+            activeHistory: -1,
+            sign:-1
+        })
     }
-    let baseList = store.getState();
-
-    let baseObj = items[this.state.activeHistory];
-    // 切换模式
-    if (sign != typeConfig) {
-      store.dispatch({ type: CONFIRM_TYPE, confirmType: baseObj.sign });
+    closeHistoryCaseModal() {
+        const { hideHistoryCaseModal ,autoFillModules,typeConfig} = this.props
+        this.setState({
+            activeHistory: -1,
+            sign:-1
+        })
+        hideHistoryCaseModal && hideHistoryCaseModal()
+        if(typeConfig==0){//智能推送模式才自动填充
+            autoFillModules&&autoFillModules();
+        }
     }
-    pushAllDataList(baseObj.sign, 'push', baseObj, 'history')       //引用
-    this.props.getBilling();
-    this.setState({
-      activeHistory: -1,
-      sign: -1
-    })
-  }
-
-  handleQuoteClick(item, index) {
-    const { handleQuoteClick } = this.props
-    // handleQuoteClick && handleQuoteClick(item)
-    this.setState({
-      activeHistory: index,
-      sign: item.sign
-    })
-  }
-  getHistoryCase() {
-    const { items } = this.props
-    return (<div className={style['history-info']}>
-      {items.map((item, index) => {
-        return <div onClick={this.handleQuoteClick.bind(this, item, index)} style={this.state.activeHistory === index ? { color: '#3B9ED0' } : ''}>
-          <img src={this.state.activeHistory === index ? iconRadioActive : iconRadioDefault} />{item.diagnose} {item.inquiryDate}{item.sign == 0 ? '(智能模式)' : '(文本模式)'}
-        </div>
-      })}
-    </div>)
-  }
-
-  closeHistoryCaseModal() {
-    const { hideHistoryCaseModal, autoFillModules, typeConfig } = this.props
-    this.setState({
-      activeHistory: -1,
-      sign: -1
-    })
-    hideHistoryCaseModal && hideHistoryCaseModal()
-    if (typeConfig == 0) {//智能推送模式才自动填充
-      autoFillModules && autoFillModules();
+    handleQuoteClick(item, index) {
+        const { handleQuoteClick } = this.props
+        // handleQuoteClick && handleQuoteClick(item)
+        this.setState({
+            activeHistory: index,
+            sign:item.sign
+        })
+    }
+    getHistoryCase() {
+        const { items } = this.props
+        return (<div className={style['history-info']}>
+            {items.map((item, index) => {
+                return<div onClick={this.handleQuoteClick.bind(this, item, index)} style={this.state.activeHistory === index ? {color: '#3B9ED0'} : ''}>
+                    <img src={this.state.activeHistory === index ? iconRadioActive : iconRadioDefault}/>{item.diagnose} {item.inquiryDate}{item.sign==0?'(智能模式)':'(文本模式)'}
+                </div>
+            })}
+        </div>)
+    }
+    showAssessFn(item){
+        if(item&&item.id){         //显示评估弹窗
+          this.setState({
+            showAssess:true,
+            isAssessConfirm:false,
+            assessId:item.id,
+            disName:item.name
+          });
+        }else{          //关闭评估弹窗
+            this.setState({
+              showAssess:false,
+              isAssessConfirm:false,
+            });
+            dragBox('dragModalWrap','dragModalTitle','del')
+        }
     }
-  }
-  handleQuoteClick(item, index) {
-    const { handleQuoteClick } = this.props
-    // handleQuoteClick && handleQuoteClick(item)
-    this.setState({
-      activeHistory: index,
-      sign: item.sign
-    })
-  }
-  getHistoryCase() {
-    const { items } = this.props
-    return (<div className={style['history-info']}>
-      {items.map((item, index) => {
-        return <div onClick={this.handleQuoteClick.bind(this, item, index)} style={this.state.activeHistory === index ? { color: '#3B9ED0' } : ''}>
-          <img src={this.state.activeHistory === index ? iconRadioActive : iconRadioDefault} />{item.diagnose + '(' + item.inquiryDate + ')'}
-        </div>
-      })}
-    </div>)
-  }
-  showAssessFn(item) {
-    if (item && item.id) {         //显示评估弹窗
+    handleSavePossible(obj){
       this.setState({
-        showAssess: true,
-        isAssessConfirm: false,
-        assessId: item.id,
-        disName: item.name
-      });
-    } else {          //关闭评估弹窗
+        possible:Object.assign({},obj.possible),
+        radioVal:Object.assign({},obj.radioVal),//不设置radioVal只有最近一次选中的值
+      })
+    }
+    handleSaveAssess(){
       this.setState({
-        showAssess: false,
-        isAssessConfirm: false,
+        isAssessConfirm:true
       });
-    }
-  }
-  handleSavePossible(obj) {
-    this.setState({
-      possible: Object.assign({}, obj.possible),
-      radioVal: Object.assign({}, obj.radioVal),//不设置radioVal只有最近一次选中的值
-    })
-  }
-  handleSaveAssess() {
-    this.setState({
-      isAssessConfirm: true
-    });
-    const that = this;
-    setTimeout(() => {
-      that.setState({
-        showAssess: false
+      const that=this;
+      setTimeout(()=>{
+        that.setState({
+          showAssess:false
+        });
       });
-    });
-  }
-  componentWillReceiveProps(nextprops) {
-    if (this.props.diagnosticStr != nextprops.diagnosticStr) {
-      this.props.getBilling();
+      dragBox('dragModalWrap','dragModalTitle','del')
     }
-    if (deepClone(nextprops.wholeResults) != deepClone(this.props.wholeResults)) {
+    componentWillReceiveProps(nextprops) {
+      if (this.props.diagnosticStr != nextprops.diagnosticStr) {
+        this.props.getBilling();
+      }
+      if(deepClone(nextprops.wholeResults)!=deepClone(this.props.wholeResults)){
+          this.setState({
+            radioVal:Object.assign({},nextprops.wholeResults.radioVal),
+            possible:Object.assign({},nextprops.wholeResults.possible),
+          })
+      }
+    }
+    handleEnterDel() {
+      this.setState({
+        hasOndel: true
+      })
+    }
+    handleLeaveDel() {
       this.setState({
-        radioVal: Object.assign({}, nextprops.wholeResults.radioVal),
-        possible: Object.assign({}, nextprops.wholeResults.possible),
+        hasOndel: false
       })
     }
-  }
-  render() {
-    const { list, treatment, showReferRecord, showHistoryCase, chronicMagItem, loading } = this.props;
-    const { visible, treatTitle, showAssess, isAssessConfirm, radioVal, possible, assessId, disName, hasOndel } = this.state;
-    const chronicList = JSON.parse(localStorage.getItem('chronic') || null);
-    const chronicLine = chronicMagItem && chronicMagItem.name;     //当前是否走的慢病流程
-    let isChronic = false;      //是否要显示管理评估
-    const footer = <Footer print={true}
-      footText="确定"
-      handlePrint={this.onPrint}
-      handleConfirm={this.handleSaveAssess} />;
-    return (
-      <div className={style['diaglist-wrap']}>
-        {list && (list.length > 0) && list.map((item, index) => {
-          const hasTreat = item.treat && (item.treat.commonTreatment.content || item.treat.surgeryTreatment.content || item.treat.treatment.length > 0 || (item.adverseReactions && item.adverseReactions.length > 0)
-            || (item.drugHistory && item.drugHistory['慢病用药内容'] && item.drugHistory['慢病用药内容'].length > 0) || (item.drugHistory && item.drugHistory['普通病用药内容'] && item.drugHistory['普通病用药内容'].length > 0) || item.follow)
-          isChronic = chronicLine && item.type == 2 && chronicList.findIndex((it) => it.id == item.id) != -1;
-          return (<div draggable={true} className={style['diag-box'] + ' clearfix'} key={item.id} >
-            {index === 0 ? '' : <span className={style['diag-up']} onClick={() => { this.upDiagnostic(index) }}><img className={style["diag-up"]} src={diagUp} /></span>}
-            {list.length === 1 ? '' : index !== 0 ? '' : <span onClick={() => { this.downDiagnostic(index) }} className={style['diag-down']}><img className={style["diag-down"]} src={diagDown} /></span>}
-            <span className={style['diag-number']} style={{ fontWeight: index === 0 ? 'bold' : 'normal' }}>{index === 0 ? '1' : index + 1}</span>
-            <span className={style['diag-name']} onClick={() => { this.handleClickDiag(item) }}>{item.name}<span></span></span>
-            {item.type === 1 ? <span className={style['diag-first']}>初诊</span> : <span className={style['diag-second']}> 复诊</span>}
-            <span className={style['treat']}
-              style={hasTreat ? '' : { color: 'gray', cursor: 'text' }}
-              onClick={() => { hasTreat && this.showTreat(item, index) }}>
-              治疗方案
+    render(){
+        const { list, treatment, showReferRecord, showHistoryCase ,chronicMagItem,loading} = this.props;
+        const { visible, treatTitle ,showAssess, isAssessConfirm, radioVal, possible,assessId,disName, hasOndel} = this.state;
+        const chronicList = JSON.parse(localStorage.getItem('chronic')||null);
+        const chronicLine = chronicMagItem&&chronicMagItem.name;     //当前是否走的慢病流程
+        let isChronic = false;      //是否要显示管理评估
+        const footer = <Footer print={true}
+                               footText="确定"
+                               handlePrint={this.onPrint}
+                               handleConfirm={this.handleSaveAssess}/>;
+        return(
+                <div className={style['diaglist-wrap']}>
+                    {list && (list.length > 0) && list.map((item, index) => {
+                        const hasTreat = item.treat && (item.treat.commonTreatment.content || item.treat.surgeryTreatment.content || item.treat.treatment.length>0 ||(item.adverseReactions&&item.adverseReactions.length > 0)
+                           || (item.drugHistory && item.drugHistory['慢病用药内容'] &&  item.drugHistory['慢病用药内容'].length > 0) || (item.drugHistory &&item.drugHistory['普通病用药内容'] &&  item.drugHistory['普通病用药内容'].length > 0) ||item.follow)
+                        isChronic = chronicLine&&item.type==2&&chronicList.findIndex((it)=>it.conceptId==item.conceptId)!=-1;
+                        return (<div draggable={true} className={style['diag-box'] + ' clearfix'}  key={item.id} >
+                                    {index === 0 ? '' : <span className={style['diag-up']} onClick={() => {this.upDiagnostic(index)}}><img className={style["diag-up"]} src={diagUp}/></span>}
+                                    {list.length === 1 ? '' : index !== 0 ? '' : <span onClick={() => {this.downDiagnostic(index)}} className={style['diag-down']}><img className={style["diag-down"]} src={diagDown}/></span>}
+                                    <span className={style['diag-number']} style={{fontWeight:index === 0 ?'bold':'normal'}}>{index === 0 ? '1' : index+1}</span>
+                                    <span className={style['diag-name']} onClick={()=>{this.handleClickDiag(item)}}>{item.name}<span></span></span> 
+                                    {item.type === 1 ? <span className={style['diag-first']}>初诊</span> :<span className={style['diag-second']}> 复诊</span>}
+                                    <span className={style['treat']}
+                                          style ={hasTreat ? '' : { color: 'gray', cursor: 'text'}}
+                                          onClick={() =>{hasTreat && this.showTreat(item, index)}}>
+                                          治疗方案
                                     </span>
-            {isChronic ? <span className={style['assess']}
-              onClick={this.showAssessFn.bind(this, item)}>
-              管理评估
-                                    </span> : ''}
-            <img className={style['diag-del']} src={hasOndel ? del_on : del_icon} onMouseEnter={this.handleEnterDel.bind(this)} onMouseLeave={this.handleLeaveDel.bind(this)} onClick={() => { this.handleDeleteItem(item) }} />
-          </div>)
-        })}
-        {treatment && <Treat title={treatTitle}></Treat>}
-        {showAssess ? <ComplexModal onclose={this.showAssessFn.bind(this)} footer={footer}
-          title='管理和评估'
-          icon={manageIcon}
-          top={'3%'}
-          bottom={'3%'}
-          width={820}>
-          <AssessResult handleSavePossible={this.handleSavePossible}
-            closeAssess={this.showAssessFn.bind(this)}
-            disId={assessId}
-            disName={disName}
-            radioVal={radioVal}
-            possible={possible}
-            isAssessConfirm={isAssessConfirm}
-          ></AssessResult>
-        </ComplexModal> : ''}
-        <ConfirmModal visible={visible}
-          okText='删除'
-          cancelText='取消'
-          confirm={this.deleteItem}
-          cancel={this.cancel}
-          close={this.close}
-        >
-          <div className={style['del-msg']}>是否删除该诊断?</div>
-        </ConfirmModal>
-        <ConfirmModal visible={showReferRecord} okText='是' cancelText='否' confirm={this.referRecord} cancel={this.noReferRecord} close={this.noReferRecord}>
-          <div className={style['confirm-info']}>是否引用往期病历</div>
-        </ConfirmModal>
-        <ConfirmModal visible={showHistoryCase} noFooter='true' title='请选择历史病历' close={this.closeHistoryCaseModal} titleBg="#DFEAFE" icon={tableIcon} height={300}>
-          {this.getHistoryCase()}
-          <div className={style['confirm-history']}><span className={style['confirm-history-btn']} onClick={this.referCase}>确定</span></div>
-        </ConfirmModal>
-        <Loading show={loading} />
-      </div>
-
-    )
-  }
+                                    {isChronic?<span className={style['assess']}
+                                          onClick={this.showAssessFn.bind(this,item)}>
+                                        管理评估
+                                    </span>:''}
+                                    <img className={style['diag-del']} src={hasOndel ? del_on : del_icon} onMouseEnter={this.handleEnterDel.bind(this)} onMouseLeave={this.handleLeaveDel.bind(this)} onClick={()=>{this.handleDeleteItem(item)}}/>
+                        </div>)
+                    })}
+                     {treatment&&<Treat title={treatTitle}></Treat>}
+                     {showAssess?<ComplexModal onclose={this.showAssessFn.bind(this)} footer={footer}
+                                               title='管理和评估'
+                                               icon={manageIcon}
+                                               top={'3%'}
+                                               bottom={'3%'}
+                                               width={820}>
+                       <AssessResult handleSavePossible={this.handleSavePossible}
+                                     closeAssess={this.showAssessFn.bind(this)}
+                                     disId={assessId}
+                                     disName={disName}
+                                     radioVal={radioVal}
+                                     possible={possible}
+                                     isAssessConfirm={isAssessConfirm}
+                                     ></AssessResult>
+                      </ComplexModal>:''}
+                    <ConfirmModal visible={visible} 
+                                  okText='删除' 
+                                  cancelText='取消' 
+                                  confirm={this.deleteItem}  
+                                  cancel={this.cancel}
+                                  close={this.close}
+                                  >
+                                  <div className={style['del-msg']}>是否删除该诊断?</div> 
+                    </ConfirmModal>
+                    <ConfirmModal visible={showReferRecord} okText='是' cancelText='否' confirm={this.referRecord}  cancel={this.noReferRecord} close={this.noReferRecord}>
+                        <div className={style['confirm-info']}>是否引用往期病历</div> 
+                    </ConfirmModal>
+                    <ConfirmModal visible={showHistoryCase} noFooter='true' title='请选择历史病历' close={this.closeHistoryCaseModal} titleBg="#DFEAFE" icon={tableIcon} height={300}>
+                        {this.getHistoryCase()}
+                        <div className={style['confirm-history']}><span className={style['confirm-history-btn']} onClick={this.referCase}>确定</span></div>
+                    </ConfirmModal>
+                    <Loading show={loading}/>
+                </div>
+               
+        )
+    }
 }
 
 export default DiagnosticList;

+ 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

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

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

@@ -29,8 +29,7 @@ class Treat extends Component {
         this.setTreatBox = this.setTreatBox.bind(this);
     }
     componentDidMount(){
-      // dragBox('treatWrapper','dragTreatTitle')
-      dragBox('add','drugWrapper')
+      dragBox('dragModalWrap','dragModalTitle','add','treatDescBox')
     }
     
     hideTreat() {
@@ -39,7 +38,7 @@ class Treat extends Component {
         clearTreat && clearTreat();
         hideTreat && hideTreat();
         hideDrugInfo && hideDrugInfo();
-        dragBox('del')
+        dragBox('dragModalWrap','dragModalTitle','del')
     }
     handlePrescription() {
         Notify.info('该功能即将上线,敬请期待。', 2000)

+ 3 - 4
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/drag'
+import {dragBox} from '@utils/tools'
 import { imageUrlPrefix } from '@utils/config.js';
 
 
@@ -17,8 +17,7 @@ class DrugInfo extends Component {
         this.setDragBox = this.setDragBox.bind(this)
     }
     componentDidMount(){
-      // dragBox('drugWrapper','drugTitle')
-      dragBox('add')
+      dragBox('drugWrapper','drugTitle','add')
     }
     handleClickMenu(index, item, drugDesc) {
         const that = this
@@ -58,7 +57,7 @@ class DrugInfo extends Component {
         const { currentIndex } = this.state
         return (<div className={style['drug-info-wrapper']} id="drugWrapper">
                 <img src={close} onClick={hideDrugInfo} className={style['close-drug-desc']}/>
-                <h3 onMouseDown={this.setDragBox} id="dragModalTitle" className={style['drug-title']}>{drugInfo.tagType == 8 ? drugInfo.title+'说明书' : drugInfo.tagType == 10 ? drugInfo.title+ '说明': ''}</h3>
+                <h3 onMouseDown={this.setDragBox} id="drugTitle" className={style['drug-title']}>{drugInfo.tagType == 8 ? drugInfo.title+'说明书' : drugInfo.tagType == 10 ? drugInfo.title+ '说明': ''}</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.tagType == 8 ? drugInfo.title+'说明书' : drugInfo.tagType == 10 ? drugInfo.title+ '说明': ''}</div>
                     {drugInfo.drugDesc.map((item, index) =>{

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

+ 4 - 2
src/containers/ChronicInfo.js

@@ -45,7 +45,7 @@ function mapDispatchToProps(dispatch){
         item:item?Object.assign({},item):undefined
       })
       if(!param.value){
-        dragBox('del')
+        dragBox('dragModalWrap','dragModalTitle','del')
       }
     },
     getScaleInfo(item){
@@ -126,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){

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

+ 8 - 7
src/utils/drag.js

@@ -11,7 +11,8 @@ import {
 
 let width = '',//屏幕宽度
   height = '', //屏幕高度
-  mouseX = 0, //鼠标距离页面左侧
+  dragWrapper = '',//拖拽元素
+  mouseX = 0,//鼠标距离页面左侧
   mouseY = 0,//鼠标距离页面上部
   dragX = 0,//鼠标可拖拽到左边的最大距离(元素定位左侧距离)
   dragY = 0,//鼠标可拖拽到上边的最大距离(元素定位上边距离)
@@ -24,9 +25,8 @@ let width = '',//屏幕宽度
  * @param {可拖动的区域} dragModalTitle 
  */
 function handleMove(event) {
-  let wrap = $("#dragModalWrap"); //被拖拽的元素
+  let wrap = $("#"+dragWrapper); //被拖拽的元素
   let dragDes = $("#"+addPart); //展開区域
-  console.log(addPart,dragDes[0])
   let page = getPageCoordinate(event, '0');//获取鼠标位置
   let maxDragX = 0,dragDesWidth = 0;
   let wrapHeight = wrap[0].offsetHeight;//直接用.height()获取的高度不准确
@@ -78,12 +78,13 @@ function handleUp(){
  * @param {拖动元素/清除拖动事件监听} type add:添加事件监听  del:移除事件监听
  * @param {展开元素id} addDom 
  */
-function dragBox(type,addDom) {
-  let drag = $("#dragModalTitle"); //拖拽区域
-  let wrap = $("#dragModalWrap"); //被拖拽的元素
+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)
@@ -101,4 +102,4 @@ function dragBox(type,addDom) {
 
 module.exports = {
   dragBox
-}
+}

+ 0 - 1
src/utils/jqprint.js

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

+ 3 - 38
src/utils/tools.js

@@ -767,14 +767,6 @@ function timestampToTime(timestamp) {     //excel导入2019年5月1日会转换
 }
 function dragBox(domWrap,domDrag,type){
   // console.log(domWrap,domDrag,'拖拽')
-
-  // let drag = document.getElementById(domDrag);//拖拽区域
-  // let wrap = document.getElementById(domWrap);//被拖拽的元素
-  // 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;//被拖拽的元素高度
@@ -783,15 +775,14 @@ function dragBox(domWrap,domDrag,type){
   let height = getWindowInnerHeight();//屏幕高度
   let mouseX = 0,mouseY = 0,dragX = 0,dragY = 0,isDrag = false,isMove = false;
   function handleMove(event){      //移动的
-    console.log('move')
     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方向距离
-    if(domDrag == 'dragTreatTitle'){//最大可推拽x方向距离
-      if(dragDes != null){
+    if(domDrag == 'dragModalTitle'){//最大可推拽x方向距离
+      if(dragDes[0]){
         dragDesWidth = dragDes[0].offsetWidth
       }else{
         dragDesWidth = 0
@@ -809,7 +800,7 @@ function dragBox(domWrap,domDrag,type){
       if(dragY < 0){      //不能超出上边界
         dragY = 0
       }
-      if(domDrag == 'dragTreatTitle'){
+      if(domDrag == 'dragModalTitle'){
         if(width-dragX-dragDesWidth < wrapWidth){    //不能超出右边界
           dragX = maxDragX
         }
@@ -830,12 +821,6 @@ function dragBox(domWrap,domDrag,type){
       })
     }
   }
-  if(type === 'del'){
-    console.log(123)
-    // windowRemoveEventHandler('mousemove',handleMove,document)
-    $(document).off('mousemove',handleMove)
-    return
-  }else{
     drag.on('mousedown',function(event){
       let page = getPageCoordinate(event,'0');
       mouseX = page.boxLeft - wrap.offset().left;      //鼠标到拖拽元素的左边界的距离
@@ -847,26 +832,6 @@ function dragBox(domWrap,domDrag,type){
       isDrag = false
       return false
     })
-    // windowEventHandler('mousedown',function(event){    //鼠标位置获取,计算点击位置到拖拽元素左边的距离
-    //   console.log('mousedown')
-    //   let page = getPageCoordinate(event,'0');
-    //   mouseX = page.boxLeft - wrap.offsetLeft      //鼠标到拖拽元素的左边界的距离
-    //   mouseY = page.boxTop - wrap.offsetTop       //鼠标到拖拽元素的上边界的距离
-    //   isDrag = true
-    //   // isMove = false
-    // },drag)
-    // windowEventHandler('mousemove',handleMove,document)
-    // windowEventHandler('mouseup',()=>{
-    //   console.log('mouseup')
-    //   // if(isMove){ //有move就设置位置没有移动就不处理
-    //   //   console.log(dragX)
-    //   //   wrap.style.left = dragX + 'px'
-    //   //   wrap.style.top = dragY + 'px'
-    //   // }
-    //   isDrag = false
-    //   return false
-    // },document)
-  }
 }
 
 function getCurrentDate(){