ソースを参照

Merge remote-tracking branch 'origin/dev/otherHis' into dev/new1

zhouna 6 年 前
コミット
47805f396f

+ 4 - 1
src/common/components/EditableSpan/index.jsx

@@ -96,8 +96,11 @@ class EditableSpan extends Component{
       temp = newText.replace(searchPre,'');
       isEnd = !(newText.indexOf(searchPre)>0);
       search = temp.replace(/[(^\s*)|(\s*$)|(^\,*)|(\,*$)]/g,'');
+      if(!search&&searchPre){
+        search = searchPre;
+      }
       //console.log(labelVal,'旧:',searchPre,'新:',newText,'搜索:',search);
-      if(config.punctuationReg.test(search)){     //只有标点符号时不搜索
+      if(config.punctuationReg.test(search)){    //只有标点符号时不搜索
         handleSearch&&handleSearch({text:search,isEnd,boxMark,mainIds});
       }else{//只有标点符号时要清空搜索结果
         handleClear && handleClear({boxMark})

+ 6 - 1
src/components/MultSpread/index.jsx

@@ -26,6 +26,7 @@ class MultSpread extends Component{
     this.state = {
       editable: false,
     };
+    this.$cont = React.createRef();
     this.changeToEdit = this.changeToEdit.bind(this);
     this.handleEdit = this.handleEdit.bind(this);
   }
@@ -103,7 +104,10 @@ class MultSpread extends Component{
       this.setState({
         editable: true
       });
-      //e.target.focus();
+      //失焦关闭编辑状态
+      setTimeout(()=>{
+        this.$cont.current.focus();
+      });
       //双击埋点记录
       handleDbclick && handleDbclick({id:copyId});
     }
@@ -135,6 +139,7 @@ class MultSpread extends Component{
     return (<div className={this.getContClass()}
                  style={{display:'inline-block'}}
                  onDoubleClick={this.changeToEdit}
+                 ref = {this.$cont}
                  contentEditable={this.state.editable}
                  onBlur={this.handleEdit}
                  onkeydown={tools.handleEnter}>

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

@@ -151,7 +151,10 @@ class NumberUnitDrop extends Component{
         editable: true,
         labelVal:text
       });
-      e.target.focus();
+      //失焦关闭编辑状态
+      setTimeout(()=>{
+        e.target.focus();
+      })
       //双击埋点记录
       handleDbclick && handleDbclick({id:patId||id});
     }

+ 4 - 0
src/components/RadioDrop/index.jsx

@@ -135,6 +135,10 @@ class RadioDrop extends Component{
         editable: true
       });
     };
+    //失焦关闭编辑状态
+    setTimeout(()=>{
+      e.target.focus();
+    })
     handleDbclick&&handleDbclick({id:patId||id});
   }
   render(){

+ 18 - 8
src/components/SpreadDrop/index.jsx

@@ -104,7 +104,10 @@ class SpreadDrop extends Component{
         labelVal:text,
         editable:true
       });
-      e.target.focus();
+      //失焦关闭编辑状态
+      setTimeout(()=>{
+        e.target.focus();
+      })
       handleDbclick && handleDbclick({value,id,placeholder});
     }
   }
@@ -197,7 +200,7 @@ class SpreadDrop extends Component{
     //点确定后隐藏弹窗
     this.props.handleHide();
   }
-  handleSelect(item,isExclu,joint,listIndex,selected){
+  handleSelect(item,isExclu,joint,listIndex,selected){//console.log(item,selected)
     let {withOn,withs,noneOn,exclusion,exists,nowOn,nones,noneIds,ban} = this.state;
     /*if(this.props.selecteds)
     console.log(exists,this.props.selecteds.exists,exists===this.props.selecteds.exists)*/
@@ -222,9 +225,9 @@ class SpreadDrop extends Component{
     }
     //操作单选项
     if(selected){
-      const tIndex= exists.findIndex((it)=>it.id===selected.id);
+      const tIndex= exists.findIndex((it)=>it.questionId===item.questionId);
       if(tIndex!=-1){
-        exists.splice(tIndex,1,{id,name,listIndex});
+        exists.splice(tIndex,1,item);
         this.setState({
           exists,
         })
@@ -286,7 +289,7 @@ class SpreadDrop extends Component{
       }else if(nowOn=='with'){
         withs.push({id:id,name:name});
       }else{
-        exists.push({id:id,name:name,listIndex});
+        exists.push({id:id,name:name,listIndex,questionId:item.questionId});
       }
     }
     this.setState({
@@ -407,9 +410,16 @@ class ListItem extends Component{
     const index=listIndex+''+i;
     //列单选处理
     if(isRadio){
-      const selected = data.find((it)=>{
-        return exists.findIndex((i)=>i.id===it.id)!==-1||noneIds.includes(it.id)||withs.findIndex((i)=>i.id===it.id)!==-1;
+      let selected = exists.find((i)=>{
+        return i.questionId===item.questionId;
+      })||withs.find((i)=>{
+        return i.questionId===item.questionId;
+      })||noneIds.find((i)=>{
+        return i.id===item.questionId;
       });
+      /*const selected = data.find((it)=>{console.log(exists)
+        return exists.findIndex((i)=>i.questionId===it.id)!==-1||noneIds.includes(it.id)||withs.findIndex((i)=>i.questionId===it.id)!==-1;
+      });*/
       if(selected&&selected.id!=item.id){     //该列已有选中项,传回已选中的id,name取消选中
         handleClick&&handleClick(item,isExclu,joint,index,{id:selected.id,name:selected.name});
       }else{
@@ -428,7 +438,7 @@ class ListItem extends Component{
         return style['exclusion'];
       }
     }else{
-      if(isExclu&&[...noneIds,...exists,...withs].length>0){
+      if(isExclu&&([...noneIds,...exists,...withs].length>0||ban.id)){
         return style['exclusion'];
       }
       if(noneIds.includes(id)){

+ 1 - 0
src/config/index.js

@@ -31,6 +31,7 @@ export default {
     delayPushTime:1000,    //延迟推送时间
     pushDelay:1000,
     punctuationReg:/[^,,.。;;、]/g,       //正则表达式,全局查找不是括号内标点的字符
+    punReg:/[,,.。;;、]+/g,
     currentText:"患者XX因XX诊断为(**),经XX治疗后,目前XX症状已缓解,仍有XX,各项指标情况:XX,辅助检查:XX。今来复诊,进一步治疗",
     timeUnit:{
       minute:"分",

+ 1 - 1
src/store/async-actions/fetchModules.js

@@ -99,7 +99,7 @@ export function getInitData(){
       pacs: emrData.pacs,
       sex: emrData.sex,
       vital:emrData.vital,
-      symptom: emrData.current||emrData.main
+      symptom: emrData.current+emrData.main
     };
     json(api.getBigPush,param).then((res)=>{
       if(+res.data.code === 0){

+ 12 - 31
src/utils/tools.js

@@ -490,37 +490,18 @@ function filterArr(arr){
 
 function filterDataArr(arrTmp){   //数据处理
     let tmpArr = [];
-    let arr = arrTmp.join('').split('');
-    for(let i = 0;i < arr.length;i++){
-        if(!(arr[i].match(config.punctuationReg)||arr[i-1])){        //只有标点符号或者前一个标签无值是(说明本标点灰显,不显示在预览中)
-            arr.splice(i,1,'');
-        }
-        if(arr[i] && arr[i].indexOf('undefined') == -1){
-            if(tmpArr[tmpArr.length-1] != ',' && tmpArr[tmpArr.length-1] != ',' ){
-                tmpArr.push(arr[i])
-            }else if((tmpArr[tmpArr.length-1] == ',' && (arr[i] != ',' || arr[i] != ',')) || (tmpArr[tmpArr.length-1] == ',' && (arr[i] != ',' || arr[i] != ','))) {
-              if(arr[i] == '。'){     //前面逗号后面句号 [',','。']
-                tmpArr.pop();
-                tmpArr.push(arr[i]);
-              }else if(tmpArr[tmpArr.length-2] == '。' && (tmpArr[tmpArr.length-1] == ',' || tmpArr[tmpArr.length-1] == ',')){//前面句号后面逗号 ['。',',']
-                tmpArr.pop();
-                tmpArr.push(arr[i]);
-              }else if(arr[i] == ',' || arr[i] == ','){    //  中英文逗号交替[',',',']
-                tmpArr.pop();
-                tmpArr.push(arr[i]);
-              }else if(arr[i] == '、'){    //前面逗号后面句号 [',','、']
-                tmpArr.pop();
-                tmpArr.push(arr[i]);
-              }else if(tmpArr[tmpArr.length-2] == '、' && (tmpArr[tmpArr.length-1] == ',' || tmpArr[tmpArr.length-1] == ',')){    //前面逗号后面句号 ['、',',']
-                tmpArr.splice(tmpArr.length-2,1);
-                tmpArr.push(arr[i]);
-              }else{
-                tmpArr.push(arr[i]);
-              }
-            }
-        }
-    }
-    return (tmpArr.join('')).replace(/^,+/,"").replace(/,+$/,"").replace(/^,+$/,"").replace(/,+$/,"").replace(/^。+/,"").replace(/。+$/,"。");
+    tmpArr = arrTmp.map((it,i)=>{     //连续的标点符号保留第一个
+      if(!it.match(config.punctuationReg)&&!arrTmp[i-1]){        //只有标点符号或者前一个标签无值是(说明本标点灰显,不显示在预览中)
+          return '';
+      }
+      return it.replace(config.punReg,function(word){
+        return word.substr(0,1);
+      });
+    });
+
+    return tmpArr.join('').replace(/^[,,.。;;、]+/,'').replace(/[,,.。;;、]+$/,function(word){
+        return word.substr(0,1);
+    });      //去掉开头的标点符号,最后的标点保留第一个
 }
 // 取消默认行为
 function preventDefault(event) {