Преглед на файлове

其他史高血压选中bug修改

zhouna преди 6 години
родител
ревизия
45b1158b6f
променени са 2 файла, в които са добавени 22 реда и са изтрити 18 реда
  1. 5 2
      src/containers/SpreadDrop.js
  2. 17 16
      src/store/actions/otherHistory.js

+ 5 - 2
src/containers/SpreadDrop.js

@@ -142,15 +142,18 @@ function otherHisConfirm(dispatch,store,params){
     if(+res.data.code===0){
       const list = res.data.data;
       existsId.map((i)=>{
-        has.push(list[i]);
+        has.push(...list[i].questionMapping);
       });
       withsId.map((i)=>{
-        wes.push(list[i]);
+        wes.push(...list[i].questionMapping);
       });
       dispatch({
         type: CONFIRMSELECTED,
         data: {exists:fullfillText(has,false,false).newArr,withs:fullfillText(wes,false,false).newArr,nones:nones,ikey,copyType}
       });
+      dispatch({
+        type:ISREAD
+      });
     }
   });
 }

+ 17 - 16
src/store/actions/otherHistory.js

@@ -15,30 +15,31 @@ export const confirm = (state,action) =>{
     return res;
   }
   //只有无的项目选中
+  if(+copyType===0) {      //原标签保留
+    arr.splice(ikey,1);
+  }
   if(arr[ikey].value)  arr[ikey].value= '';
+  let newPreText = (arr[ikey-1].value||arr[ikey-1].name||'')+nones;//console.log(arr[ikey-1],newPreText)
   if([...exists,...withs].length==0&&nones){
-    const newPreText = arr[ikey-1].name+nones;//console.log(arr[ikey-1],newPreText)
     arr[ikey-1].value = newPreText;
     res.saveText[ikey-1] = newPreText;
     res.update=Math.random();
     return res;
   }
-  //有、伴项目有选中
-  //const existDatas = fullfillText(exists).newArr;
-  //let withDatas = fullfillText(withs).newArr;
-  /*if(withDatas&&withDatas.length>0){
-    withDatas[0].value=withs.length>0?"伴":'';
-  }*/
-  //const text = Object.assign({},JSON.parse(config.textLabel),{value:"伴"}):undefined;
-  if(+copyType===1){       //原标签保留
+  //有,无,伴随配
+    arr.splice(ikey-1,1);
+    let flabel = [...exists,...withs][0];         //要插入的第一个标签
+    let text = newPreText;
+    //要插入的第一个标签为自由文本,则和前一个文本标签文字合并
+    if(flabel.tagType==8){
+      flabel.value = newPreText+(flabel.value||flabel.name);
+      text = flabel.value;
+    }
     arr.splice(ikey-1,0,...exists,...withs);
-  }else{                 //替换原标签
-    arr.splice(ikey,1);
-    arr.splice(ikey-1,1,...exists,...withs);
-  }
-
-  res.update=Math.random();         //用于触发组件更新(data变化了因在对象中无法被组件检测到)
-  return res;
+    arr[ikey-1].value = text;
+    res.saveText[ikey-1] = text;
+    res.update=Math.random();         //用于触发组件更新(data变化了因在对象中无法被组件检测到)
+    return res;
 };
 
 //单选下拉选中