Преглед изворни кода

临时解决连续数字组件双击编辑删除后显示异常bug 817,1431

zhouna пре 6 година
родитељ
комит
fd3a3f422b
3 измењених фајлова са 24 додато и 3 уклоњено
  1. 8 1
      src/store/actions/checkBody.js
  2. 8 1
      src/store/actions/currentIll.js
  3. 8 1
      src/store/actions/otherHistory.js

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

@@ -383,7 +383,10 @@ export const changeNumLabelVal = (state,action)=>{
   const newVal = changeVal;
   let item = res.data[index];
   const next = res.data[+index+1];
+  const next2 = res.data[+index + 2];
   const nextVal = next.value||next.name;
+  //下一个非文本标签是数字组件
+  const next2IsNum = +next2.tagType === 1 && +next2.controlType === 7;
   //标签后是不是标点符号标签,是的话删除本标签时一起删除
   let nextIsDot = +next.tagType===8&&!nextVal.match(config.punctuationReg);
   if(totalVal.trim()){
@@ -399,7 +402,11 @@ export const changeNumLabelVal = (state,action)=>{
     }
     
   }else{//删除完标签内容则删除该标签
-    const num = nextIsDot?2:1;
+    let num = nextIsDot ? 2 : 1;
+    if (nextIsDot && next2IsNum) {      //解决连续2个相同的数字组件删除第一个,第二个显示异常bug--临时方案
+      next.value = '';
+      num = 1;
+    }
     res.data.splice(index,num);
     res.selecteds.splice(index,num);      //杂音类样式选中状态对应
     res.saveText = checkFullfillText(res.data).saveText;

+ 8 - 1
src/store/actions/currentIll.js

@@ -639,7 +639,10 @@ export const changeNumLabelVal = (state,action)=>{
   const newVal = changeVal;
   let item = res.data[index];
   const next = res.data[+index+1];
+  const next2 = res.data[+index + 2];
   const nextVal = next.value||next.name;
+  //下一个非文本标签是数字组件
+  const next2IsNum = +next2.tagType === 1 && +next2.controlType === 7;
   //标签后是不是标点符号标签,是的话删除本标签时一起删除
   let nextIsDot = +next.tagType===8&&!nextVal.match(config.punctuationReg);
   // let labText = totalVal?totalVal:newVal;   //如单选没有前后缀
@@ -651,7 +654,11 @@ export const changeNumLabelVal = (state,action)=>{
     }
     res.saveText[index] = totalVal;
   }else{//删除完标签内容则删除该标签
-    const num = nextIsDot?2:1;
+    let num = nextIsDot ? 2 : 1;
+    if (nextIsDot && next2IsNum) {      //解决连续2个相同的数字组件删除第一个,第二个显示异常bug--临时方案
+      next.value = '';
+      num = 1;
+    }
     res.data.splice(index,num);
     res.saveText.splice(index,num);
     // res.saveText = fullfillText(res.data).saveText;

+ 8 - 1
src/store/actions/otherHistory.js

@@ -377,7 +377,10 @@ export const changeNumLabelVal = (state,action)=>{
   const newVal = changeVal;
   let item = res.data[index];
   const next = res.data[+index+1];
+  const next2 = res.data[+index + 2];
   const nextVal = next.value||next.name;
+  //下一个非文本标签是数字组件
+  const next2IsNum = +next2.tagType === 1 && +next2.controlType === 7;
   //标签后是不是标点符号标签,是的话删除本标签时一起删除
   let nextIsDot = +next.tagType===8&&!nextVal.match(config.punctuationReg);
   let labText = totalVal?totalVal:newVal;   //如单选没有前后缀
@@ -389,7 +392,11 @@ export const changeNumLabelVal = (state,action)=>{
     }
     res.saveText[index] = labText;
   }else{//删除完标签内容则删除该标签
-    const num = nextIsDot?2:1;
+    let num = nextIsDot ? 2 : 1;
+    if (nextIsDot && next2IsNum) {      //解决连续2个相同的数字组件删除第一个,第二个显示异常bug--临时方案
+      next.value = '';
+      num = 1;
+    }
     res.data.splice(index,num);
     res.selecteds.splice(index,num);//杂音类样式选中状态对应
     res.saveText = fullfillText(res.data).saveText;