Browse Source

Merge branch 'dev/new1' of http://192.168.2.236:10080/zhouna/newICSS into dev/new1

luolei 5 years ago
parent
commit
60265ad774

+ 5 - 2
src/common/components/EditableSpan/index.jsx

@@ -340,8 +340,11 @@ class EditableSpan extends Component{
     setSelectArea({i,boxMark,dir:'start'});
   }
   selectEnd(){
-    const {i,setSelectArea,boxMark}= this.props;
-    setSelectArea({i,boxMark,dir:'end'});
+    const {i,setSelectArea,boxMark,select_start}= this.props;
+    if(select_start!==i){     //判断不能省,否则无法聚焦
+      setSelectArea({i,boxMark,dir:'end'});
+      window.getSelection().empty();
+    }
   }
   getClass(){
     const {full,value,saveText,i,preIsExt,afterIsExt,mouseSelect} = this.props;

+ 3 - 9
src/components/MultSpread/index.jsx

@@ -9,7 +9,7 @@ import addIcon from '@images/addItem.png';
 import addIcon1 from '@images/addItem2.png';
 import style from "./index.less";
 import tools from '@utils/tools';
-import {setFontColorSize} from '@utils/tools';
+import {setFontColorSize,handleMouseUp} from '@utils/tools';
 import NumberUnitDrop from '@containers/NumberUnitDrop';
 
 
@@ -240,12 +240,6 @@ class MultSpread extends Component{
     });
     return list;
   }
-  handleMouseUp(){
-    const {select_start,i,setSelectArea,boxMark}= this.props;
-    if(select_start!==undefined){
-      setSelectArea({i,boxMark,dir:'end'});
-    }
-  }
   handleMouseDown(){
     const {i,setSelectArea,boxMark}= this.props;
     setSelectArea({i,boxMark,dir:'start'});
@@ -270,10 +264,10 @@ class MultSpread extends Component{
     return classNames(orgBorder,ext,selectedArea);
   }
   render(){
-    const {showAdd,addLabelItem,ikey,copyId,textPrefix,textSuffix,isExtBlue} = this.props;
+    const {showAdd,addLabelItem,ikey,copyId,textPrefix,textSuffix,isExtBlue,select_start,i,boxMark} = this.props;
     return (<div className={this.getContClass()}
                  style={{display:'inline-block'}}
-                 onMouseUp={this.handleMouseUp.bind(this)}
+                 onMouseUp={()=>handleMouseUp({select_start,i,boxMark})}
                  onMouseDown={this.handleMouseDown.bind(this)}>
         {textPrefix?<span className="prefixUnset">{textPrefix}</span>:''}
         <div className={this.getClass()}>

+ 3 - 9
src/components/Multiple/index.jsx

@@ -2,7 +2,7 @@ import react from "react";
 import style from "./index.less";
 import $ from 'jquery';
 import classNames from 'classnames';
-import {handleEnter,isIE,filterArr,deepClone,filterDataArr,setFontColorSize} from '@utils/tools.js';
+import {handleEnter,isIE,filterArr,deepClone,filterDataArr,setFontColorSize,handleMouseUp} from '@utils/tools.js';
 import {Notify} from '@commonComp';
 import SlideItem from "./SlideItem";
 import config from '@config/index.js';
@@ -161,12 +161,6 @@ class Multiple extends react.Component{
     handleConfirm&&handleConfirm(params);
     handleHide&&handleHide();
   }
-  handleMouseUp(){
-    const {select_start,i,setSelectArea,boxMark}= this.props;
-    if(select_start!==undefined){
-      setSelectArea({i,boxMark,dir:'end'});
-    }
-  }
   handleMouseDown(){
     const {i,setSelectArea,boxMark}= this.props;
     setSelectArea({i,boxMark,dir:'start'});
@@ -179,7 +173,7 @@ class Multiple extends react.Component{
     }
   }
   render(){
-    const {placeholder,value,show,data,hideTag} = this.props;
+    const {placeholder,value,show,data,hideTag,select_start,i,boxMark} = this.props;
     const {editable,seleData,seleId} = this.state;
     return <div className={style["container"]}>
       <div className={this.getClass()}
@@ -189,7 +183,7 @@ class Multiple extends react.Component{
       onBlur={this.handleBlur}
       onInput={this.onChange}
       onKeyDown={handleEnter}
-      onMouseUp={this.handleMouseUp.bind(this)}
+      onMouseUp={()=>handleMouseUp({select_start,i,boxMark})}
       onMouseDown={this.handleMouseDown.bind(this)}
       contentEditable={editable}>{value||placeholder}</div>
       <div className={this.getListClass()} contentEditable="false">

+ 3 - 9
src/components/NumberDrop/index.jsx

@@ -2,7 +2,7 @@ import React,{Component} from 'react';
 import className from 'classnames';
 import {NumberPan,Notify} from '@commonComp';
 import style from './index.less';
-import {setFontColorSize} from '@utils/tools'
+import {setFontColorSize,handleMouseUp} from '@utils/tools'
 /***
  * author:zn@2018-11-19
  * 接收参数:
@@ -218,12 +218,6 @@ class NumberDrop extends Component{
   stopBubble(e){
     e.stopPropagation();
   }
-  handleMouseUp(){
-    const {select_start,i,setSelectArea,boxMark}= this.props;
-    if(select_start!==undefined){
-      setSelectArea({i,boxMark,dir:'end'});
-    }
-  }
   handleMouseDown(){
     const {i,setSelectArea,boxMark}= this.props;
     setSelectArea({i,boxMark,dir:'start'});
@@ -259,13 +253,13 @@ class NumberDrop extends Component{
     });
   }
   render(){
-    const {prefix,suffix,show,value,handleHide,allClick,bmi,formulaCode,nospecial,isSelectAll,isExtBlue} = this.props;
+    const {prefix,suffix,show,value,handleHide,allClick,bmi,formulaCode,nospecial,isSelectAll,isExtBlue,select_start,i,boxMark} = this.props;
     const val = formulaCode==="BMI_RES"?(+bmi===Infinity||isNaN(bmi)?'':bmi):value;
     const {placeholder,hasSelect} = this.state;
     return <div className={this.getClasses(nospecial)}
                 style={{position:'relative'}}
                 onClick={allClick?this.handleNumClick:null}
-                onMouseUp={this.handleMouseUp.bind(this)}
+                onMouseUp={()=>handleMouseUp({select_start,i,boxMark})}
                 onMouseDown={this.handleMouseDown.bind(this)}>
       <span className={`${setFontColorSize(val?'':isSelectAll?2:isExtBlue?2:1)} prefixUnset`}>{prefix}</span>
       <span onFocus={this.handleNumFocus}

+ 3 - 10
src/components/NumberUnitDrop/index.jsx

@@ -3,7 +3,7 @@ import className from 'classnames';
 import {NumberUnitPan} from '@commonComp';
 import style from './index.less';
 import config from '@config/index.js';
-import {filterArr,handleEnter,isIE,filterDataArr,setFontColorSize} from '@utils/tools.js';
+import {filterArr,handleEnter,isIE,filterDataArr,setFontColorSize,handleMouseUp} from '@utils/tools.js';
 import {Notify} from '@commonComp';
 import $ from 'jquery';
 /***
@@ -67,13 +67,6 @@ class NumberUnitDrop extends Component{
     });
     handleHide&&handleHide();
   }
-
-  handleMouseUp(){
-    const {select_start,i,setSelectArea,boxMark}= this.props;
-    if(select_start!==undefined){
-      setSelectArea({i,boxMark,dir:'end'});
-    }
-  }
   handleMouseDown(){
     const {i,setSelectArea,boxMark}= this.props;
     setSelectArea({i,boxMark,dir:'start'});
@@ -103,11 +96,11 @@ class NumberUnitDrop extends Component{
   }
 
   render(){
-    const {placeholder,prefix,suffix,show,value,handleHide,hideTag,isExtBlue} = this.props;
+    const {placeholder,prefix,suffix,show,value,handleHide,select_start,i,boxMark} = this.props;
     const {editable,hasSelect} = this.state;
     return <div className={this.getClasses()}
                 ref={this.$cont}
-                onMouseUp={this.handleMouseUp.bind(this)}
+                onMouseUp={()=>handleMouseUp({select_start,i,boxMark})}
                 onMouseDown={this.handleMouseDown.bind(this)}
                 onClick={this.handleNumClick}>
       <span ref = {this.$pre} className="prefixUnset">{prefix?prefix+' ':prefix}</span>

+ 3 - 9
src/components/RadioDrop/index.jsx

@@ -1,5 +1,5 @@
 import React,{Component} from 'react';
-import {handleEnter,windowEventHandler,setFontColorSize} from '@utils/tools.js';
+import {handleEnter,windowEventHandler,setFontColorSize,handleMouseUp} from '@utils/tools.js';
 import {DropList} from '@commonComp';
 import classNames from 'classnames';
 import style from "./index.less";
@@ -149,18 +149,12 @@ class RadioDrop extends Component{
     })
     handleDbclick&&handleDbclick({id:patId||id});
   }
-  handleMouseUp(){
-    const {select_start,i,setSelectArea,boxMark}= this.props;
-    if(select_start!==undefined){
-      setSelectArea({i,boxMark,dir:'end'});
-    }
-  }
   handleMouseDown(){
     const {i,setSelectArea,boxMark}= this.props;
     setSelectArea({i,boxMark,dir:'start'});
   }
   render(){
-    const {data,placeholder,show,value,hideTag,boxMark} = this.props;
+    const {data,placeholder,show,value,hideTag,boxMark,select_start,i} = this.props;
     const {tmpDom} = this.state
     if(!show&&tmpDom){
       $(tmpDom).parent().prev().attr({"contentEditable":true})
@@ -172,7 +166,7 @@ class RadioDrop extends Component{
            onDoubleClick={hideTag?null:this.handledbClick}
            onFocus={(e)=>{e.stopPropagation()}}
            onClick={(e)=>this.handleShow(e,true)}
-           onMouseUp={this.handleMouseUp.bind(this)}
+           onMouseUp={()=>handleMouseUp({select_start,i,boxMark})}
            onMouseDown={this.handleMouseDown.bind(this)}
            onKeyDown={handleEnter}>
         {value||placeholder}

+ 3 - 9
src/components/RadioInpDrop/index.jsx

@@ -1,5 +1,5 @@
 import React,{Component} from 'react';
-import {handleEnter,windowEventHandler,filterDataArr,getLabelIndex,setFontColorSize} from '@utils/tools.js';
+import {handleEnter,windowEventHandler,filterDataArr,getLabelIndex,setFontColorSize,handleMouseUp} from '@utils/tools.js';
 import {DropList,Notify} from '@commonComp';
 import config from '@config/index';
 import style from "./index.less";
@@ -96,12 +96,6 @@ class RadioInpDrop extends Component{
     });
     handleSaveInp({values:vals,ikey,boxMark,mainSaveText});
   }
-  handleMouseUp(){
-    const {select_start,i,setSelectArea,boxMark}= this.props;
-    if(select_start!==undefined){
-      setSelectArea({i,boxMark,dir:'end'});
-    }
-  }
   handleMouseDown(){
     const {i,setSelectArea,boxMark}= this.props;
     setSelectArea({i,boxMark,dir:'start'});
@@ -129,11 +123,11 @@ class RadioInpDrop extends Component{
     return list;
   }
   render(){
-    const {data,show,vals,placeholder} = this.props;
+    const {data,show,vals,placeholder,select_start,i,boxMark} = this.props;
     return <div className={style['container']} ref = {this.$cont}>
       <div className={this.getClass()}
            onClick={(e)=>this.handleShow(e)}
-           onMouseUp={this.handleMouseUp.bind(this)}
+           onMouseUp={()=>handleMouseUp({select_start,i,boxMark})}
            onMouseDown={this.handleMouseDown.bind(this)}
            onKeyDown={handleEnter}>
         {vals?this.parseInputDom():<span className='inheritStyle'>{placeholder}</span>}

+ 5 - 11
src/components/SpreadDrop/index.jsx

@@ -2,7 +2,7 @@ import React,{Component} from 'react';
 import classNames from 'classnames';
 import config from '@config/index.js';
 import style from './index.less';
-import {setPosition,deepClone,handleEnter,isIE,windowEventHandler,filterDataArr,getIds,getPageCoordinate,setFontColorSize} from '@utils/tools.js';
+import {setPosition,deepClone,handleEnter,isIE,windowEventHandler,filterDataArr,getIds,getPageCoordinate,setFontColorSize,handleMouseUp} from '@utils/tools.js';
 import {Notify} from '@commonComp';
 import ListItems from '@components/ListItems';
 import CommonSymptom from '@components/CommonSymptom';
@@ -374,12 +374,6 @@ class SpreadDrop extends Component{
     const showDefaulted = ((type=='2'&&curDefault)||(type=='3'&&otherDefault))&&showVal;
     return showDefaulted;
   }
-  handleMouseUp(){
-    const {select_start,i,setSelectArea,boxMark}= this.props;
-    if(select_start!==undefined){
-      setSelectArea({i,boxMark,dir:'end'});
-    }
-  }
   handleMouseDown(){
     const {i,setSelectArea,boxMark}= this.props;
     setSelectArea({i,boxMark,dir:'start'});
@@ -392,11 +386,11 @@ class SpreadDrop extends Component{
     }
   }
   render(){
-    const {placeholder,value,show,data,order,type,tagType,pos,defaulted,showVal,CommonSymptoms} = this.props;
+    const {placeholder,value,show,data,order,type,tagType,pos,defaulted,showVal,CommonSymptoms,select_start,i,boxMark} = this.props;
     const {tmpDom,left} = this.state;
     let showDefaulted = this.ifDefault();
-    let showV = showDefaulted&&value===undefined?showVal:value;       //未选中过值时展示默认选中
-    const noPushData = (+tagType===11)&&(!data[1]||data[1].questionDetailList.length===0);    //无推送数据
+    let showV = showDefaulted&&value===undefined?showVal:value;      //未选中过值时展示默认选中
+    const noPushData = (+tagType===11)&&(!data[1]||!data[1].questionDetailList||data[1].questionDetailList.length===0);    //无推送数据
     const showCommonData = (+type===2)&&(+tagType===11)&&noPushData&&CommonSymptoms.length>0?true:false;
     if(!show&&tmpDom){
       $(tmpDom).parent().prev().attr({"contentEditable":true})
@@ -414,7 +408,7 @@ class SpreadDrop extends Component{
         onBlur={this.handleBlur}
         onInput={this.onChange}
         onkeydown={handleEnter}
-        onMouseUp={this.handleMouseUp.bind(this)}
+        onMouseUp={()=>handleMouseUp({select_start,i,boxMark})}
         onMouseDown={this.handleMouseDown.bind(this)}
         >{showV||placeholder}</div>
       {showCommonData&&show?<CommonSymptom data={CommonSymptoms} show={true} onSelect={this.handleCommonSelect.bind(this)} isCurrent={true} />:

+ 1 - 0
src/containers/EditableSpan.js

@@ -16,6 +16,7 @@ function mapStateToProps(state){//console.log(state)
     isRead:state.homePage.isRead,
     data:state.currentIll.data,
     select_end:state.homePage.select_end,
+    select_start:state.homePage.select_start,
   }
 }
 

+ 5 - 2
src/modules/HomePage/index.jsx

@@ -6,7 +6,7 @@ import BodyContainer from "@components/BodyContainer";
 import {ConfirmModal} from '@commonComp';
 import store from '@store';
 
-import {HIDEDROP,SETMINSCREEN,SETSYSTEMCONFIG,SETPRE,SETREADDITEMS,RESET_SELECT_TAG} from '@store/types/homePage.js';
+import {HIDEDROP,SETMINSCREEN,SETSYSTEMCONFIG,SETPRE,SETREADDITEMS,RESET_SELECT_TAG,ISREAD} from '@store/types/homePage.js';
 import {billing} from '@store/async-actions/pushMessage';
 import {CLEAR_SEARCH,DELETE_MAIN_SELECTED_TAGS} from '@types/mainSuit';
 import {CURRENT_CLEAR,DELETE_CURRENT_SELECTED_TAGS} from '@types/currentIll';
@@ -168,7 +168,7 @@ const mapDispatchToProps = function (dispatch) {
         const start = homePage.select_start;
         const end = homePage.select_end;
         const boxMark = homePage.select_boxMark;
-        if(!boxMark)return;
+        if(!boxMark||start===undefined||end===undefined)return;
         //删除后清除选中标记,放在删除事件后面会有清空不及时的问题
         dispatch({
           type:RESET_SELECT_TAG
@@ -179,6 +179,9 @@ const mapDispatchToProps = function (dispatch) {
           end,
           boxMark
         });
+        dispatch({
+          type:ISREAD
+        })
       },
       resetSelect(){
           dispatch({

+ 7 - 4
src/store/actions/checkBody.js

@@ -1,5 +1,5 @@
 import config from '@config/index.js';
-import {formatContinueDots,getLabelIndex,handleLocalDelTag,checkFullfillText,shiftLocalDelTag,getValuedLabels,removeRepeat} from '@utils/tools.js';
+import {formatContinueDots,getLabelIndex,handleLocalDelTag,checkFullfillText,shiftLocalDelTag,getLifeLabels,getValuedLabels,removeRepeat} from '@utils/tools.js';
 
 export function preSetCheckbody(state,action) {
   let res = Object.assign({},state);
@@ -340,9 +340,12 @@ export function recoveTag(state,action) {
 
 export function reflashLabels(state,action) {
   let res = Object.assign({},state);
-  const valuedLabels = getValuedLabels(res.data);
-  const newLabels = removeRepeat(valuedLabels,action.data);
-  const addTextsArr = checkFullfillText(newLabels);
+  const newLifeLabels = getLifeLabels(action.data);     //新生命体征标签
+  const oldLifeLabels = getLifeLabels(res.data);     //旧生命体征标签
+  const oldValuedLabels = getValuedLabels(res.data);    //旧已填值标签
+  const lifeLabels = removeRepeat(newLifeLabels,oldLifeLabels);   //将被保留的生命体征标签
+  const newUnlifeLabels = getLifeLabels(action.data,true);    //新非生命体征标签
+  const addTextsArr = checkFullfillText([...lifeLabels,...oldValuedLabels,...newUnlifeLabels]);
   res.data = addTextsArr.newArr;
   res.saveText = addTextsArr.saveText;
   res.update = Math.random();

+ 30 - 10
src/utils/tools.js

@@ -7,7 +7,7 @@ import {clearAssistData,addAssistLabel} from '@store/actions/assistCheck';
 import {clearAllLabel,addLabel} from '@store/actions/inspect';
 import {CLEAR_ALL_DIAG} from '@store/types/diagnosticList';
 import {CLEAR_ALL_PUSH_MESSAGE, SET_TIPS,BILLING_ADVICE,PUSHCHANGE} from '@store/types/pushMessage';
-import {ISREAD, SETREADDITEMS} from "../store/types/homePage";
+import {ISREAD, SETREADDITEMS,SET_SELECTED_AREA} from "../store/types/homePage";
 import {CLEAR_FIRST_MAIN_DIAG, CLEAR_ALL_TREAT} from "../store/types/treat";
 import {tabChange} from '@store/actions/tabTemplate';
 import {CLEAR_ASSESS_RESULT_VALUE} from '@types/assessResult';
@@ -1278,7 +1278,6 @@ function getPushList(data1,data2){     //推送数据
     return totalTmpArr;
 }
 function getPushLists(data1,data2){     //推送数据
-  console.log(data1,data2)
     let tmpArr1 = [];
     let tmpArr2 = [];
     let totalTmpArr = [];
@@ -1510,16 +1509,24 @@ const setFontColorSize = (flg,pacs) => {
   // }, 0);
 }
 
-//获取查体体征和已选中的标签
+//获取生命体征或非生命体征标签
+function getLifeLabels(arr,flag){     //flag=true获取非生命体征
+  const newArr = arr.filter((it)=>{
+    return flag?+it.specFlag!==4:+it.specFlag===4;
+  });
+  return newArr;
+}
+
+//获取已选中的标签
 function getValuedLabels(arr){
   const newArr = arr.filter((it)=>{
     if(it.tagType=='3'){      //血压类型
-      if(it.questionMapping.findIndex((i)=>i.value!==undefined)!==-1||+it.specFlag===4){
+      if(+it.specFlag!==4&&it.questionMapping.findIndex((i)=>i.value!==undefined)!==-1){
         return true;
       }
       return false;
     }
-    return it.value||+it.specFlag===4;
+    return +it.specFlag!==4&&it.value;
   });
   return newArr;
 }
@@ -1528,22 +1535,33 @@ function getValuedLabels(arr){
 function removeRepeat(arr1,arr2){     //arr1被完全保留的数组
   const arr = arr2.reduce(function(newArr,item){
     const it = newArr.findIndex((i)=>i.id===item.id);
-    if(it===-1){
-      newArr.push(item);
+    if(it!==-1){
+      newArr.splice(it,1,item);
     }
     return newArr;
   },[...arr1]);
   return arr;
 }
 
+function handleMouseUp(param){
+  const {select_start,i,boxMark}= param;
+  if(select_start!==undefined){
+    store.dispatch({
+      type:SET_SELECTED_AREA,
+      data:{i,boxMark,dir:'end'}
+    });
+    window.getSelection().empty();
+  }
+}
+
 //判断不同科室内容是否相同
 function checkDeptContent(jsonStr,tmpLis){
   for(let i = 0;i <tmpLis.length;i++){
     let dataStr = tmpLis[i].preview;
     if(
-      filterDataArr(JSON.parse(jsonStr.chief)) == filterDataArr(eval('('+JSON.parse(dataStr).chief+')')) && 
-      filterDataArr(JSON.parse(jsonStr.present)) == filterDataArr(eval('('+JSON.parse(dataStr).present+')')) && 
-      filterDataArr(JSON.parse(jsonStr.other)) == filterDataArr(eval('('+JSON.parse(dataStr).other+')')) && 
+      filterDataArr(JSON.parse(jsonStr.chief)) == filterDataArr(eval('('+JSON.parse(dataStr).chief+')')) &&
+      filterDataArr(JSON.parse(jsonStr.present)) == filterDataArr(eval('('+JSON.parse(dataStr).present+')')) &&
+      filterDataArr(JSON.parse(jsonStr.other)) == filterDataArr(eval('('+JSON.parse(dataStr).other+')')) &&
       filterDataArr(JSON.parse(jsonStr.vital)) == filterDataArr(eval('('+JSON.parse(dataStr).vital+')')) &&
       jsonStr.lis == JSON.parse(dataStr).lis &&
       jsonStr.pacs == JSON.parse(dataStr).pacs &&
@@ -1609,7 +1627,9 @@ module.exports = {
     setFontColorSize,
     moveEnd,
     setFontColorSize,
+    getLifeLabels,
     getValuedLabels,
     removeRepeat,
+    handleMouseUp,
     checkDeptContent
 };

+ 9 - 2
src/utils/utils.js

@@ -145,6 +145,12 @@ export function recoveTag(state,action) {
   if(!isArr){
     arr.splice(action.index,0,action.data);
   }else{
+    //恢复连续选中删除的标签,先判断需恢复的标签中是否有子模板,有则删除数据中的子模板标签,然后恢复被删除的标签(子模板只有一个)
+    const sonModuleInx =  action.data.findIndex((it)=>it.flag=='3');    //是否有子模板
+    if(sonModuleInx!==-1){
+      const sonMInx = arr.findIndex((it)=>it.flag=='3');
+      arr.splice(sonMInx,1);
+    }
     arr.splice(action.index,0,...action.data);
   }
   const dataArr = fullfillText(arr);
@@ -248,18 +254,19 @@ export function deleteSelectedLabels(state,action){
   const {start,end,boxMark} = action;
   let n = Math.abs(end-start)+1;
   const arr = res.data;
+  const sonModuleInx = arr.findIndex((it)=>it.flag=='3');
   const startIsText = arr[start].tagType=='8';
   const endIsText = arr[end].tagType=='8';
   if(!startIsText&&!endIsText){
     n=Math.abs(end-start)+2;
   }
   if(start>end){      //从后往前选中
-    const temp = arr.splice(end,n);
+    const temp = end<sonModuleInx&&sonModuleInx<start?arr.splice(end,n,arr[sonModuleInx]):arr.splice(end,n);
     handleLocalDelTag(boxMark,end,temp);
   }else if(start===end){
     return res;
   }else{
-    const temp = arr.splice(start,n);
+    const temp = start<sonModuleInx&&sonModuleInx<end?arr.splice(start,n,arr[sonModuleInx]):arr.splice(start,n);
     handleLocalDelTag(boxMark,start,temp);
   }
   const newObj = boxMark=='4'?checkFullfillText(arr):fullfillText(arr);