Browse Source

管理评估无数据不打开弹窗

zhouna 5 years ago
parent
commit
30f40a5c67

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

@@ -33,11 +33,11 @@ class AssessResult extends Component {
     this.handleScaleText = this.handleScaleText.bind(this);
     this.handleResult = this.handleResult.bind(this);
   }
-  componentWillMount(){
+  /*componentWillMount(){
     const {disId,disName,getAssess} = this.props;
     //获取评估
     getAssess&&getAssess(disId,disName);
-  }
+  }*/
   handleScaleText(text){
     const {disName} = this.props;
     const obj = Object.assign({},this.state.wholeAssessText);

+ 22 - 5
src/components/DiagnosticList/index.jsx

@@ -15,6 +15,7 @@ import { dragBox } from '@utils/drag';
 import iconRadioDefault from '@common/images/icon-radio-default.png'
 import iconRadioActive from '@common/images/icon-radio-active.png'
 import AssessResult from '@containers/AssessResult';
+import {getAssessData} from '@store/async-actions/fetchModules';
 import tableIcon from '@common/images/table.png';
 import { CONFIRM_TYPE } from "@store/types/typeConfig";
 import $ from "jquery";
@@ -191,12 +192,28 @@ class DiagnosticList extends Component {
         </div>)
     }
     showAssessFn(item){
+      const {setAssess} = this.props;
+      const that = this;
         if(item&&item.conceptId){         //显示评估弹窗
-          this.setState({
-            showAssess:true,
-            isAssessConfirm:false,
-            assessId:item.conceptId,
-            disName:item.name
+          getAssessData(item.conceptId,item.name).then((res)=>{
+            if(res.data.code=='0'){
+              const data = res.data.data;
+              if(!data||data.length==0){
+                Notify.info('暂无数据');
+              }else{
+                setAssess&&setAssess(data,item.name);
+                that.setState({
+                  showAssess:true,
+                  isAssessConfirm:false,
+                  assessId:item.conceptId,
+                  disName:item.name
+                });
+              }
+            }else{
+              Notify.error(res.data.msg);
+            }
+          }).catch(error=>{
+            console.log(error);
           });
         }else{          //关闭评估弹窗
             this.setState({

+ 2 - 26
src/containers/AssessResult.js

@@ -3,8 +3,8 @@ import {connect} from 'react-redux';
 import AssessResult from '@components/AssessResult';
 import {ISREAD} from '@store/types/homePage.js';
 import {billing} from '@store/async-actions/pushMessage';
-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,SET_CALCU_VALUES} from '@types/assessResult';
+import {getIndexData} from '@store/async-actions/fetchModules';
+import {SET_INDEX_DATA,SET_INDEX_SUB_TYPE,REMOVE_ASSESS_ITEMS,CLEAR_INDEX_DATA,SET_CHRONIC_CALCU_RESULT,SET_CALCU_VALUES} 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";
@@ -47,30 +47,6 @@ function mapStateToProps(state) {
 
 function mapDispatchToProps(dispatch) {
   return {
-    getAssess(disId,disName){        //获取评估内容数据
-      dispatch(getAssessData(disId,disName)).then((res)=>{
-        if(res.data.code=='0'){
-          dispatch({
-            type:SET_ASSESS_DATA,
-            data:res.data.data,
-            name:disName
-          })
-        }else{
-          dispatch({
-            type:SET_ASSESS_DATA,
-            data:[],
-            name:disName
-          })
-        }
-      }).catch(error=>{
-        dispatch({
-          type:SET_ASSESS_DATA,
-          data:[],
-          name:disName
-        });
-        console.log(error);
-      });
-    },
     getIndexData(param){        //获取评估图表数据
       const {range,rangeType,index,pindex,getNew,disName} = param;
       dispatch(getIndexData(range,disName)).then((res)=>{

+ 8 - 0
src/containers/DiagnosticList.js

@@ -11,6 +11,7 @@ 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 {SET_ASSESS_DATA} from '@types/assessResult';
 
 function mapStateToProps(state) {
     const {diagnosticList,assessResult,pushMessage } = state;
@@ -34,6 +35,13 @@ function mapStateToProps(state) {
 
 function mapDispatchToProps(dispatch) {
     return {
+      setAssess(data,disName){        //获取评估内容数据
+        dispatch({
+          type:SET_ASSESS_DATA,
+          data:data,
+          name:disName
+        });
+      },
         delDiagnostic: (item) => {
             dispatch({
                 type: DEL_DIAGNOSTIC,

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

@@ -261,7 +261,7 @@ export function saveMode(mode){
 
 //慢病-获取管理评估
 export function getAssessData(disId,disName){
-  return ()=>{
+  //return ()=>{
     const emrData = getEMRParams();
     const param = {
       diseaseId:disId,
@@ -275,7 +275,7 @@ export function getAssessData(disId,disName){
       symptom:emrData.current + emrData.main
     };
     return json(api.getAssess,param);
-  }
+  //}
 }
 
 //慢病-获取管理评估历史单条记录