Przeglądaj źródła

默认值显示bug修改2971,2966

zhouna 5 lat temu
rodzic
commit
94ae201000

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

@@ -136,7 +136,7 @@ export const setData = (state,action) =>{
   
   if (useEmpty) {
     const data = res.emptyData?JSON.parse(JSON.stringify(res.emptyData)):[];
-    res.data = fullfillText(data).newArr;
+    res.data = fullfillText(data,false,false,'2').newArr;
     res.useEmpty = true; //取子模板标识
   } else {
     if(mainData&&mainData.length>0){//主诉使用模板
@@ -272,7 +272,7 @@ export const setData = (state,action) =>{
         current = newSymptomArr;
       }
       let currentData = JSON.parse(JSON.stringify(current));
-      res.data = fullfillText(currentData).newArr;
+      res.data = fullfillText(currentData,false,false,'2').newArr;
     }else{//分词
       if(symptomFeature&&symptomFeature.length>0){
         let featureData = JSON.parse(JSON.stringify(symptomFeature));
@@ -319,12 +319,12 @@ export const setData = (state,action) =>{
           current = endFeatureData;
         }
         let currentData = JSON.parse(JSON.stringify(current));
-        res.data = fullfillText(currentData).newArr;
+        res.data = fullfillText(currentData,false,false,'2').newArr;
       }
     }
   }
   let resData = JSON.parse(JSON.stringify(res.data));
-  res.saveText = fullfillText(resData).saveText;
+  res.saveText = fullfillText(resData,false,false,'2').saveText;
   res.update=Math.random();
   return res;
 }

+ 1 - 1
src/store/async-actions/fetchModules.js

@@ -217,7 +217,7 @@ export function setOtherHisModule(){
     const listObj = isHis && (mode == 1 || (!onlyOneText && mode == 0)) ? {
       newArr: arr,
       saveText: arrSave || []
-    } : fullfillText(model);
+    } : fullfillText(model,false,false,'3');
     dispatch({
       type: SETDATA,
       data: listObj.newArr,

+ 33 - 10
src/utils/tools.js

@@ -978,7 +978,7 @@ function notTextLabel(label){
 *  出参:newArr添加自由文本标签后的数据Array,
 *        saveText添加自由文本后对应的预览数据Array,
 * */
-function fullfillText(arr,noPre=false,noEnd=false){
+function fullfillText(arr,noPre=false,noEnd=false,boxMark){
   let newArr =[],
     pre={},
     textLabel={},
@@ -1000,11 +1000,13 @@ function fullfillText(arr,noPre=false,noEnd=false){
         saveText.push('');
       }
       newArr.push(it);
-      if(it.tagType != 3){      //非血压类组合标签
+      if(it.tagType == 6||it.tagType == 2){
+        tempText = getDefaultedSaveText(it,boxMark);
+      }else if(it.tagType == 3){
+        tempText = getSaveText(it);
+      }else{      //非血压类组合标签
         tempText = value?it.labelPrefix+value+it.labelSuffix:'';
         tempText = notText?tempText:it.value||it.name;
-      }else{
-        tempText = getSaveText(it);
       }
       saveText.push(tempText);
       // 模板只有一个标签时第一项后面也要加空标签
@@ -1017,19 +1019,23 @@ function fullfillText(arr,noPre=false,noEnd=false){
       //如果本身不是文本标签且前面一个也不是文本标签,该标签前面添加文本标签
       if(notTextLabel(pre)&&notText){
         newArr.push(textLabel,it);
-        if(it.tagType != 3) {
-          tempText = value ? it.labelPrefix + value + it.labelSuffix : '';
-        }else{
+        if(it.tagType == 6||it.tagType == 2){
+          tempText = getDefaultedSaveText(it,boxMark);
+        }else if(it.tagType == 3){
           tempText = getSaveText(it);
+        }else{
+          tempText = value ? it.labelPrefix + value + it.labelSuffix : '';
         }
         saveText.push("",tempText);
       }else{    //本身是或者前面是文本标签时,前面不添加文本标签
         newArr.push(it);
-        if(it.tagType != 3) {
+        if(it.tagType == 6||it.tagType == 2){
+          tempText = getDefaultedSaveText(it,boxMark);
+        }else if(it.tagType == 3){
+          tempText = getSaveText(it);
+        } else{
           tempText = value ? it.labelPrefix + value + it.labelSuffix : '';
           tempText = notText ? tempText : (it.value || it.value == "" ? it.value : it.name);
-        }else{
-          tempText = getSaveText(it);
         }
         saveText.push(tempText);
       }
@@ -1043,6 +1049,23 @@ function fullfillText(arr,noPre=false,noEnd=false){
   return {newArr,saveText};
 };
 
+function getDefaultedSaveText(it,boxMark){
+  const state = store.getState();
+  const {readConfig,typeConfig}=state.typeConfig;
+  const hasReadMode = readConfig!==-1;
+  const curOtherMode =hasReadMode&&readConfig[2]!==null?readConfig[2]:typeConfig[2];
+  const curMode =hasReadMode&&readConfig[1]!==null?readConfig[1]:typeConfig[1];
+  const otherDefault=+curOtherMode===1;
+  const curDefault=+curMode===1;
+  const defaulted = (((boxMark=='2'&&curDefault)||(boxMark=='3'&&otherDefault)))&&it.selFlag=='1'&&it.value===undefined;
+  const ext = it.questionMapping.filter((i)=>{
+    return +i.exclusionType===1;
+  });
+  const text = ext.length>0&&defaulted?ext[0].questionDetailList[0].name:'';
+  //console.log(state);
+  return text;
+}
+
 /*
  * 查体添加自由文本标签函数
  * 默认标签直接添加,