Jelajahi Sumber

主诉现病史杂音类型selecteds改到标签数据中

zhouna 5 tahun lalu
induk
melakukan
0cf891b363

+ 0 - 1
src/containers/CurrentIll.js

@@ -31,7 +31,6 @@ function mapStateToProps(state) {
         mainTailIds:mainSuit.mainTailIds,//主诉症状选中的id(去重用)
         totalHide: homePage.totalHide,
         saveText:currentIll.saveText,
-        selecteds:currentIll.selecteds,       //普通多选选中状态
         editClear:currentIll.editClear,
         symptomIds:currentIll.symptomIds,//症状id,去重用
         isRead:homePage.isRead,

+ 0 - 1
src/containers/MainSuit.js

@@ -21,7 +21,6 @@ function mapStateToProps(state) {
     update:mainSuit.update,
     CommonSymptoms:mainSuit.CommonSymptoms,//常见症状
     datas:mainSuit.data,//数据源
-    selecteds:mainSuit.selecteds,//数据源
     saveText:mainSuit.saveText,
 	  searchData:mainSuit.searchDatas,//搜索结果
     type: typeConfig.typeConfig,

+ 3 - 16
src/containers/SpreadDrop.js

@@ -316,21 +316,14 @@ function mainSuitCheck(dispatch,store,params){
   let withsName = getNames(withs);
   let labelInx = getLabelIndex(ikey);
   let text = filterDataArr(mainSaveText);
-  /*if(text.length >= config.limited){
-    Notify.info(config.limitText);
-    return
-  }*/
-  // let lengths = text.length + existsName.length;
   let lengths = value?(text.length - value.length + existsName.length):(text.length + existsName.length);
   if(lengths > config.limited){
     Notify.info(config.limitText);
     return
   }
-  // const index = params.ikey;
-  // let ikey = getLabelIndex(index);
+  delete params.mainData;       //不需要保存该数据,删除避免死循环
   dispatch({
     type: COMM_CONFIRM,
-    // data: {exists:exists,existsName:existsName,ikey}
     data:Object.assign({},params,{existsName,withsName,labelInx})
   });
   dispatch({//隐藏下拉
@@ -340,7 +333,7 @@ function mainSuitCheck(dispatch,store,params){
 
 //现病史普通多选确定
 function currentCheck(dispatch,store,params){
-  const {ikey,exclusion,excluName,nones,exists,noneIds,noneOn,nowOn,withOn,withs,order} = params;
+  const {ikey,exists,withs,order} = params;
   let existsName = getNames(exists,order);
   let withsName = getNames(withs);
   let labelInx = getLabelIndex(ikey);
@@ -373,20 +366,14 @@ function otherHisCheck(dispatch,store,params){
   let labelInx = getLabelIndex(ikey);
   dispatch({
     type:SETOTHERCHECKBOX,
-    // data:{labelInx,ikey,exclusion,excluName,nones,exists,existsName,noneIds,noneOn,nowOn,withOn,withs,withsName}
     data:Object.assign({},params,{existsName,withsName,labelInx})
   })
 }
 
 function handleCheckBox(dispatch,store,params){
-  const {type,mainSaveText} = params;
+  const {type} = params;
   switch (+type){
     case 1:
-      /*let text = filterDataArr(mainSaveText);
-      if(text.length >= config.limited){
-        Notify.info(config.limitText);
-        return
-      }*/
       mainSuitCheck(dispatch,store,params);
       break;
     case 2:

+ 3 - 18
src/store/actions/currentIll.js

@@ -401,8 +401,8 @@ export const setCheckBox = (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;
 }
@@ -479,7 +479,6 @@ export const clearCurrentIll = (state,action)=>{
   const res = Object.assign({},state);
   res.data = action.data;
   res.saveText = action.saveText;
-  res.selecteds = action.selecteds?action.selecteds:[];
   res.symptomIds = action.symptomIds;
   res.currReadSonM = action.currReadSonM||[];
   if(action.editClear){
@@ -568,32 +567,26 @@ export function insertLabelData(state,action){
         if(strIndex < 1){//前
           res.data.splice(index,1,text,...(FilteredDotMapping1),pText);
           res.saveText = fullfillText(res.data).saveText;
-          res.selecteds.splice(index,1,null,...new Array(FilteredDotMapping1.length).fill(null),null);
         }else{
           res.data.splice(index,1,pText,text,...(FilteredDotMapping1));
           res.saveText = fullfillText(res.data).saveText;
-          res.selecteds.splice(index,1,null,null,...new Array(FilteredDotMapping1.length).fill(null));
         }
       }else{
         if(focusIndex > banIdx){//伴后
           if(strIndex < 1){//前
             res.data.splice(index,1,text,...(FilteredDotMapping2),pText);
             res.saveText = fullfillText(res.data).saveText;
-            res.selecteds.splice(index,1,null,...new Array(FilteredDotMapping2.length).fill(null),null);
           }else{
             res.data.splice(index,1,pText,text,...(FilteredDotMapping2));
             res.saveText = fullfillText(res.data).saveText;
-            res.selecteds.splice(index,1,null,null,...new Array(FilteredDotMapping2.length).fill(null));
           }
         }else{//伴前
           if(strIndex < 1){//前
             res.data.splice(index,1,text,...(FilteredDotMapping1),pText);
             res.saveText = fullfillText(res.data).saveText;
-            res.selecteds.splice(index,1,null,...new Array(FilteredDotMapping1.length).fill(null),null);
           }else{
             res.data.splice(index,1,pText,text,...(FilteredDotMapping1));
             res.saveText = fullfillText(res.data).saveText;
-            res.selecteds.splice(index,1,null,null,...new Array(FilteredDotMapping1.length).fill(null));
           }
         }
       }
@@ -608,11 +601,9 @@ export function insertLabelData(state,action){
         if(preItem&&preItem.tagType==8){
           res.data.splice(index,1,...spreadLabels,pText);
           res.saveText = fullfillText(res.data).saveText;
-          res.selecteds.splice(index,1,...new Array(spreadLabels.length).fill(null),null);
         }else{
           res.data.splice(index,1,textEmpty,...spreadLabels,pText);
           res.saveText = fullfillText(res.data).saveText;
-          res.selecteds.splice(index,1,null,...new Array(spreadLabels.length).fill(null),null);
         }
         // res.data.splice(focusIndex,0,data,textEmpty);
         
@@ -622,11 +613,9 @@ export function insertLabelData(state,action){
         if(afterItem&&afterItem.tagType==8){
           res.data.splice(index,1,pText,...spreadLabels);
           res.saveText = fullfillText(res.data).saveText;
-          res.selecteds.splice(index,1,null,...new Array(spreadLabels.length).fill(null));
         }else{
           res.data.splice(index,1,pText,...spreadLabels,textEmpty);
           res.saveText = fullfillText(res.data).saveText;
-          res.selecteds.splice(index,1,null,...new Array(spreadLabels.length).fill(null),null);
         }   
       }
     }
@@ -654,13 +643,11 @@ export function backspaceText(state,action){
       // data[delIndex].value = text;
     }else if(data[delIndex-1].tagType==8){
       data.splice(delIndex,1);
-      res.selecteds.splice(delIndex,1);      //杂音类样式选中状态对应
       res.saveText.splice(delIndex,1);
     }
     else{
       handleLocalDelTag(2,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,2);
     }
   }else if(flag == 'del'){
@@ -668,7 +655,6 @@ export function backspaceText(state,action){
       
     }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]){//最后一个文本标签不删除
       // console.log("删除最后一个啦");
@@ -676,7 +662,6 @@ export function backspaceText(state,action){
     else{
       handleLocalDelTag(2,delIndex,data[delIndex+1]);
       data.splice(delIndex,2);
-      res.selecteds.splice(delIndex,2);  
       res.saveText.splice(delIndex,2);
     }
   }
@@ -732,6 +717,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);
@@ -739,12 +725,11 @@ 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;
+  data[ikey].selecteds = action.data;
   res.saveText[ikey] = seleData;
-  res.selecteds[ikey] = action.data;
   return res;
 }
 

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

@@ -387,8 +387,8 @@ export const commConfirm=(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;
 }
@@ -594,7 +594,6 @@ export const changeLabelVal = (state,action)=>{
     const num = nextIsDot?2:1;
     handleLocalDelTag('1',index,res.data[index]);
     res.data.splice(index,num);
-    res.selecteds.splice(index,num);//杂音类样式选中状态对应
     res.saveText = fullfillText(res.data).saveText;
   }
   res.update = Math.random();//console.log(222,res);
@@ -620,17 +619,11 @@ export const clearMainSuit = (state,action)=>{//回读和清除
   const res = Object.assign({},state);
   res.data = action.data;
   res.saveText = action.saveText;
-  // res.saveText = fullfillText(action.data).saveText;//解决删除data里的值保存,回读后页面上有内容saveText里没有的情况
-  res.selecteds = action.selecteds?action.selecteds:[];
   res.mainIds = action.mainIds;
   res.mainTailIds = action.mainTailIds || [];
   res.chronicDesease = action.chronicDesease;//慢病疾病字段
   res.mainReadSonM = action.mainReadSonM || [];//子模板
   res.moduleNum.num = 0; //恢复子模板点击次数
-  /*const readModule = action.mainReadSonM;
-  if(readModule&&readModule.length>0){//有回读子模板,则覆盖
-    res.addSmoduleData = readModule;
-  }*/
   if(action.editClear){
     res.editClear = action.editClear;
   }
@@ -675,7 +668,6 @@ export function addLabelItem(state,action){
   if(!data) return res;
   res.data.splice(+i+2,0,JSON.parse(data),textLabel);
   res.saveText.splice(+i+2,0,'','');
-  res.selecteds.splice(+i+2,0,null,null);
   res.update = Math.random();
   return res;
 }
@@ -687,7 +679,6 @@ export function backspaceText(state,action){
   const data = res.data;
   if(flag == 'backsp'){
     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 if(data[delIndex-1]&&data[delIndex-1].tagType==8){
       data.splice(delIndex,1);
@@ -695,16 +686,13 @@ export function backspaceText(state,action){
     }
     else{
       handleLocalDelTag(1,delIndex-1,data[delIndex-1]);
-      // data.splice(delIndex-1,2);
-      console.log(config.punctuationReg.test(action.text),action.text)
       data.splice(delIndex-1,action.text.length>0&&(config.punctuationReg.test(action.text))?1:2);//data不为空不能清除
       res.saveText.splice(delIndex-1,action.text.length>0?1:2);
     }
   }else if(flag == 'del'){
     if(data[delIndex+1] && data[delIndex+1].flag&&data[delIndex+1].flag==3){
       // 后一个是文本标签或者子模板 不做处理
-      // data.splice(delIndex,1);
-      // res.saveText.splice(delIndex,1);
+
     }else if(data[delIndex+1] && data[delIndex+1].tagType==8){
       data.splice(delIndex,1);
       res.saveText.splice(delIndex,1);
@@ -715,12 +703,9 @@ export function backspaceText(state,action){
     else{
       handleLocalDelTag(1,delIndex,data[delIndex+1]);
       data.splice(delIndex,2);
-      // data.splice(delIndex,action.text.length>0?1:2);
       res.saveText.splice(delIndex,2);
     }
   }
-  
-  // res.saveText = fullfillText(data).saveText;
   res.update = Math.random();
   return res;
 }
@@ -772,8 +757,8 @@ export function multipleComfirn(state,action){
   const {ikey,seleData} = action.data;
   let data = res.data;
   data[ikey].value = seleData;
+  data[ikey].selecteds = action.data;
   res.saveText[ikey] = seleData;
-  res.selecteds[ikey] = action.data;
   res.update = Math.random();
   return res;
 }

+ 0 - 1
src/store/reducers/currentIll.js

@@ -12,7 +12,6 @@ const initState = {
   moduleData:[],
   data:[],
   saveText:[],
-  selecteds:[],
   searchDatas:[],//搜索结果
   editClear:true,
   addModule:[],

+ 0 - 1
src/store/reducers/mainSuit.js

@@ -18,7 +18,6 @@ const initState = {
   addSmoduleData:[],//添加病情变化模板
   data:[],//主诉使用的模板数据
   saveText:[],//主诉框内的值
-  selecteds:[],
   moduleNum:{num:0},//点了几次添加病情变化
   focusIndex:'',
   mainIds:[], //选中的主症状和伴随的id(搜索去重)