瀏覽代碼

其他史数字键盘月经史bug修改

zhouna 5 年之前
父節點
當前提交
0e1e89c340
共有 2 個文件被更改,包括 30 次插入2 次删除
  1. 28 0
      src/store/actions/otherHistory.js
  2. 2 2
      src/store/reducers/otherHistory.js

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

@@ -220,6 +220,34 @@ export const setTextModeValue = (state,action)=>{
   return res;
 };
 
+//数字键盘选中事件
+export function setNumberValue(state,action){
+  let res = Object.assign({},state);
+  const param = action.params;
+  const ikey = param.ikey;
+  const code = param.formulaCode;
+  let labelInx = getLabelIndex(ikey);
+  const subInx = ikey.substr(ikey.length-1);
+  let item = res.data[labelInx];
+  if(+item.tagType===1){
+    item.value = param.text;
+    res.saveText[labelInx] = param.text?item.labelPrefix+param.text+item.labelSuffix:'';
+  }else{
+    item.questionMapping[subInx].value = param.text;
+    let hasValue = false;
+    const sub = item.questionMapping.map((it)=>{
+      if(it.value){     //至少有一个子值才黑显
+        hasValue = true;
+      }
+      return (it.labelPrefix||'')+(it.value||'')+(it.labelSuffix||'');
+    });
+    res.saveText[labelInx] = hasValue?sub.join(''):'';
+  }
+  res[code] = param.text;
+  res.update = Math.random();
+  return res;
+}
+
 //复制标签(如血压)事件
 export function addLabelItem(state,action){
   let res = Object.assign({},state);

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

@@ -2,9 +2,9 @@ import {RECOVER_TAG_OTHER,SETDATA,CONFIRMSELECTED,SETRADIO,SETNUMBER,SETOTHERCHE
   SELECTOTHERSEARCHDATA,CLEAROTHERHISTORY,CHANGEOTHERTEXTLABEL,SETOTHERINPUT,SETTEXTMODEVALUE,OTHER_FOCUS_INDEX,OTHERHIS_CLEAR,
   OTHERADDLABELITEM,OTHEREDICLEAR,DEL_OTHERHIS,OTHERHIS_MUL,REMOVE_OTHER_ID,DEL_OTHERHIS_LABLE,SET_OT_RADIO_INPUT_VAL} from '../types/otherHistory';
 import {recoveTag,confirm,setCheckBoxValue,setCheckText,setSearchData,insertLabelData,clearOtherHistory,
-  changeTextLabel,setTextModeValue,addLabelItem,otherEditClear,backspaceText,multipleComfirn,
+  changeTextLabel,setTextModeValue,addLabelItem,setNumberValue,otherEditClear,backspaceText,multipleComfirn,
   removeId,delSingleLable} from '../actions/otherHistory';
-import {setRadioInputValue,setRadioValue,setNumberValue,setInputLabel} from '@utils/utils';
+import {setRadioInputValue,setRadioValue,setInputLabel} from '@utils/utils';
 import config from '@config/index';
 
 const block = Object.assign(JSON.parse(config.textLabel),{full:true});//空白时保留一个自由文本标签