Bläddra i källkod

现病史搜索标签类型为4的显示处理

liucf 6 år sedan
förälder
incheckning
8cbee7875e

+ 5 - 5
src/components/MainSuit/index.jsx

@@ -249,16 +249,16 @@ class MainSuit extends Component{
       }
     }
     // 延时关闭常见症状下拉、清空搜索结果,不延时会影响选中
-      /*clearTimeout(this.state.clearTimer);
+      clearTimeout(this.state.clearTimer);
       const clearTimer = setTimeout(function(){
         clearSearch && clearSearch();
-        that.setState({
-          symptom:false
-        })
+        // that.setState({
+        //   symptom:false
+        // })
       },config.delayTime-200);
       this.setState({
         clearTimer
-      });*/  
+      });  
   }
 
 

+ 1 - 1
src/store/actions/checkBody.js

@@ -191,7 +191,7 @@ export function insertLabelData(state,action){
   let res = Object.assign({},state);
   const text = Object.assign({},JSON.parse(config.textLabel));
   const searchStr = res.searchStr;
-  const {index,data,isReplace,span,searchInEnd}=action;
+  const {index,data,isReplace,span,searchInEnd}=action;console.log("查体",data);
   const showText = res.saveText[index];
   const spreadLabels = data.tagType==4?fullfillText(data.questionMapping).newArr:[data];
   let reg = searchInEnd?new RegExp(searchStr+"$"):new RegExp("^"+searchStr);

+ 51 - 69
src/store/actions/currentIll.js

@@ -607,106 +607,88 @@ export function insertLabelData(state,action){
     let innerText = span.current.innerText || span.current.innerHTML;
     let strIndex = innerText.indexOf(searchStr);
     const value = innerText.replace(searchStr,"");
+    const pText = Object.assign({},textEmpty,{value:value});
     if(data.itemType==0){//症状
       res.symptomIds.push(id);
       // 没有伴展开主诉symptomType=0/1的尾巴,有伴一>第一个点选上去的伴为依据,伴前展开主诉,伴后展开伴随;多余的伴以及手动输入的伴不做处理(2-25)
       if(banIdx==-1){
         // if(strIndex <= 1){//前
         if(strIndex < 1){//前
-          res.data.splice(focusIndex,0,text);
-          res.saveText.splice(focusIndex,0,searchData);
-          res.data[focusIndex+1].value = value;
-          res.saveText[focusIndex+1] = value;
-          resData = JSON.parse(JSON.stringify(res.data));
-          resData.splice(focusIndex+1,0,...(data.questionMapping.filter((item)=>{
-                                  return item.symptomType==0||item.symptomType==1;
-                                })));
+          res.data.splice(index,1,text,...(data.questionMapping.filter((item)=>{
+                                   return item.symptomType==0||item.symptomType==1;
+                                })),pText);
+          res.saveText = fullfillText(res.data).saveText;
+          res.selecteds.splice(index,1,null,...new Array(data.questionMapping.length).fill(null),null);
         }else{
-          res.data.splice(focusIndex+1,0,text);
-          res.saveText.splice(focusIndex+1,0,searchData);
-          res.data[focusIndex].value = value;
-          res.saveText[focusIndex] = value;
-          resData = JSON.parse(JSON.stringify(res.data));
-          // +2是因为插入一个文本标签  
-          resData.splice(focusIndex+2,0,...(data.questionMapping.filter((item)=>{
-                                  return item.symptomType==0||item.symptomType==1;
+          res.data.splice(index,1,pText,text,...(data.questionMapping.filter((item)=>{
+                                   return item.symptomType==0||item.symptomType==1;
                                 })));
+          res.saveText = fullfillText(res.data).saveText;
+          res.selecteds.splice(index,1,null,null,...new Array(data.questionMapping.length).fill(null));
         }
       }else{
         if(focusIndex > banIdx){//伴后
           if(strIndex < 1){//前
-            res.data.splice(focusIndex,0,text);
-            res.saveText.splice(focusIndex,0,searchData);
-            res.data[focusIndex+1].value = value;
-            res.saveText[focusIndex+1] = value;
-            resData = JSON.parse(JSON.stringify(res.data));
-            resData.splice(focusIndex+1,0,...(data.questionMapping.filter((item)=>{
-                                    return item.symptomType==0||item.symptomType==2;
-                                  })));
+            res.data.splice(index,1,text,...(data.questionMapping.filter((item)=>{
+                                   return item.symptomType==0||item.symptomType==2;
+                                })),pText);
+            res.saveText = fullfillText(res.data).saveText;
+            res.selecteds.splice(index,1,null,...new Array(data.questionMapping.length).fill(null),null);
           }else{
-            res.data.splice(focusIndex+1,0,text);
-            res.saveText.splice(focusIndex+1,0,searchData);
-            res.data[focusIndex].value = value;
-            resData = JSON.parse(JSON.stringify(res.data));
-            // +2是因为插入一个文本标签  
-            resData.splice(focusIndex+2,0,...(data.questionMapping.filter((item)=>{
-                                    return item.symptomType==0||item.symptomType==2;
-                                  })));
+            res.data.splice(index,1,pText,text,...(data.questionMapping.filter((item)=>{
+                                   return item.symptomType==0||item.symptomType==2;
+                                })));
+            res.saveText = fullfillText(res.data).saveText;
+            res.selecteds.splice(index,1,null,null,...new Array(data.questionMapping.length).fill(null));
           }
         }else{//伴前
           if(strIndex < 1){//前
-            res.data.splice(focusIndex,0,text);
-            res.saveText.splice(focusIndex,0,searchData);
-            res.data[focusIndex+1].value = value;
-            res.saveText[focusIndex+1] = value;
-            resData = JSON.parse(JSON.stringify(res.data));
-            resData.splice(focusIndex+1,0,...(data.questionMapping.filter((item)=>{
-                                    return item.symptomType==0||item.symptomType==1;
-                                  })));
+            res.data.splice(index,1,text,...(data.questionMapping.filter((item)=>{
+                                   return item.symptomType==0||item.symptomType==1;
+                                })),pText);
+            res.saveText = fullfillText(res.data).saveText;
+            res.selecteds.splice(index,1,null,...new Array(data.questionMapping.length).fill(null),null);
           }else{
-            res.data.splice(focusIndex+1,0,text);
-            res.saveText.splice(focusIndex+1,0,searchData);
-            res.data[focusIndex].value = value;
-            resData = JSON.parse(JSON.stringify(res.data));
-            // +2是因为插入一个文本标签  
-            resData.splice(focusIndex+2,0,...(data.questionMapping.filter((item)=>{
-                                    return item.symptomType==0||item.symptomType==1;
-                                  })));
+            res.data.splice(index,1,pText,text,...(data.questionMapping.filter((item)=>{
+                                   return item.symptomType==0||item.symptomType==1;
+                                })));
+            res.saveText = fullfillText(res.data).saveText;
+            res.selecteds.splice(index,1,null,null,...new Array(data.questionMapping.length).fill(null));
           }
         }
       }
-      res.data = fullfillText(resData).newArr;
-      res.saveText = fullfillText(resData).saveText;
+      res.data = fullfillText(res.data).newArr;
+      res.saveText = fullfillText(res.data).saveText;
     }else{//标签
+      const spreadLabels = data.tagType==4?fullfillText(data.questionMapping).newArr:[data];
       if(strIndex < 1){//前
         // 判断前一个是否为文本标签,是直接插入标签,不是则在前面插入一个空文本标签
-        const preItem = res.data[focusIndex-1];
+        const preItem = res.data[index-1];
         if(preItem&&preItem.tagType==8){
-          res.data.splice(focusIndex,0,data);
-          res.saveText.splice(focusIndex,0,'','');
-          res.selecteds.splice(focusIndex,0,null,null);
-          res.data[focusIndex+1].value = value;
-          res.saveText[focusIndex+1] = value;
+          res.data.splice(index,1,...spreadLabels,pText);
+          res.saveText = fullfillText(res.data).saveText;
+          res.selecteds.splice(index,1,...new Array(spreadLabels.length).fill(null),null);
         }else{
-          res.data.splice(focusIndex,0,textEmpty,data);
-          res.saveText.splice(focusIndex,0,'','');
-          res.selecteds.splice(focusIndex,0,null,null);
-          res.data[focusIndex+2].value = value;
-          res.saveText[focusIndex+2] = value;
+          res.data.splice(index,1,textEmpty,...spreadLabels,pText);
+          res.saveText = fullfillText(res.data).saveText;
+          res.selecteds.splice(index,1,null,...new Array(spreadLabels.length).fill(null),null);
         }
         // res.data.splice(focusIndex,0,data,textEmpty);
         
       }else{
-        res.data.splice(focusIndex+1,0,data,textEmpty);
-        res.saveText.splice(focusIndex+1,0,'','');
-        res.selecteds.splice(focusIndex+1,0,null,null);
-        res.data[focusIndex].value = value;
-        res.saveText[focusIndex] = value;
+        // 后面插入 :判断后一个标签是否为文本标签,不是则插入一个空标签
+        const afterItem = res.data[index+1];
+        if(afterItem&&afterItem.tagType==8){
+          res.data.splice(index,1,pText,...spreadLabels);
+          res.saveText = fullfillText(res.data).saveText;
+          res.selecteds.splice(index,1,null,...new Array(spreadLabels.length).fill(null));
+        }else{
+          res.data.splice(index,1,pText,...spreadLabels,textEmpty);
+          res.saveText = fullfillText(res.data).saveText;
+          res.selecteds.splice(index,1,null,...new Array(spreadLabels.length).fill(null),null);
+        }   
       }
     }
-    // span.current.innerText?(span.current.innerText = value):(span.current.innerHTML = value);
-    // res.data = fullfillText(resData).newArr;
-    // res.saveText = fullfillText(resData).saveText;
   }
   res.searchData = [];    //选中清空搜索内容(即关闭搜索弹窗)
   res.update = Math.random();//console.log('现病史',res);

+ 2 - 2
src/utils/config.js

@@ -1,6 +1,6 @@
 // const host='http://192.168.3.100:5050';//王峰
-// const host='http://192.168.2.241:5050';//后端接口访问地址
-const host='http://192.168.2.236:5050';//后端接口访问地址
+const host='http://192.168.2.241:5050';//后端接口访问地址
+// const host='http://192.168.2.236:5050';//后端接口访问地址
 //const host='http://192.168.2.164:8080';
 // const host='http://192.168.3.117:8080'; //周铁刚
 // const newIcssVisitUrl = '223.93.170.82:13000';    //icss服务访问地址(跳转目的地),不能加http://