فهرست منبع

其他史杂音类型selecteds改到标签数据中

zhouna 5 سال پیش
والد
کامیت
8e9c44f861

+ 0 - 1
src/containers/OtherHistory.js

@@ -24,7 +24,6 @@ function mapStateToProps(state){
     focusTextIndex:otherHistory.focusIndex,    //聚焦的自由文本标签index
     span:otherHistory.span,
     searchInEnd:otherHistory.searchInEnd,      //是否在搜索末尾插入结果
-    selecteds:otherHistory.selecteds,       //普通多选选中状态
     editClear:otherHistory.editClear,       //编辑状态
     isRead:state.homePage.isRead,
     readMode:typeConfig.readMode,       //回读回来的模式(与当前模式并存)

+ 1 - 1
src/containers/eleType.js

@@ -130,7 +130,7 @@ function multLabels(params){
                      boxMark={boxMark}
                      isImports={isHigh}
                      ikey={boxMark+'-'+i}
-                     selecteds={selecteds&&selecteds[i]}
+                     selecteds={data.selecteds}
                      saveText={saveText}
                      textPrefix={data.prefix}
                      textSuffix={data.suffix}></MultSpread>

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

@@ -37,7 +37,7 @@ export const confirm = (state,action) =>{
   const items = [...exists||[],...withs||[]];
   if((!exists||!withs||items.length==0)&&!nones&&!exclusion){       //取消无殊的选中,空白提交
     arr[ikey].value = '';
-    arr[ikey].selecteds = [];
+    arr[ikey].selecteds = {};
     res.saveText[ikey] = '';
     res.update=Math.random();
     return res;
@@ -60,7 +60,6 @@ export const confirm = (state,action) =>{
   if(items.length==0&&nones){
     arr[ikey-1].value = newPreText;
     res.saveText[ikey-1] = newPreText;
-    //res.selecteds[ikey] = null;       //无殊选中状态遗留bug修改
     res.update=Math.random();
     return res;
   }

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

@@ -9,16 +9,16 @@ export const confirm = (state,action) =>{
   const items = [...exists||[],...withs||[]];
   if((!exists||!withs||items.length==0)&&!nones&&!exclusion){       //取消无殊的选中,空白提交
     arr[ikey].value = '';
+    arr[ikey].selecteds = {};
     res.saveText[ikey] = '';
-    res.selecteds.splice(ikey,1);
     res.update=Math.random();
     return res;
   }
   //选中互斥项
   if(exclusion){
     arr[ikey].value = excluName;
+    arr[ikey].selecteds = action.data;
     res.saveText[ikey] = excluName;
-    res.selecteds[ikey] = action.data;
     res.update=Math.random();
     return res;
   }
@@ -32,7 +32,6 @@ export const confirm = (state,action) =>{
   if(items.length==0&&nones){
     arr[ikey-1].value = newPreText;
     res.saveText[ikey-1] = newPreText;
-    res.selecteds[ikey] = null;       //无殊选中状态遗留bug修改
     res.update=Math.random();
     return res;
   }
@@ -75,8 +74,8 @@ export function setCheckBoxValue(state,action) {
     showText = showText.substr(0,showText.length-1);
   }
   res.data[labelInx].value = showText;
+  res.data[labelInx].selecteds = action.data;
   res.saveText[labelInx] = showText;
-  res.selecteds[labelInx] = action.data;
   res.update=Math.random();
   return res;
 }
@@ -106,23 +105,18 @@ export function insertLabelData(state,action){
     if(searchInEnd){
       res.data.splice(index,1,pText,...spreadLabels,text);
       res.saveText = fullfillText(res.data).saveText;
-      res.selecteds.splice(index,1,null,...new Array(spreadLabels.length).fill(null),null);
-      //res.saveText.splice(index,1,newText,'','');
     }else{
       res.data.splice(index,1,...spreadLabels,pText,text);
-      res.saveText = fullfillText(res.data).saveText;//.splice(index,1,'',newText,'');
-      res.selecteds.splice(index,1,...new Array(spreadLabels.length).fill(null),null,null);
+      res.saveText = fullfillText(res.data).saveText;
     }
   }else{
     span.current.innerText?(span.current.innerText = ' '):(span.current.innerHTML = ' ');
     if(searchInEnd){
       res.data.splice(index+1,0,spreadLabels,text);
       res.saveText.splice(index+1,0,'','');
-      res.selecteds.splice(index+1,0,...new Array(spreadLabels.length).fill(null),null);
     }else{
       res.data.splice(index,0,text,spreadLabels);
       res.saveText.splice(index,0,'','');
-      res.selecteds.splice(index,0,null,...new Array(spreadLabels.length).fill(null));
     }
 
   }
@@ -188,7 +182,6 @@ export function changeTextLabel(state,action) {
       res[res.data[index].formulaCode]=undefined;
     }
     res.data.splice(index,num);
-    res.selecteds.splice(index,num);//杂音类样式选中状态对应
     res.saveText = fullfillText(res.data).saveText;
   }
   res.update = Math.random();//console.log(888,res,action);
@@ -206,11 +199,6 @@ export function clearOtherHistory(state,action){       //清空数据
       res[it] = action[it];
     }
   }
-  /*res.data = action.data;
-  res.saveText = action.saveText;
-  res.selecteds = action.selecteds;
-  res.editClear = action.editClear;
-  res.isEmpty = action.isEmpty;*/
   return res;
 }
 //文本模式下值保存
@@ -273,7 +261,6 @@ export function backspaceText(state,action){
       // 前一个是文本标签或者子模板 不做处理
     }else if(data[delIndex-1].tagType==8){
       data.splice(delIndex,1);
-      res.selecteds.splice(delIndex,1);      //杂音类样式选中状态对应
       res.saveText.splice(delIndex,1);
     }
     else{
@@ -281,17 +268,16 @@ export function backspaceText(state,action){
       if(data[delIndex-1].formulaCode){
         res[data[delIndex-1].formulaCode]=undefined;
       }
+      const n = action.text.length>0&&(config.punctuationReg.test(action.text))?1:2;
       handleLocalDelTag(3,delIndex-1,data[delIndex-1]);      //记录被删除的标签
-      data.splice(delIndex-1,action.text.length>0&&(config.punctuationReg.test(action.text))?1:2);
-      res.selecteds.splice(delIndex-1,action.text.length>0&&(config.punctuationReg.test(action.text))?1:2);      //杂音类样式选中状态对应
-      res.saveText.splice(delIndex-1,action.text.length>0&&(config.punctuationReg.test(action.text))?1:2);
+      data.splice(delIndex-1,n);
+      res.saveText.splice(delIndex-1,n);
     }
   }else if(flag == 'del'){
     if(data[delIndex+1] && data[delIndex+1].flag&&data[delIndex+1].flag==3){//子模板不删  
       
     }else if(data[delIndex+1] && data[delIndex+1].tagType==8){
       data.splice(delIndex,1);
-      res.selecteds.splice(delIndex,1);      //杂音类样式选中状态对应
       res.saveText.splice(delIndex,1);
     }else if(!data[delIndex+1]){//最后一个文本标签不删除
       
@@ -303,7 +289,6 @@ export function backspaceText(state,action){
       }
       handleLocalDelTag(3,delIndex,data[delIndex+1]);
       data.splice(delIndex,2);
-      res.selecteds.splice(delIndex,2);  
       res.saveText.splice(delIndex,2);
     }
   }
@@ -344,6 +329,7 @@ export function multipleComfirn(state,action){
     let item = data[ikey].questionMapping;
     let arr=[];
     item[index].value = seleData;
+    item[index].selecteds= {[index]:action.data};
     item.map((it)=>{
       if(it.value){
         arr.push(it.labelPrefix+it.value+it.labelSuffix);
@@ -351,7 +337,6 @@ export function multipleComfirn(state,action){
     });
     res.saveText[ikey] = arr.join("");
     res.update = Math.random();
-    res.selecteds[ikey] = {[index]:action.data};
     return res;
   }
   data[ikey].value = seleData;

+ 0 - 2
src/store/reducers/otherHistory.js

@@ -12,7 +12,6 @@ const initState = {
                     data:[block],
                     isEmpty:true,
                     saveText:[],
-                    selecteds:[],
                     deledTags:{},
                     focusIndex:'',
                     editClear:true};
@@ -22,7 +21,6 @@ export default function(state=initState,action){//console.log(state)
   switch (action.type){
     case SETDATA:
       res.data = action.data;
-      res.selecteds = action.selecteds||[];
       const period = action.period;
       if(period){
         res.yjs_1=period.yjs_1;