瀏覽代碼

医生患者信息未获取到禁止操作332

zhouna 5 年之前
父節點
當前提交
72b880dc9f

+ 6 - 4
src/common/components/Loading/index.jsx

@@ -8,7 +8,7 @@
 import React, {Component} from 'react';
 /*import PropTypes from 'prop-types';*/
 import style from './index.less';
-// import icon from './img/loading.gif';
+ import wnIcon from '@common/images/wn.png';
 import icon from '@common/images/loading.gif';
 import ReactDom from 'react-dom';
 
@@ -37,16 +37,18 @@ const defaultProps = {
 
 class Loading extends React.Component{
     render(){
-        const {text,show} = this.props;
+        const {text,show,type} = this.props;
         const domNode = document.getElementById('root');
         return ReactDom.createPortal(<React.Fragment>
             <div className={style['loading']} style={{display: show ? 'block' : 'none'}}>
                 {/*{this.props.shadeIsShow?<div className={style['cover']}/>:null}*/}
                 <div className={style['cover']}/>
-                <div className={style['info']}>
+              {type==='warning'?<div className={style['t-info']}>
+                <p><img src={wnIcon} alt=""/>{text}</p>
+              </div>:<div className={style['info']}>
                     <img src={icon}/>
                     <p>{text}</p>
-                </div>
+                </div>}
             </div>
         </React.Fragment>,domNode
         )

+ 15 - 1
src/common/components/Loading/index.less

@@ -23,8 +23,22 @@
       width: 40px;
       height: 40px;
     }
+    p{
+      color: #fff;
+    }
   }
-  p{
+  .t-info{
+    position: absolute;
+    top: 40%;
+    left: 45%;
+    background: #000;
+    opacity: 0.8;
     color: #fff;
+    padding:25px;
+    border-radius: 10px;
+    img{
+      vertical-align: middle;
+      margin-right: 10px;
+    }
   }
 }

二進制
src/common/images/wn.png


+ 4 - 2
src/components/InfoTitle/index.jsx

@@ -50,7 +50,7 @@ class InfoTitle extends Component {
         }
     }
     render() {
-        const {disVisible,copyVisible,winWidth,loading} = this.props;
+        const {loading,loadingText,loadingType} = this.props;
         const {le} = this.state;
         return <div className={style['title-wrapper']}  style={{left:le}}>
             <PatInfoContainer />
@@ -63,7 +63,7 @@ class InfoTitle extends Component {
                 </div>
             </div>
             <HistoryCases></HistoryCases>
-            <Loading show={loading}/>
+            <Loading show={loading} text={loadingText} type={loadingType}/>
         </div>;
     }
 }
@@ -73,6 +73,8 @@ function mapStateToProps(state) {
     copyVisible:state.copyRight.copyVisible,
     winWidth:state.homePage.windowWidth,
     loading:state.copyRight.loading,
+    loadingText:state.copyRight.loadingText,
+    loadingType:state.copyRight.loadingType
   }
 }
 

+ 1 - 1
src/containers/DiagnosticList.js

@@ -27,7 +27,7 @@ function mapStateToProps(state) {
       //wholeResults:assessResult.wholeResults,
         scaleInfo: pushMessage.scaleInfo,//量表内容
         showHide: pushMessage.showHide,
-        loading: diagnosticList.loading,
+        loading: diagnosticList.loading&&!state.copyRight.loading,
         windowWidth: state.homePage.windowWidth
     }
 }

+ 1 - 1
src/containers/MainSuit.js

@@ -192,7 +192,7 @@ function mapDispatchToProps(dispatch) {
       },
       async saveChronic(item,isTextMode){//储存慢病信息
         // loading
-        dispatch({type:MODI_LOADING,flag:true});
+        dispatch({type:MODI_LOADING,flag:true});console.log(111)
         // 存慢病
         dispatch({
           type:SAVE_CHRONIC,

+ 20 - 2
src/store/async-actions/patInfo.js

@@ -9,6 +9,7 @@ import {ISREAD,MODI_LOADING,SETPRE,SETPREDATA,SETADMIN} from "../types/homePage"
 import { initItemList } from '@store/async-actions/tabTemplate';
 import config from '@config/index';
 import {Notify} from '@commonComp';
+import {SHOW_LOADING} from '@store/types/copyRight.js';
 
 const api = {
     getPatInfo: '/patientInfo/getTopPatientInfo',
@@ -176,6 +177,7 @@ export async function getPatientMessage(dispatch, getState){
     patientCode:urlDatas.patientNo,
     recordId:urlDatas.recordId
   };
+
   let res1 = await json(api.getPatInfo, params);
   /*console.log(res1);
   console.log(1);*/
@@ -185,12 +187,28 @@ export async function getPatientMessage(dispatch, getState){
   let data1 = {},data2 = {};
   if(res1.data.code=='0'){
     data1 = res1.data.data;
-    getDoctorConfig(data1.doctorId,dispatch);
+    data1.doctorId&&getDoctorConfig(data1.doctorId,dispatch);
+  }else{
+    dispatch({type:MODI_LOADING,flag:false});
+    dispatch({type:SHOW_LOADING,flag:true,text:res1.data.msg,lType:'warning'});
+    return;
   }
   if(res2.data.code=='0'){
     data2 = res2.data.data;
+  }else{
+    dispatch({type:MODI_LOADING,flag:false});
+    dispatch({type:SHOW_LOADING,flag:true,text:res1.data.msg,lType:'warning'});
+    return;
+  }
+  //患者或医生信息有误,禁止操作
+  if(Object.keys(data1).length>0&&Object.keys(data2).length>0&&data1.doctorId){
+    dispatch({type:SHOW_LOADING,flag:false});
+  }else{
+    dispatch({type:MODI_LOADING,flag:false});
+    dispatch({type:SHOW_LOADING,flag:true,text:"未获取到医生id",lType:'warning'});
+    return;
   }
-  getAdminCheckout(data1.doctorId,data1.hospitalId,dispatch)
+  getAdminCheckout(data1.doctorId,data1.hospitalId,dispatch);
   dispatch({
     type: GET_PATIENT_MESSAGE,
     data:Object.assign(data1,data2)

+ 2 - 0
src/store/reducers/copyRight.js

@@ -29,6 +29,8 @@ export default function(state = initState, action) {
       return getVersion(state, action);
     case SHOW_LOADING:
       res.loading = action.flag;
+      res.loadingText=action.text;
+      res.loadingType=action.lType;
       return res;
     default:
       return state;