瀏覽代碼

可能结果同步

zhouna 6 年之前
父節點
當前提交
d810022a08
共有 3 個文件被更改,包括 16 次插入5 次删除
  1. 2 1
      src/components/AssessResult/index.jsx
  2. 10 3
      src/components/ChronicInfo/index.jsx
  3. 4 1
      src/store/reducers/assessResult.js

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

@@ -68,13 +68,14 @@ class AssessResult extends Component {
   }
   componentWillUnmount(){
     //点确定关闭弹窗时把参数传到父组件去
-    const {handleSave,isAssessConfirm,clearChartData} = this.props;
+    const {handleSave,isAssessConfirm,clearChartData,handleSaveCalcu} = this.props;
     clearChartData&&clearChartData();
     if(isAssessConfirm && readyKeepHistory() == 1){
       Notify.error("主诉不能为空");
     }else if(isAssessConfirm && readyKeepHistory() == 2){
       Notify.info('诊断不能为空');
     }
+    handleSaveCalcu&&handleSaveCalcu(this.state.wholeResults);
     isAssessConfirm&&handleSave(this.state,readyKeepHistory());
   }
   handoutTypes(item,i){

+ 10 - 3
src/components/ChronicInfo/index.jsx

@@ -63,6 +63,7 @@ class ChronicInfo extends React.Component{
     this.onPrint = this.onPrint.bind(this); 
     this.handleForRadio = this.handleForRadio.bind(this);
     this.showRecommendFn = this.showRecommendFn.bind(this);
+    this.handleSaveCalcu = this.handleSaveCalcu.bind(this);     //保存评估修改的计算和可能结果
   }
 
   onPrint() {
@@ -239,7 +240,12 @@ class ChronicInfo extends React.Component{
       radioVal:Object.assign({},possible,radioVal),//不设置radioVal只有最近一次选中的值
       optionId:null
     })
-    
+  }
+  handleSaveCalcu(obj){
+    this.setState({
+      possible:Object.assign({},obj.possible),
+      radioVal:Object.assign({},obj.radioVal),//不设置radioVal只有最近一次选中的值
+    })
   }
   calcuFormula(it,j, v, i) { //计算公式计算
     const { calcuFormula, data ,chronicPushItems} = this.props
@@ -277,8 +283,8 @@ class ChronicInfo extends React.Component{
     }
   }
   getDetail(){
-    const {data,indexs,scaleInfo,formulaResult} = this.props;
-    const {showInfo,showOption,infoId,formulaId,optionId,possible,radioVal,isFormulaConfirm} = this.state;
+    const {data,indexs,formulaResult} = this.props;
+    const {formulaId,optionId,possible,radioVal,isFormulaConfirm} = this.state;
     let list = data&&data.map((v,i)=>{
                     return <div className={style["list"]}>
                       {v.name?<p>
@@ -515,6 +521,7 @@ class ChronicInfo extends React.Component{
                       bottom={20}
                       width={820}>
                 <AssessResult handleSave={saveAssessInfos}
+                              handleSaveCalcu={this.handleSaveCalcu}
                               closeAssess={this.showAssessFn}
                               showScaleFn={this.showTable.bind(this)}
                               calcuFormula={calcuFormula}

+ 4 - 1
src/store/reducers/assessResult.js

@@ -9,7 +9,10 @@ const init = {
   wholeIndexs:{},     //已加入的评估数据的index,加入按钮状态用
   wholeAssessText:'',   //整体评估补充说明
   chooseSelecteds:{},   //选项勾选状态
-  wholeResults:{},    //可能结果
+  wholeResults:{
+    possible:{},
+    radioVal:{}
+  },    //可能结果
 };
 export default (state=init,action)=>{
   const res = Object.assign({},state);