Jelajahi Sumber

保存评估函数移到评估组件中

zhouna 6 tahun lalu
induk
melakukan
0b34740b7c

+ 2 - 2
src/components/AssessResult/index.jsx

@@ -87,7 +87,7 @@ class AssessResult extends Component {
   }
   componentWillUnmount(){
     //点确定关闭弹窗时把参数传到父组件去
-    const {handleSave,isAssessConfirm,clearChartData,handleSavePossible,isRecommend} = this.props;
+    const {saveAssessInfos,isAssessConfirm,clearChartData,handleSavePossible,isRecommend} = this.props;
     clearChartData&&clearChartData();
     if(!isRecommend&&isAssessConfirm && readyKeepHistory() == 1){
       Notify.error("主诉不能为空");
@@ -96,7 +96,7 @@ class AssessResult extends Component {
     }
     handleSavePossible&&handleSavePossible(this.state.wholeResults);
     if(isAssessConfirm){
-      handleSave(this.state,readyKeepHistory(),isRecommend);
+      saveAssessInfos(this.state,readyKeepHistory(),isRecommend);
     }
   }
   handoutTypes(item,i){

+ 1 - 2
src/components/DiagnosticList/index.jsx

@@ -261,8 +261,7 @@ class DiagnosticList extends Component {
                                                top={'3%'}
                                                bottom={'3%'}
                                                width={820}>
-                       <AssessResult handleSave={saveAssessInfos}
-                                     handleSavePossible={this.handleSavePossible}
+                       <AssessResult handleSavePossible={this.handleSavePossible}
                                      closeAssess={this.showAssessFn.bind(this)}
                                      radioVal={radioVal}
                                      possible={possible}

+ 14 - 1
src/containers/AssessResult.js

@@ -7,6 +7,9 @@ import {getAssessData,getIndexData} from '@store/async-actions/fetchModules';
 import {SET_ASSESS_DATA,SET_INDEX_DATA,SET_INDEX_SUB_TYPE,REMOVE_ASSESS_ITEMS,CLEAR_INDEX_DATA,SET_CHRONIC_CALCU_RESULT} from '@types/assessResult';
 import {parseChartData,deepClone} from '@utils/tools';
 import {SHOW_TABLE_LIST,HIDE_TABLE_LIST} from '@store/types/pushMessage';
+import {saveMessage} from "../store/async-actions/print";
+import {SET_SAVE_ASSESS_DATA} from "@types/assessResult";
+import {saveClickNum} from '@store/async-actions/homePage';
 
 /***
  * 管理评估逻辑:
@@ -103,7 +106,17 @@ function mapDispatchToProps(dispatch) {
         value:true,
         item:Object.assign({},item)
       });
-    }
+    },
+    //保存管理评估
+    saveAssessInfos(obj,flg,noSave){     //noSave未true则不调页面保存接口
+      dispatch(Object.assign({},obj,{type:SET_SAVE_ASSESS_DATA}));
+      if(!noSave){
+        dispatch(saveClickNum);
+        if(flg != 1 && flg != 2){
+          dispatch(() => saveMessage())
+        }
+      }
+    },
   }
 }
 

+ 0 - 14
src/containers/DiagnosticList.js

@@ -11,10 +11,6 @@ import {CURRENT_CHRONIC} from '@store/types/currentIll';
 import {autoFillModules} from '@store/async-actions/fetchModules';
 import { initItemList } from '@store/async-actions/historyTemplates';
 import {MODI_LOADING} from '@store/types/homePage.js';
-import {saveMessage} from "../store/async-actions/print";
-import {SET_SAVE_ASSESS_DATA} from "@types/assessResult";
-import {saveClickNum} from '@store/async-actions/homePage';
-
 
 function mapStateToProps(state) {
     const {diagnosticList,assessResult,pushMessage } = state;
@@ -117,16 +113,6 @@ function mapDispatchToProps(dispatch) {
         autoFillModules(){
             dispatch(autoFillModules())//自动分发模板
         },
-        //保存管理评估
-        saveAssessInfos(obj,flg,noSave){     //noSave未true则不调页面保存接口
-          dispatch(Object.assign({},obj,{type:SET_SAVE_ASSESS_DATA}));
-          if(!noSave){
-            dispatch(saveClickNum);
-            if(flg != 1 && flg != 2){
-              dispatch(() => saveMessage())
-            }
-          }
-        },
     }
 }