Browse Source

查体展开标记bug修改2458,删除还原标签bug修改

zhouna 5 years ago
parent
commit
c0eda4349b
4 changed files with 24 additions and 7 deletions
  1. 19 0
      src/store/actions/checkBody.js
  2. 2 2
      src/store/reducers/checkBody.js
  3. 1 1
      src/utils/tools.js
  4. 2 4
      src/utils/utils.js

+ 19 - 0
src/store/actions/checkBody.js

@@ -1,5 +1,6 @@
 import config from '@config/index.js';
 import {formatContinueDots,getLabelIndex,handleLocalDelTag,checkFullfillText} from '@utils/tools.js';
+import {shiftLocalDelTag} from "../../utils/tools";
 
 export function preSetCheckbody(state,action) {
   let res = Object.assign({},state);
@@ -319,4 +320,22 @@ export function setImportCheckbodyLabel(state,action) {
   res.importLabel = action.labels;
   res.update = Math.random();
   return res;
+}
+
+//恢复已删除的标签
+export function recoveTag(state,action) {
+  let res = Object.assign({},state);
+  let arr = [...res.data];
+  arr.splice(action.index,0,action.data);
+  const dataArr = checkFullfillText(arr);
+  let nextLabel = dataArr.newArr[(+action.index)+1];
+  //展开收起状态
+  if(nextLabel.tagType==8){
+    nextLabel.showInCheck=action.data.showInCheck;
+  }
+  res.data = dataArr.newArr;
+  res.saveText = dataArr.saveText;
+  shiftLocalDelTag();
+  res.update = Math.random();
+  return res;
 }

+ 2 - 2
src/store/reducers/checkBody.js

@@ -2,10 +2,10 @@ import {RECOVER_TAG_CHECK,SET,SETNUMBER4,SETSELECTED4,SETCHECKBOX,ADDLABELITEM,S
   SELECTSEARCHDATA,CHANGECHECKTEXTLABEL,CLEARCHECKBODY,CHECK_FOCUS_INDEX,CHECKBODY_CLEAR,
   SETCHECKINPUT,DEL_CHECKBODY,CHECKCONFIRMSELECTED,
   CHECKBODY_MUL,DEL_CHECKBODY_LABLE,SET_CK_RADIO_INPUT_VAL,SET_IMPORT_CHECKBODY_LABEL,PRESET} from '../types/checkBody.js';
-import {set,setCheckBoxValue,
+import {recoveTag,set,setCheckBoxValue,
   setSearchData,insertLabelData,changeLabelVal,clearCheckBody,backspaceText
   ,confirm,multipleComfirn,delSingleLable,setImportCheckbodyLabel,preSetCheckbody} from '../actions/checkBody.js';
-import {recoveTag,setRadioInputValue,setRadioValue,setNumberValue,setCheckText,addLabelItem,setInputLabel} from '@utils/utils';
+import {setRadioInputValue,setRadioValue,setNumberValue,setCheckText,addLabelItem,setInputLabel} from '@utils/utils';
 import config from '@config/index.js';
 
 const block = Object.assign(JSON.parse(config.textLabel),{full:true});//空白时保留一个自由文本标签

+ 1 - 1
src/utils/tools.js

@@ -1282,7 +1282,7 @@ function resetTagtype(data){
 //记录最近3次被删除的标签
 function handleLocalDelTag(mark,index,tag){
   const deledTag =  localStorage.getItem('deletedTags')?JSON.parse(localStorage.getItem('deletedTags')):[];
-  deledTag.unshift(Object.assign({delIndex:mark+'-'+index},tag));
+  deledTag.unshift(Object.assign(tag,{delIndex:mark+'-'+index}));
   deledTag.length = deledTag.length>config.recoverTagNum?config.recoverTagNum:deledTag.length;
   localStorage.setItem('deletedTags',JSON.stringify(deledTag));
 }

+ 2 - 4
src/utils/utils.js

@@ -140,10 +140,8 @@ export const setRadioInputValue = (state,action)=>{
 export function recoveTag(state,action) {
   let res = Object.assign({},state);
   let arr = [...res.data];
-  const boxMark = action.data.delIndex.substr(0,1);
-  const text = Object.assign({showInCheck:action.data.showInCheck},JSON.parse(config.textLabel));
-  arr.splice(action.index,0,action.data,text);
-  const dataArr = boxMark==='4'?checkFullfillText(arr):fullfillText(arr);
+  arr.splice(action.index,0,action.data);
+  const dataArr = fullfillText(arr);
   res.data = dataArr.newArr;
   res.saveText = dataArr.saveText;
   shiftLocalDelTag();