Sfoglia il codice sorgente

血压中带输入单选处理857

zhouna 6 anni fa
parent
commit
3277fc14d1

+ 7 - 7
src/containers/RadioInpDrop.js

@@ -22,11 +22,11 @@ function mapStateToProps(state){
 // 主诉选中事件
 function mainSelect(dispatch,params){
   const {ikey,id,values} = params;
-  let index = getLabelIndex(ikey);
+  //let index = getLabelIndex(ikey);
   dispatch({
     type:SET_MS_RADIO_INPUT_VAL,
     data:{
-      ikey:index,
+      ikey,
       id,
       values
     }
@@ -36,11 +36,11 @@ function mainSelect(dispatch,params){
 // 现病史选中事件
 function currentSelect(dispatch,params){
   const {ikey,id,values} = params;
-  let index = getLabelIndex(ikey);
+  //let index = getLabelIndex(ikey);
   dispatch({
     type:SET_RADIO_INPUT_VALUE,
     data:{
-      ikey:index,
+      ikey,
       id,
       values
     }
@@ -51,11 +51,11 @@ function currentSelect(dispatch,params){
 //其他史选中事件
 function otherSelect(dispatch,params){
   const {ikey,id,values} = params;
-  let index = getLabelIndex(ikey);
+  //let index = getLabelIndex(ikey);
   dispatch({
     type:SET_OT_RADIO_INPUT_VAL,
     data:{
-      ikey:index,
+      ikey,
       id,
       values
     }
@@ -147,7 +147,7 @@ function mapDispatchToProps(dispatch,store){
       let ikey = getLabelIndex(index);
       dispatch({
         type:InputActions[+boxMark],
-        data:{values:params.values,ikey:boxMark==4?params.ikey:ikey}
+        data:{values:params.values,ikey:params.ikey}
       });
       dispatch(billing());
       dispatch({

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

@@ -149,7 +149,7 @@ export const setRadioInputValue = (state,action)=>{
   let index = getLabelIndex(ikey);
   let innerInx = ikey.substr(ikey.length-1);
   let item = res.data[index];
-  if(item.tagType==3){      //在组合项中
+  if(item.tagType!=1){      //在组合项中
     item = res.data[index].questionMapping[innerInx];
   }
   let str='',temp='',obj=item.questionDetailList;
@@ -195,7 +195,7 @@ export const setRadioInputValue = (state,action)=>{
   }
   item.vals = values;
   item.value = str;
-  if(res.data[index].tagType==3){
+  if(res.data[index].tagType!=1){
     let hasValue = false;
     const sub = res.data[index].questionMapping.map((it)=>{
       return (it.labelPrefix||'')+(it.value||'')+(it.labelSuffix||'');

+ 28 - 4
src/store/actions/currentIll.js

@@ -488,8 +488,13 @@ export function setRadioValue(state,action){
 export const setRadioInputValue = (state,action)=>{
   const res = Object.assign({},state);
   const {ikey,values,id} = action.data;
-  const item = res.data[ikey];
-  let str='',temp='',obj=res.data[ikey].questionDetailList;
+  let index = getLabelIndex(ikey);
+  let innerInx = ikey.substr(ikey.length-1);
+  let item = res.data[index];
+  if(item.tagType!=1){      //在组合项中
+    item = res.data[index].questionMapping[innerInx];
+  }
+  let str='',temp='',obj=item.questionDetailList;
   if(!values){    //清空
     let sld=obj.find((item)=>{
       return item.selected==true;
@@ -497,7 +502,18 @@ export const setRadioInputValue = (state,action)=>{
     sld?sld.selected=false:'';
     item.vals = null;
     item.value = '';
-    res.saveText[ikey] = '';
+    if(res.data[index].tagType!=1){
+      let hasValue = false;
+      const sub = res.data[index].questionMapping.map((it)=>{
+        if(it.value){     //至少有一个子值才黑显
+          hasValue = true;
+        }
+        return (it.labelPrefix||'')+(it.value||'')+(it.labelSuffix||'');
+      });
+      res.saveText[index] = hasValue?sub.join(''):'';
+    }else{
+      res.saveText[index] = '';
+    }
     res.update = Math.random();
     return res;
   }
@@ -521,7 +537,15 @@ export const setRadioInputValue = (state,action)=>{
   }
   item.vals = values;
   item.value = str;
-  res.saveText[ikey] = str;
+  if(res.data[index].tagType!=1){
+    let hasValue = false;
+    const sub = res.data[index].questionMapping.map((it)=>{
+      return (it.labelPrefix||'')+(it.value||'')+(it.labelSuffix||'');
+    });
+    res.saveText[index] = sub.join('');
+  }else {
+    res.saveText[ikey] = str;
+  }
   res.update = Math.random();
   return res;
 }

+ 28 - 4
src/store/actions/mainSuit.js

@@ -488,8 +488,13 @@ export function setRadioValue(state,action){
 export const setRadioInputValue = (state,action)=>{
   const res = Object.assign({},state);
   const {ikey,values,id} = action.data;
-  const item = res.data[ikey];
-  let str='',temp='',obj=res.data[ikey].questionDetailList;
+  let index = getLabelIndex(ikey);
+  let innerInx = ikey.substr(ikey.length-1);
+  let item = res.data[index];
+  if(item.tagType!=1){      //在组合项中
+    item = res.data[index].questionMapping[innerInx];
+  }
+  let str='',temp='',obj=item.questionDetailList;
   if(!values){    //清空
     let sld=obj.find((item)=>{
       return item.selected==true;
@@ -497,7 +502,18 @@ export const setRadioInputValue = (state,action)=>{
     sld?sld.selected=false:'';
     item.vals = null;
     item.value = '';
-    res.saveText[ikey] = '';
+    if(res.data[index].tagType!=1){
+      let hasValue = false;
+      const sub = res.data[index].questionMapping.map((it)=>{
+        if(it.value){     //至少有一个子值才黑显
+          hasValue = true;
+        }
+        return (it.labelPrefix||'')+(it.value||'')+(it.labelSuffix||'');
+      });
+      res.saveText[index] = hasValue?sub.join(''):'';
+    }else{
+      res.saveText[index] = '';
+    }
     res.update = Math.random();
     return res;
   }
@@ -521,7 +537,15 @@ export const setRadioInputValue = (state,action)=>{
   }
   item.vals = values;
   item.value = str;
-  res.saveText[ikey] = str;
+  if(res.data[index].tagType!=1){
+    let hasValue = false;
+    const sub = res.data[index].questionMapping.map((it)=>{
+      return (it.labelPrefix||'')+(it.value||'')+(it.labelSuffix||'');
+    });
+    res.saveText[index] = sub.join('');
+  }else {
+    res.saveText[ikey] = str;
+  }
   res.update = Math.random();
   return res;
 }

+ 28 - 4
src/store/actions/otherHistory.js

@@ -107,8 +107,13 @@ export function setRadioValue(state,action){
 export const setRadioInputValue = (state,action)=>{
   const res = Object.assign({},state);
   const {ikey,values,id} = action.data;
-  const item = res.data[ikey];
-  let str='',temp='',obj=res.data[ikey].questionDetailList;
+  let index = getLabelIndex(ikey);
+  let innerInx = ikey.substr(ikey.length-1);
+  let item = res.data[index];
+  if(item.tagType!=1){      //在组合项中
+    item = res.data[index].questionMapping[innerInx];
+  }
+  let str='',temp='',obj=item.questionDetailList;
   if(!values){    //清空
     let sld=obj.find((item)=>{
       return item.selected==true;
@@ -116,7 +121,18 @@ export const setRadioInputValue = (state,action)=>{
     sld?sld.selected=false:'';
     item.vals = null;
     item.value = '';
-    res.saveText[ikey] = '';
+    if(res.data[index].tagType!=1){
+      let hasValue = false;
+      const sub = res.data[index].questionMapping.map((it)=>{
+        if(it.value){     //至少有一个子值才黑显
+          hasValue = true;
+        }
+        return (it.labelPrefix||'')+(it.value||'')+(it.labelSuffix||'');
+      });
+      res.saveText[index] = hasValue?sub.join(''):'';
+    }else{
+      res.saveText[index] = '';
+    }
     res.update = Math.random();
     return res;
   }
@@ -140,7 +156,15 @@ export const setRadioInputValue = (state,action)=>{
   }
   item.vals = values;
   item.value = str;
-  res.saveText[ikey] = str;
+  if(res.data[index].tagType!=1){
+    let hasValue = false;
+    const sub = res.data[index].questionMapping.map((it)=>{
+      return (it.labelPrefix||'')+(it.value||'')+(it.labelSuffix||'');
+    });
+    res.saveText[index] = sub.join('');
+  }else {
+    res.saveText[ikey] = str;
+  }
   res.update = Math.random();
   return res;
 }