Kaynağa Gözat

双击删除标签时删除后面的标点

zhouna 6 yıl önce
ebeveyn
işleme
4c41407177

+ 12 - 2
src/store/actions/checkBody.js

@@ -235,6 +235,10 @@ export const changeLabelVal = (state,action)=>{//双击标签输入改变值
   const newVal = changeVal;     //下拉修改的内容
   let labText = totalVal?totalVal:newVal;   //如单选没有前后缀
   let item = res.data[index];
+  const next = res.data[+index+1];
+  const nextVal = next.value||next.name;
+  //标签后是不是标点符号标签,是的话删除本标签时一起删除
+  let nextIsDot = +next.tagType===8&&!nextVal.match(config.punctuationReg);
   // if(newVal && newVal.trim()){
   if(labText && labText.trim()){
     if(item){
@@ -245,7 +249,8 @@ export const changeLabelVal = (state,action)=>{//双击标签输入改变值
       res.saveText[index] = labText;
     }
   }else{//删除完标签内容则删除该标签
-    res.data.splice(index,1);
+    const num = nextIsDot?2:1;
+    res.data.splice(index,num);
     res.saveText = fullfillText(res.data).saveText;
   }
   res.update = Math.random();
@@ -259,6 +264,10 @@ export const changeNumLabelVal = (state,action)=>{
   const index = ikey;
   const newVal = changeVal;
   let item = res.data[index];
+  const next = res.data[+index+1];
+  const nextVal = next.value||next.name;
+  //标签后是不是标点符号标签,是的话删除本标签时一起删除
+  let nextIsDot = +next.tagType===8&&!nextVal.match(config.punctuationReg);
   if(totalVal.trim()){
     if(item){
       item.value = newVal;
@@ -267,7 +276,8 @@ export const changeNumLabelVal = (state,action)=>{
     }
     res.saveText[index] = totalVal;
   }else{//删除完标签内容则删除该标签
-    res.data.splice(index,1);
+    const num = nextIsDot?2:1;
+    res.data.splice(index,num);
     res.saveText = fullfillText(res.data).saveText;
   } 
   

+ 12 - 2
src/store/actions/currentIll.js

@@ -390,6 +390,10 @@ export const changeLabelVal = (state,action)=>{
   const newVal = changeVal;
   let labText = totalVal?totalVal:newVal;
   let item = res.data[index];
+  const next = res.data[+index+1];
+  const nextVal = next.value||next.name;
+  //标签后是不是标点符号标签,是的话删除本标签时一起删除
+  let nextIsDot = +next.tagType===8&&!nextVal.match(config.punctuationReg);
   if(labText.trim()){
     if(item){
       item.value = newVal;
@@ -398,7 +402,8 @@ export const changeLabelVal = (state,action)=>{
       res.saveText[index] = labText;
     }
   }else{//删除完标签内容则删除该标签
-    res.data.splice(index,1);
+    const num = nextIsDot?2:1;
+    res.data.splice(index,num);
     res.saveText = fullfillText(res.data).saveText;
   } 
   res.update = Math.random();
@@ -412,6 +417,10 @@ export const changeNumLabelVal = (state,action)=>{
   const index = ikey;
   const newVal = changeVal;
   let item = res.data[index];
+  const next = res.data[+index+1];
+  const nextVal = next.value||next.name;
+  //标签后是不是标点符号标签,是的话删除本标签时一起删除
+  let nextIsDot = +next.tagType===8&&!nextVal.match(config.punctuationReg);
   let labText = totalVal?totalVal:newVal;   //如单选没有前后缀
   if(labText.trim()){
     if(item){
@@ -421,7 +430,8 @@ export const changeNumLabelVal = (state,action)=>{
     }
     res.saveText[index] = labText;
   }else{//删除完标签内容则删除该标签
-    res.data.splice(index,1);
+    const num = nextIsDot?2:1;
+    res.data.splice(index,num);
     res.saveText = fullfillText(res.data).saveText;
   }
   res.update = Math.random();

+ 12 - 3
src/store/actions/mainSuit.js

@@ -453,14 +453,18 @@ export const changeLabelVal = (state,action)=>{
   const newVal = action.data.changeVal;
   let data = res.data;
   let item = data[index];
+  const next = res.data[+index+1];
+  const nextVal = next.value||next.name;
+  //标签后是不是标点符号标签,是的话删除本标签时一起删除
+  let nextIsDot = +next.tagType===8&&!nextVal.match(config.punctuationReg);
   if(newVal&&newVal.trim()){
     if(item){
       item.value = newVal;
       res.saveText[index] = newVal;
     }
   }else{//删除完标签内容则删除该标签
-    
-    data.splice(index,1);
+    const num = nextIsDot?2:1;
+    data.splice(index,num);
     // data[index].value = "";
     // res.data.splice(index,1);
     res.saveText.splice(index,1);
@@ -478,6 +482,10 @@ export const changeNumLabelVal = (state,action)=>{
   const newVal = changeVal;
   let labText = totalVal?totalVal:newVal;   //如单选没有前后缀
   let item = res.data[index];
+  const next = res.data[+index+1];
+  const nextVal = next.value||next.name;
+  //标签后是不是标点符号标签,是的话删除本标签时一起删除
+  let nextIsDot = +next.tagType===8&&!nextVal.match(config.punctuationReg);
   if(labText.trim()){
     if(item){
       item.value = newVal;
@@ -486,7 +494,8 @@ export const changeNumLabelVal = (state,action)=>{
       res.saveText[index] = labText;
     }
   }else{//删除完标签内容则删除该标签
-    res.data.splice(index,1);
+    const num = nextIsDot?2:1;
+    res.data.splice(index,num);
     res.saveText = fullfillText(res.data).saveText;
   }
   res.update = Math.random();//console.log(44,action,res);

+ 12 - 2
src/store/actions/otherHistory.js

@@ -219,6 +219,10 @@ export function changeTextLabel(state,action) {
   const index = ikey;
   const newVal = changeVal;
   let item = res.data[index];
+  const next = res.data[+index+1];
+  const nextVal = next.value||next.name;
+  //标签后是不是标点符号标签,是的话删除本标签时一起删除
+  let nextIsDot = +next.tagType===8&&!nextVal.match(config.punctuationReg);
   let labText = totalVal?totalVal:newVal;
   if(labText.trim()){
     if(item){
@@ -228,7 +232,8 @@ export function changeTextLabel(state,action) {
       res.saveText[index] = labText;
     }
   }else{//删除完标签内容则删除该标签
-    res.data.splice(index,1);
+    const num = nextIsDot?2:1;
+    res.data.splice(index,num);
     res.saveText = fullfillText(res.data).saveText;
   }
   res.update = Math.random();
@@ -242,6 +247,10 @@ export const changeNumLabelVal = (state,action)=>{
   const index = ikey;
   const newVal = changeVal;
   let item = res.data[index];
+  const next = res.data[+index+1];
+  const nextVal = next.value||next.name;
+  //标签后是不是标点符号标签,是的话删除本标签时一起删除
+  let nextIsDot = +next.tagType===8&&!nextVal.match(config.punctuationReg);
   let labText = totalVal?totalVal:newVal;   //如单选没有前后缀
   if(labText.trim()){
     if(item){
@@ -251,7 +260,8 @@ export const changeNumLabelVal = (state,action)=>{
     }
     res.saveText[index] = labText;
   }else{//删除完标签内容则删除该标签
-    res.data.splice(index,1);
+    const num = nextIsDot?2:1;
+    res.data.splice(index,num);
     res.saveText = fullfillText(res.data).saveText;
   };
   res.update = Math.random();