소스 검색

现病史其他史组合中单列多选事件添加

zhouna 6 년 전
부모
커밋
30caaa8bf6
3개의 변경된 파일36개의 추가작업 그리고 8개의 파일을 삭제
  1. 2 2
      src/containers/Multiple.js
  2. 17 3
      src/store/actions/currentIll.js
  3. 17 3
      src/store/actions/otherHistory.js

+ 2 - 2
src/containers/Multiple.js

@@ -32,7 +32,7 @@ function handleCurrent(dispatch,params){
   const index = getLabelIndex(ikey);
   dispatch({
     type:CURRENT_MUL,
-    data:{seleData,seleId,ikey:index}
+    data:{seleData,seleId,ikey:index,fullIkey:ikey}
   })
 }
 
@@ -41,7 +41,7 @@ function handleOtherHis(dispatch,params){
   const index = getLabelIndex(ikey);
   dispatch({
     type:OTHERHIS_MUL,
-    data:{seleData,seleId,ikey:index}
+    data:{seleData,seleId,ikey:index,fullIkey:ikey}
   })
 }
 

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

@@ -824,12 +824,26 @@ export function removeId(state,action){
 // 单列多选
 export function multipleComfirn(state,action){
   let res = Object.assign({},state);
-  const {ikey,seleData} = action.data;
-  let data = res.data;
+  const {ikey,seleData,fullIkey} = action.data;
+  let data = res.data;//console.log(action,data[ikey])
+  let index = fullIkey.substr(fullIkey.length-1,1);
+  if(data[ikey].tagType==3){    //在组合项中
+    let item = data[ikey].questionMapping;
+    let arr=[];
+    item[index].value = seleData;
+    item.map((it)=>{
+      if(it.value){
+        arr.push(it.labelPrefix+it.value+it.labelSuffix);
+      }
+    });
+    res.saveText[ikey] = arr.join("");
+    res.update = Math.random();
+    res.selecteds[ikey] = {[index]:action.data};
+    return res;
+  }
   data[ikey].value = seleData;
   res.saveText[ikey] = seleData;
   res.selecteds[ikey] = action.data;
-  res.update = Math.random();
   return res;
 }
 

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

@@ -404,12 +404,26 @@ export function removeId(state,action){
 // 单列多选
 export function multipleComfirn(state,action){
   let res = Object.assign({},state);
-  const {ikey,seleData} = action.data;
-  let data = res.data;
+  const {ikey,seleData,fullIkey} = action.data;
+  let data = res.data;//console.log(action,data[ikey])
+  let index = fullIkey.substr(fullIkey.length-1,1);
+  if(data[ikey].tagType==3){    //在组合项中
+    let item = data[ikey].questionMapping;
+    let arr=[];
+    item[index].value = seleData;
+    item.map((it)=>{
+      if(it.value){
+        arr.push(it.labelPrefix+it.value+it.labelSuffix);
+      }
+    });
+    res.saveText[ikey] = arr.join("");
+    res.update = Math.random();
+    res.selecteds[ikey] = {[index]:action.data};
+    return res;
+  }
   data[ikey].value = seleData;
   res.saveText[ikey] = seleData;
   res.selecteds[ikey] = action.data;
-  res.update = Math.random();
   return res;
 }