Bläddra i källkod

切换模式其他史数据bug

zhouna 6 år sedan
förälder
incheckning
48a9a00b3b

+ 1 - 1
src/config/index.js

@@ -12,7 +12,7 @@ export default {
       '1':'mainSuit',         //主诉
       '2':'current',          //现病史
       '3':'process',          //病程变化
-      '4':'otherHis',         //其他史
+      '4':'otherHisModel',         //其他史
       // '5':'checkbody'        //查体
       '5':'currentEmpty',        //现病史空模板
       '6':'addSymptom'        //添加病情变化--主诉

+ 4 - 3
src/containers/OtherHistory.js

@@ -8,7 +8,7 @@ import {billing} from '@store/async-actions/pushMessage';
 import {fullfillText} from '@common/js/func';
 import {didPushParamChange} from '@utils/tools.js';
 
-function mapStateToProps(state){console.log(state)
+function mapStateToProps(state){
   const {otherHistory,homePage,typeConfig,mainSuit} = state;
   const hasMain = mainSuit.saveText.join('');//||mainSuit.data.length;
   return {
@@ -36,10 +36,11 @@ function mapDispatchToProps(dispatch,store){
       //先获取最近记录,没有的话显示模板
       dispatch((dispatch,getStore)=>{
         const initData = getStore().homePage.initData;
-        const arr = JSON.parse(JSON.stringify(initData.otherHis));
+        const model = JSON.parse(JSON.stringify(initData.otherHisModel));
+        const arr = JSON.parse(JSON.stringify(initData.otherHis||null));
         const arrSave = JSON.parse(JSON.stringify(initData.otherHisSave||null));
         const isHis = initData.otherIsHis;
-        const listObj = isHis?{newArr:arr,saveText:arrSave||[]}:fullfillText(arr);
+        const listObj = isHis?{newArr:arr,saveText:arrSave||[]}:fullfillText(model);
         dispatch({
           type:SETDATA,
           data:listObj.newArr,

+ 10 - 2
src/containers/TypeConfigContainer.js

@@ -8,6 +8,7 @@ import config from "@config/index";
 import { initItemList } from '@store/async-actions/tabTemplate';
 import { allCheckedShow } from '@store/actions/tabTemplate';
 import {Notify} from '@commonComp';
+import {SETOTHERHISTORY} from "../store/types/homePage";
 
 function mapStateToProps(state) {
   return {
@@ -34,10 +35,17 @@ function mapDispatchToProps(dispatch) {
       //保存模式切换结果
       dispatch(saveMode(confirmType)).then((res)=>{
         if(res.data.code=='0'&&res.data.data){
+          //清空所有数据
           pushAllDataList('','clear');
           dispatch({type: CONFIRM_TYPE, confirmType});
-          //清空所有数据
-          dispatch(getOtherHisRecord());          //获取其他史最近记录
+          //切换模式是要重新获取其他史数据
+          dispatch({
+            type:SETOTHERHISTORY,
+            data:[],
+            save:[],
+            otherIsHis:false
+          });
+          dispatch(getOtherHisRecord());        //获取其他史最近记录
           Notify.success("模式切换成功");
           dispatch(initItemList(confirmType));
           dispatch(allCheckedShow(false))    //全选反选显示重置

+ 1 - 1
src/store/reducers/homePage.js

@@ -44,7 +44,7 @@ export default function (state=initState,action) {
     case SETOTHERHISTORY:
       res.initData.otherHis = action.data;
       res.initData.otherHisSave = action.save;
-      res.initData.otherIsHis = true;
+      res.initData.otherIsHis = action.otherIsHis!=undefined?action.otherIsHis:true;
       return res;
     /*case SETTEXTFOCUS:
       res.focusTextIndex = action.index;

+ 1 - 1
src/utils/tools.js

@@ -218,7 +218,7 @@ const getAllDataStringList =(baseList) =>{           //获取所有模块文本
       'diag' : baseList.diagnosticList.diagnosticStr,
       'advice' : baseList.pushMessage.AdviceStr
     }
-    console.log(jsonDataString,'文本模式数据获取')
+    //console.log(jsonDataString,'文本模式数据获取')
     return jsonDataString;
 }
 /**