Bladeren bron

现病史搜索、删除优化

liucf 6 jaren geleden
bovenliggende
commit
b0155ac4f0

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

@@ -135,7 +135,7 @@ class MainSuit extends Component{
 
   handleClick(e){//让搜索框跟随鼠标点击移动
     // e.stopPropagation(); //冒泡到最顶层关闭其他下拉
-    //若使用e.target,因为是onClick事件中,值可能是itembox的而不是span因此会有bug
+    //若使用e.target,因为是onClick事件中,值可能是itembox的而不是span因此会有bug  
     const ele = document.activeElement;
     console.log(ele.toString())
     if(ele.toString().indexOf('HTMLSpanElement') == -1){     //点击的不是span无法聚焦就不再设置位置

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

@@ -448,8 +448,7 @@ class ListItem extends Component{
     const pos = isSpecialPos?style['independent']:'';
     return <ul className={classNames(style['row'],pos)} onBlur={(e)=>e.stopPropagation()}>
       {datas&&datas.map((it,i)=>{
-        return <li onClick={(e)=>this.handleClick(e,it,i)}
-                   className={this.getClass(it.id)}>{it.labelPrefix}{it.name}{it.labelSuffix}</li>
+        return <li onClick={(e)=>this.handleClick(e,it,i)} className={this.getClass(it.id)} title={it.name.length>8?it.name:''}>{it.name&&it.name.length>8?it.name.slice(0,8)+'...':it.name}</li>
       })}
     </ul>;
   }

+ 9 - 3
src/store/actions/checkBody.js

@@ -312,12 +312,18 @@ export function backspaceText(state,action){
   let res = Object.assign({},state);
   const {delIndex} = action;
   const data = res.data;
-  if(data[delIndex-1].tagType==8 ||data[delIndex-1].flag&&data[delIndex-1].flag==3){
+  if(data[delIndex-1].flag&&data[delIndex-1].flag==3){
+  // if(data[delIndex-1].tagType==8 ||data[delIndex-1].flag&&data[delIndex-1].flag==3){
     // 前一个是文本标签或者子模板 不做处理
-  }else{
+  }else if(data[delIndex-1].tagType==8){
+    data.splice(delIndex,1);
+    res.saveText.splice(delIndex,1);
+  }
+  else{
     data.splice(delIndex-1,2);
+    res.saveText.splice(delIndex-1,2);
   }
-  res.saveText = fullfillText(data).saveText;
+  // res.saveText = fullfillText(data).saveText;
   res.update = Math.random();
   return res;
 }

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

@@ -532,8 +532,8 @@ export function insertLabelData(state,action){
       res.saveText.splice(focusIndex+1,0,searchData);
       res.data[focusIndex].value = value;
       resData = JSON.parse(JSON.stringify(res.data));
-      // +3是因为插入一个文本标签加一个符号标签  
-      resData.splice(focusIndex+3,0,...(data.questionMapping.filter((item)=>{
+      // +2是因为插入一个文本标签  
+      resData.splice(focusIndex+2,0,...(data.questionMapping.filter((item)=>{
                               return item.symptomType==0||item.symptomType==2;
                             })));
     }
@@ -597,11 +597,13 @@ export function backspaceText(state,action){
     // data[delIndex].value = text;
   }else if(data[delIndex-1].tagType==8){
     data.splice(delIndex,1);
+    res.saveText.splice(delIndex,1);
   }
   else{
     data.splice(delIndex-1,2);
+    res.saveText.splice(delIndex-1,2);
   }
-  res.saveText = fullfillText(data).saveText;
+  // res.saveText = fullfillText(data).saveText;
   res.update = Math.random();
   return res;
 }
@@ -618,12 +620,13 @@ export function removeId(state,action){
   }
   if(!data[index].value && data[index-1].tagType==8){
     data.splice(index,1);
+    res.saveText.splice(index,1);
   }else{
     data[index].id = "";
     data[index].name = text;
     data[index].value = text;
   }
-  
+  //console.log(345,action,res);
   res.update = Math.random();
   return res;
 }

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

@@ -591,11 +591,13 @@ export function backspaceText(state,action){
     // 前一个是文本标签或者子模板 不做处理
   }else if(data[delIndex-1].tagType==8){
     data.splice(delIndex,1);
+    res.saveText.splice(delIndex,1);
   }
   else{
     data.splice(delIndex-1,2);
+    res.saveText.splice(delIndex-1,2);
   }
-  res.saveText = fullfillText(data).saveText;
+  // res.saveText = fullfillText(data).saveText;
   res.update = Math.random();
   return res;
 }
@@ -612,6 +614,7 @@ export function removeId(state,action){
   }
   if(!data[index].value && data[index-1].tagType==8){
     data.splice(index,1);
+    res.saveText.splice(index,1);
   }else{
     data[index].id = "";
     data[index].name = text;

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

@@ -295,12 +295,18 @@ export function backspaceText(state,action){
   let res = Object.assign({},state);
   const {delIndex} = action;
   const data = res.data;
-  if(data[delIndex-1].tagType==8 ||data[delIndex-1].flag&&data[delIndex-1].flag==3){
+  if(data[delIndex-1].flag&&data[delIndex-1].flag==3){
+  // if(data[delIndex-1].tagType==8 ||data[delIndex-1].flag&&data[delIndex-1].flag==3){
     // 前一个是文本标签或者子模板 不做处理
-  }else{
+  }else if(data[delIndex-1].tagType==8){
+    data.splice(delIndex,1);
+    res.saveText.splice(delIndex,1);
+  }
+  else{
     data.splice(delIndex-1,2);
+    res.saveText.splice(delIndex-1,2);
   }
-  res.saveText = fullfillText(data).saveText;
+  // res.saveText = fullfillText(data).saveText;
   res.update = Math.random();
   return res;
 }
@@ -312,6 +318,7 @@ export function removeId(state,action){
   const data = res.data;
   if(!data[index].value && data[index-1].tagType==8){
     data.splice(index,1);
+    res.saveText.splice(index,1);
   } 
   res.update = Math.random();
   return res;