Explorar o código

Merge branch 'dev/new1' into dev/zhangxc1

zhangxc %!s(int64=6) %!d(string=hai) anos
pai
achega
b398cbfd1e

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

@@ -224,8 +224,9 @@ class EditableSpan extends Component{
         }*/
         let data = innerVal.trim();
         //判断是否为空、中英文:, 。、;,且不是第一位
-        let pattern = new RegExp(/^\,?$|^\,?$|^\.?$|^\。?$|^\、?$|^\;?$|^\;?$|^\:?$|^\:?$|\s/);
-        if(index!==0 && pattern.test(data)){
+        // let pattern = new RegExp(/^\,?$|^\,?$|^\.?$|^\。?$|^\、?$|^\;?$|^\;?$|^\:?$|^\:?$|\s/);
+        // if(index!==0 && pattern.test(data)){
+        if(index!==0 && !config.punctuationReg.test(data)){
           // let preObj = $(this.$span.current).prev();
           let obj = preObj[0].nodeName=="DIV"?preObj.prev():preObj;
           handleKeydown&&handleKeydown({boxMark,i:index,text:data});

+ 2 - 1
src/common/components/ItemBox/index.less

@@ -24,10 +24,11 @@
     padding:5px;
     outline: none;
     border-bottom:1px @part-border-color dashed;
-    border-radius: 4px;
+    /*border-radius: 4px;*/
   }
   .border {
       border:1px @part-border-color dashed !important;
+      border-radius: 4px;
   }
   .noBorder{
     border: none;

+ 12 - 19
src/common/components/Textarea/index.jsx

@@ -17,7 +17,7 @@ class Textarea extends Component {
     this.$dom = React.createRef();
     this.handleInput = this.handleInput.bind(this);
     this.handleFocus = this.handleFocus.bind(this);
-    this.handleBlur = this.handleBlur.bind(this);
+    //this.handleBlur = this.handleBlur.bind(this);
     this.handleKeydown = this.handleKeydown.bind(this);
   }
   handleFocus(){            //初始显示props中的值,focus已经显示输入的值,避免值更新闪烁
@@ -36,7 +36,7 @@ class Textarea extends Component {
     const text = e.target.innerText || e.target.innerHTML;
     const stimer = this.state.timer;
     if(boxMark=='1'&&text.length>config.limited){           //主诉字符数限制
-      e.target.innerText?(e.target.innerText = text.substr(0,config.limited)):(e.target.innerHTML = text.substr(0,config.limited)); 
+      e.target.innerText?(e.target.innerText = text.substr(0,config.limited)):(e.target.innerHTML = text.substr(0,config.limited));
       e.target.blur();
       Notify.error(config.limitText);
       if(overFlag){
@@ -59,7 +59,7 @@ class Textarea extends Component {
     })
 
     //存值到store
-    // handleInput&&handleInput({text});
+    handleInput&&handleInput({text});
     //右侧推送--延时推送
     clearTimeout(stimer);
     let timer = setTimeout(function(){
@@ -70,6 +70,14 @@ class Textarea extends Component {
       timer
     });
   }
+  handleKeydown(e){
+    const {boxMark} = this.props;
+    const ev = e||window.event;
+    if(+boxMark==1){
+      //禁止回车事件
+      if(ev.keyCode==13){return false;}
+    }
+  }
   shouldComponentUpdate(next){
     if(JSON.stringify(next) == JSON.stringify(this.props)){
       return false;
@@ -85,7 +93,7 @@ class Textarea extends Component {
   componentDidMount(){
     const {value} = this.props;
     if(value){
-      this.$dom.current.innerText?(this.$dom.current.innerText = value||''):(this.$dom.current.innerHTML=value||'');
+      this.$dom.current.innerText?(this.$dom.current.innerText = value||''):(this.$dom.current.innerText=value||'');
     }
     if(isIE()){
       $(this.$dom.current).onIe8Input(function(e){
@@ -93,20 +101,6 @@ class Textarea extends Component {
       },this);
     }
   }
-  handleBlur(){
-    const {handleInput} = this.props;
-    const text = this.$dom.current.innerText||this.$dom.current.innerHTML;
-    //存值到store
-    handleInput&&handleInput({text});
-  }
-  handleKeydown(e){
-    const {boxMark} = this.props;
-    const ev = e||window.event;
-    if(+boxMark==1){
-      //禁止回车事件
-      if(ev.keyCode==13){return false;}
-    }
-  }
   render() {
     const { title } = this.props;
     return (
@@ -118,7 +112,6 @@ class Textarea extends Component {
              ref={this.$dom}
              contentEditable={true}
              onInput={this.handleInput}
-             onBlur={this.handleBlur}
              onkeydown={this.handleKeydown}>
         </div>
       </div>

+ 6 - 7
src/components/CheckBody/index.jsx

@@ -32,17 +32,16 @@ class CheckBody extends Component{
   getLabels(){
     const {data,showArr,saveText,selecteds} = this.props;
     let arr = [],list=[];//console.log(data,saveText)
-    const {boxMark,showAll} = this.state;//console.log(data)
+    const {boxMark,showAll} = this.state;
     const moreNum =data.length-[...data].reverse().findIndex((it)=>it.showInCheck)-1;//被隐藏的位置
-    //console.log(moreNum,this.props.defaultShowAll,showAll);
-    const moreText = filterDataArr([...saveText].splice(moreNum));      //被收起的标签中是否有有值得,有则不能再收起showMoreBtn?more:''
-    const more = this.props.defaultShowAll||showAll?<span className={style['more']} onClick={this.showHide}>收起<img src={hideImg} /></span>:<span className={style['more']} onClick={this.showHide}>展开<img src={showImg} /></span>;
+    const moreText = filterDataArr([...saveText].splice(moreNum+1));      //被收起的标签中是否有有值得,有则不能再收起showMoreBtn?more:''
+    const more = showAll?<span className={style['more']} onClick={this.showHide}>收起<img src={hideImg} /></span>:<span className={style['more']} onClick={this.showHide}>展开<img src={showImg} /></span>;
     const showMoreBtn = data.length>moreNum&&!moreText;
     let showArray = data.filter((it)=>{
       if(it.showInCheck)
         return it;
     });
-    const showData = moreText||this.props.defaultShowAll||showAll?[...data]:showArray;//[...data].splice(0,config.showCheckNum*2+1);
+    const showData = moreText||showAll?[...data]:showArray;//[...data].splice(0,config.showCheckNum*2+1);
     if(showData){
       list = showData;
       arr = list.map((it,i)=>{
@@ -115,9 +114,9 @@ class CheckBody extends Component{
     });
   }
   componentWillUpdate(next){
-    if(!this.props.isEmpty&&next.isEmpty){
+    if((this.props.defaultShowAll&&!next.defaultShowAll)||(!this.props.defaultShowAll&&next.defaultShowAll)||(!this.props.isEmpty&&next.isEmpty)){
       this.setState({
-        showAll:false
+        showAll:next.defaultShowAll
       })
     }
   }

+ 10 - 16
src/components/NumberDrop/index.jsx

@@ -39,7 +39,7 @@ class NumberDrop extends Component{
     this.handleNumFocus = this.handleNumFocus.bind(this);
     this.handleBlur = this.handleBlur.bind(this);
     this.changeToEdit = this.changeToEdit.bind(this);
-    this.handleKeyDowm = this.handleKeyDowm.bind(this);
+    //this.handleKeyDowm = this.handleKeyDowm.bind(this);
     this.beyondArea = this.beyondArea.bind(this);
   }
   select(text){        //选中键盘上数字事件
@@ -54,14 +54,14 @@ class NumberDrop extends Component{
     }else{
       //console.log(text,isNaN(+text),max<+text)
       if(needCompare){
-        if(!isNaN(+text)&&max<+text){     //数值过大
+        if(text!=''&&(isNaN(+text)||max<+text)){    //数值过大
           this.beyondArea();
           return;
         }
         const that = this;
-        timer = setTimeout(function(){
+        timer = setTimeout(function(){      //数值过小
           clearTimeout(that.state.sltTimer);
-          if(!that.props.show&&!isNaN(+text)&&min>+text){
+          if(text!=''&&(isNaN(+text)||min>+text)){
             that.beyondArea();
             return;
           }
@@ -77,7 +77,7 @@ class NumberDrop extends Component{
   }
   beyondArea(){
     const {handleSelect,ikey,suffix,prefix,mainSaveText} = this.props;
-    Notify.info("输入数值不在合理值范围内,请重新输入!");
+    Notify.info("输入数值不符合规范,请重新输入!");
     handleSelect&&handleSelect({ikey,text:'',suffix,prefix,mainSaveText});
     this.setState({
       placeholder:this.props.placeholder,
@@ -140,7 +140,7 @@ class NumberDrop extends Component{
     }
     //输入超出合理范围提示且清空
     const txt = e.target.innerText.replace(/^\s*/,'');
-    if(max!=undefined&&!isNaN(+txt)&&(min>+txt||max<+txt)){
+    if(txt!=''&&(isNaN(+txt)||(max!=undefined&&(min>+txt||max<+txt)))){
       this.beyondArea();
       return;
     }
@@ -151,24 +151,18 @@ class NumberDrop extends Component{
       });
     }
 
-    /*this.setState({
-      hasSelect:false
-    });*/
     const val = e.target.innerText.replace(/^\s*/,'');
     const {placeholder} = this.state;
     let text = val===placeholder?'':val.replace(/[\u4e00-\u9fa5]/g,'');
-    e.target.innerText = '';      //避免出现重复输入值
+    //e.target.innerText = '';      //避免出现重复输入值
     handleSelect&&handleSelect({ikey,text,suffix,prefix,mainSaveText});
   }
   handleSpanInp(e){   //数字框输入事件
     e.stopPropagation();
     const {handleHide} = this.props;
-    /*this.setState({     //再键盘点击数字要清空
-      hasSelect:false
-    });*/
     handleHide&&handleHide();
   }
-  handleKeyDowm(e){
+  /*handleKeyDowm(e){
     handleEnter();
     //只能输入数字
     const key = e.key;
@@ -178,7 +172,7 @@ class NumberDrop extends Component{
       e.preventDefault();
       return false;
     }
-  }
+  }*/
   getClasses(){         //整个标签是否有值的状态
     const {hideTag,placeholder,value} = this.props;
     const $span = this.$span.current;
@@ -248,7 +242,7 @@ class NumberDrop extends Component{
             onBlur={this.numInpBlur}
             onInput={this.handleSpanInp}
             className={this.getSpanClass()}
-            onkeydown={this.handleKeyDowm}>&nbsp;{value||placeholder}</span>
+            >&nbsp;{value||placeholder}</span>
       <span ref = {this.$suf}>&nbsp;{suffix}</span>
       <NumberPan handleSelect={(text)=>this.select(text)}
                  onClose={handleHide}

+ 8 - 10
src/components/Treat/index.jsx

@@ -15,7 +15,7 @@ class Treat extends Component {
     constructor(props){
         super(props);
         this.state = {
-          zIndex:301
+          zIndex:301,
         }
         this.hideTreat = this.hideTreat.bind(this);
         this.handlePrescription = this.handlePrescription.bind(this);
@@ -46,20 +46,18 @@ class Treat extends Component {
         const {  showDrugInfo } = this.props;
         showDrugInfo && showDrugInfo();
     }
-    setTreatBox(idx){
-      this.setState({
-        zIndex:idx == 300?300 : 500
-      })
+    setTreatBox(){
+      $('#treatWrapper').css({'z-index': 302});
+      $('#drugWrapper').css({'z-index': 301});
     }
     render(){
-        const { generalTreat, treatment, treatItem, surgeryTreat, selectDrug, drugInfo, treatDesc, setOtherRecommend, setDrugInfo, showDrug, showDrugInfo,hideDrugInfo, title, drugInfoList, hideDrugInfoMore} = this.props;
-        const { setDrugInfoMore } = this.props
-        const { zIndex } = this.state
+        const {setDrugInfoMore,treatIndex,treatIndexSet, generalTreat, treatment, treatItem, surgeryTreat, selectDrug, drugInfo, treatDesc, setOtherRecommend, setDrugInfo, showDrug, showDrugInfo,hideDrugInfo, title, drugInfoList, hideDrugInfoMore} = this.props;
+        const { zIndex,show } = this.state
         return(
             <div   className={style['treat-wrapper']}>
                 <div className={style['treat-mask']} onClick={this.hideTreat}>
                 </div>
-                <div id="treatWrapper" className={style['treat-box']}  onselectstart="return false" style={{zIndex:zIndex}}>
+                <div id="treatWrapper" 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>
 
@@ -89,7 +87,7 @@ class Treat extends Component {
                     </TreatDesc>}
                 </div>
                 
-                {showDrug && drugInfo && <DrugInfo setTreatBox={this.setTreatBox} drugInfo = {drugInfo} hideDrugInfo = {hideDrugInfo}></DrugInfo>}
+                {showDrug && drugInfo && <DrugInfo setTreatBox={this.setTreatBox} treatIndexSet={treatIndexSet} drugInfo = {drugInfo} hideDrugInfo = {hideDrugInfo}></DrugInfo>}
                 {/* 查询多个药品说明书 (添加数据查看药品说明书用)*/}
                 {/* {showDrug && <DrugInfo drugInfoList = {drugInfoList} hideDrugInfoMore = {hideDrugInfoMore}></DrugInfo>} */}
             </div>

+ 1 - 1
src/components/Treat/index.less

@@ -43,7 +43,7 @@
     z-index: 301;
     padding-top: 40px;
     padding-bottom: 80px;
-    box-shadow: 2px 0px 5px -2px #ccc;
+    box-shadow: 0px 0px 5px -2px #7d7c7c;
 }
 .treat-title {
     width: 100%;

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

@@ -10,7 +10,7 @@ class DrugInfo extends Component {
         super(props);
         this.state = {
             currentIndex: 0,
-            zIndex:301
+            zIndex:302
         }
         this.setDragBox = this.setDragBox.bind(this)
     }
@@ -47,16 +47,13 @@ class DrugInfo extends Component {
         }
     }
     setDragBox(){
-      const {zIndex,setTreatBox} = this.props
-      setTreatBox(300)
-      this.setState({
-        zIndex:zIndex+10
-      })
+      $('#treatWrapper').css({'z-index': 301});
+      $('#drugWrapper').css({'z-index': 302});
     }
     render() {
         const { drugInfo, hideDrugInfo, drugInfoList,hideDrugInfoMore } = this.props
-        const { currentIndex,zIndex } = this.state
-        return (<div className={style['drug-info-wrapper']} id="drugWrapper" style={{zIndex:zIndex}}>
+        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="drugTitle" className={style['drug-title']}>{drugInfo.title}说明书  </h3>
                 { drugInfo && drugInfo.drugDesc.length > 0 && <div className={style['drug-desc-wrapper']} id='drugDesc' onScroll={this.handleScrollModal.bind(this,  drugInfo.drugDesc)}>

+ 1 - 1
src/components/TreatDesc/DrugInfo/index.less

@@ -9,7 +9,7 @@
     background: #fff;
     z-index: 303;
     padding: 40px 0 60px;
-    box-shadow: 2px 0px 5px -2px #ccc;
+    box-shadow: 0px 0px 5px -2px #7d7c7c;
 }
 .drug-desc-wrapper {
     height: 100%;

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

@@ -29,7 +29,7 @@ class TreatDesc extends Component {
         const drugNameWidth = parseInt($('#'+item.medicitionName)[0].offsetWidth)
         
         const imgLeft = drugNameWidth/2-10
-        console.log('imgLeft', imgLeft)
+        // console.log('imgLeft', imgLeft)
         $('#'+item.medicitionName).find('img').css('left', imgLeft)
        
         this.setState({
@@ -59,6 +59,7 @@ class TreatDesc extends Component {
         $('#treatDescBox').css({'display': 'none'});
         $('#treatDescBox').animate({'display': 'none'}, 500);
         $('#treatWrapper').animate({'margin-left': '-340px','left':'50%'}, 500);
+        
     }
 
     render(){

+ 1 - 1
src/components/TreatDesc/index.less

@@ -45,7 +45,7 @@
     top: 0;
     background: #fff;
     padding: 60px 20px 80px;
-    box-shadow: 2px 0px 5px -2px #ccc;
+    box-shadow: 2px 0px 5px -2px #7d7c7c;
 }
 .drug-name-box {
     display: inline-block;

+ 5 - 1
src/containers/MultSpread.js

@@ -5,7 +5,7 @@ import {SETSELECTED,CLEARSELECTED,CONFIRMSELECTED,CHANGEOTHERTEXTLABEL,OTHERADDL
 import {CHANGECHECKTEXTLABEL,ADDLABELITEM} from '@types/checkBody.js';
 import {CHANGE_LABELVAL,MAINADDLABELITEM} from '@store/types/mainSuit.js';
 import {CURRENTADDLABELITEM} from '@store/types/currentIll.js';
-import {HIDE,RESET,CLICKCOUNT,SETADDITEMINIT} from '@store/types/homePage.js';
+import {HIDE,RESET,CLICKCOUNT,SETADDITEMINIT,ISREAD} from '@store/types/homePage.js';
 
 function mapStateToProps(state){
   return {}
@@ -27,6 +27,10 @@ const getCopyData = (copyId,inx,boxMark)=>{
       data:JSON.stringify(copy),
       i:inx
     });
+    //自由文本组件更新
+    dispatch({
+      type:ISREAD
+    })
   }
 };
 

+ 4 - 1
src/containers/NumberDrop.js

@@ -3,7 +3,7 @@ import {connect} from 'react-redux';
 import NumberDrop from "@components/NumberDrop";
 import {SETNUMBER,CHANGEOTHERTEXTLABEL,CHANGEOTHERTEXTLABEL_NUMBER} from '@types/otherHistory';
 import {SETNUMBER4,CHANGECHECKTEXTLABEL,CHANGECHECKTEXTLABEL_NUMBER} from '@types/checkBody.js';
-import {SETDROPSHOW,CLICKCOUNT,HIDE,RESET,HIDEDROP} from '@types/homePage.js';
+import {SETDROPSHOW,CLICKCOUNT,HIDE,RESET,HIDEDROP,ISREAD} from '@types/homePage.js';
 import {NUMBER_SELECT,CHANGE_LABELVAL,CHANGE_LABELVAL_NUMBER} from '@store/types/mainSuit.js';
 import {getLabelIndex} from '@common/js/func.js';
 import {CURRENT_NUMBER,CURRENT_TEXT_LABEL,CURRENT_TEXT_LABEL_NUMBER} from '@store/types/currentIll.js';
@@ -90,6 +90,9 @@ function currentLabel(dispatch,params){
     // type:CURRENT_TEXT_LABEL,
     type:CURRENT_TEXT_LABEL_NUMBER,
     data:Object.assign({},params,{ikey})
+  });
+  dispatch({
+    type:ISREAD
   })
 }
 

+ 1 - 1
src/containers/SpreadDrop.js

@@ -205,7 +205,7 @@ function otherHisConfirm(dispatch,store,params){
       });
       dispatch({
         type: CONFIRMSELECTED,
-        data: {exists:fullfillText(has,false,false).newArr,withs:fullfillText(wes,false,false).newArr,nones:nones,ikey,copyType}
+        data: {exists:fullfillText(has,false,true).newArr,withs:fullfillText(wes,false,true).newArr,nones:nones,ikey,copyType}
       });
       dispatch({
         type:ISREAD

+ 1 - 4
src/store/actions/mainSuit.js

@@ -384,22 +384,19 @@ export const insertSearch = (state,action)=>{
     if(index < 1){//前
       if(data[focusIndex].value==searchStr){//为空标签则替换
         res.data.splice(focusIndex,1,nText);
-        res.saveText.splice(focusIndex,1,searchData);
       }else{
         res.data.splice(focusIndex,0,nText);
-        res.saveText.splice(focusIndex,0,searchData);
         res.data[focusIndex+1].value = value;
         res.saveText[focusIndex+1] = value;
       }  
     }else{
       res.data.splice(focusIndex+1,0,nText);
-      res.saveText.splice(focusIndex+1,0,searchData);
       res.data[focusIndex].value = value;
     }
     span.current.innerText?(span.current.innerText = value):(span.current.innerHTML=value);
     res.mainIds.push(id);
   }
-  // console.log(456,res,action);
+  res.saveText = fullfillText(res.data).saveText;
   res.update=Math.random();
   return res;
 }

+ 0 - 3
src/store/actions/otherHistory.js

@@ -37,7 +37,6 @@ export const confirm = (state,action) =>{
     return res;
   }
   //有,伴,无随配
-  //arr.splice(ikey-1,1);
   let flabel = items[items.length-1];         //要插入的最后一个标签
   let labelText = flabel.value!==undefined?flabel.value:flabel.name;
   let text = labelText;
@@ -47,8 +46,6 @@ export const confirm = (state,action) =>{
     text = flabel.value;
   }
   arr.splice(ikey,0,...exists,...withs);
-  //arr[ikey-1].value = text;
-  //res.saveText[ikey+items.length] = text;
   res.saveText = fullfillText(arr).saveText;
   res.update=Math.random();         //用于触发组件更新(data变化了因在对象中无法被组件检测到)
   return res;

+ 0 - 1
src/store/types/treat.js

@@ -15,4 +15,3 @@ export const SET_TREAT_INFO = 'SET_TREAT_INFO' //设置治疗方案信息(name
 export const SET_DRUG_INFO_LIST = 'SET_DRUG_INFO_LIST' //查询多个药品说明书(添加数据时查看药品说明用)
 export const IS_FIRST_MAIN_DIAG = 'IS_FIRST_MAIN_DIAG' //是否为主诊断第一次开单
 export const CLEAR_FIRST_MAIN_DIAG = 'CLEAR_FIRST_MAIN_DIAG' //回读清空是否为主诊断第一次开单
-

+ 9 - 5
src/utils/tools.js

@@ -587,7 +587,10 @@ function trimDots(str){
 //标签间连续标点只保留一个,保留前面一个
 function formatContinueDots(data){
   let arr=data.filter((it,i)=>{
-    if(!(it.name==','&&data[i-1].name==',')){
+    if(i==0||(it.name&&(it.name.match(config.punctuationReg))||(data[i-1].name&&data[i-1].name.match(config.punctuationReg)))){
+      return it;
+    }
+    if(!it.name){       //主诉现病史病情变化
       return it;
     }
   });
@@ -799,10 +802,11 @@ function dragBox(domWrap,domDrag){
     }
   },document)
   windowEventHandler('mouseup',()=>{
-    if(isMove){ //有move就设置位置没有移动就不处理
-      wrap.style.left = dragX + 'px'
-      wrap.style.top = dragY + 'px'
-    }
+    // if(isMove){ //有move就设置位置没有移动就不处理
+      // console.log(dragX)
+      // wrap.style.left = dragX + 'px'
+      // wrap.style.top = dragY + 'px'
+    // }
     isDrag = false
     return false
   },document)