فهرست منبع

设置按钮禁用处理

zhouna 5 سال پیش
والد
کامیت
c785ca2456

+ 6 - 3
src/components/Banner/ModeChange/index.jsx

@@ -9,7 +9,7 @@ class ModeChange extends Component {
 
 
     render(){
-        const {closeConfigModal, changeType, confirmType, mode} = this.props;
+        const {closeConfigModal, changeType, confirmType, mode,hideBtn} = this.props;
         const domNode = document.getElementById('root');
         const isOpen = mode==='1';
         return ReactDom.createPortal(<React.Fragment>
@@ -20,14 +20,17 @@ class ModeChange extends Component {
                 <div className={style["oper"]}>
                     <p>
                       <span>开启模板智能推送:</span>
-                      <a className={style['switch']} href="javascript:void(0)" onClick={()=>changeType(isOpen?'0':'1')}><img src={isOpen?sclose:sopen} alt=""/>{isOpen?'关':'开'}</a>
+                      <a className={style['switch']} href="javascript:void(0)" onClick={()=>changeType(isOpen?'0':'1')}>
+                        {hideBtn?<img src={isOpen?sclose:sopen} alt=""/>:''}
+                        {isOpen?'关':'开'}
+                        </a>
                     </p>
                 </div>
                 <div className={style["explain"]}>
                     <p>说明:</p>
                     <p>该设置只针对问诊模块中的“主诉”、“现病史”、“其他史”功能;</p>
                 </div>
-                <div className={style['btn']} onClick={confirmType}><button>保存修改</button></div>
+                {hideBtn?<div className={style['btn']} onClick={confirmType}><button>保存修改</button></div>:''}
             </div>
         </div>
       </React.Fragment>,domNode)

+ 2 - 2
src/components/Banner/ModeChange/index.less

@@ -19,7 +19,7 @@
       width: 432px;
       left:50%;
       margin-left: -216px;
-      min-height: 277px;
+      min-height: 284px;
       background: #fff;
       .oper{
         margin: 20px 30px;
@@ -71,7 +71,7 @@
       }
       .btn {
         text-align: center;
-        margin-bottom: 20px;
+        margin-bottom: 30px;
         button{
           .btnCom;
           height: 34px;

+ 3 - 1
src/components/Banner/index.jsx

@@ -72,10 +72,11 @@ class Banner extends Component {
     dragBox('previewWrapper','previewStatic','del')    
   }
   render() {
-    const {visible,ifShow,deptName, closeConfigModal} = this.props;
+    const {visible,ifShow,deptName, closeConfigModal,hasMain,hasCurrent,hasOther} = this.props;
     const {mode,emergencyBox} = this.state;
     const {showConfigModal, changeType, confirmType} = this;
     const domNode = document.getElementById('root');
+    const disabled = !(hasMain||hasCurrent||hasOther);
     return (
       <div className={style["logo"]} >
         <img src={logo} />
@@ -92,6 +93,7 @@ class Banner extends Component {
         </div>
         {visible&& <ModeChange
           mode = {mode}
+          hideBtn={disabled}
           closeConfigModal = {closeConfigModal}
           changeType = {changeType}
           confirmType = {confirmType}

+ 0 - 6
src/containers/OtherHistory.js

@@ -35,12 +35,6 @@ function mapDispatchToProps(dispatch,store){
     setInitData(){
       //先获取最近记录,没有的话显示模板
       dispatch(setOtherHisModule());
-      //右侧推送
-      setTimeout(function(){      //延迟待确定后的数据更新后推送,避免获取的参数还是旧的
-        if(didPushParamChange()){     //操作后内容有变化才推送
-          dispatch(billing());
-        }
-      },500);
     },
     fetchModules(param){
       const {id,name,index,span,searchInEnd} = param;

+ 22 - 5
src/containers/TypeConfigContainer.js

@@ -2,15 +2,30 @@ import React from "react";
 import { connect } from "react-redux";
 import Banner from "../components/Banner";
 import { SHOW_CONFIG_MODAL, CLOSE_CONFIG_MODAL, CHANGE_TYPE, CONFIRM_TYPE } from "../store/types/typeConfig";
-
-import {saveMode} from '@store/async-actions/fetchModules';
+import {pushAllDataList} from '@utils/tools';
+import {saveMode,getOtherHisRecord} from '@store/async-actions/fetchModules';
 import config from "@config/index";
+import { allCheckedShow } from '@store/actions/tabTemplate';
 import {Notify} from '@commonComp';
 
+//判断模块是否有数据
+function ifHasData(data,saveText){
+  if(saveText[0]||data.length>1||(data.length===1&&(data[0].value||(data[0].value!==''&&data[0].name)))){
+    return true;
+  }
+  return false;
+}
+
 function mapStateToProps(state) {
+  const main = state.mainSuit;
+  const current = state.currentIll;
+  const other = state.otherHistory;
   return {
     typeConfig:state.typeConfig.typeConfig||config.defaultValue.mode,
-    visible:state.typeConfig.visible
+    visible:state.typeConfig.visible,
+    hasMain:ifHasData(main.data,main.saveText),
+    hasCurrent:ifHasData(current.data,current.saveText),
+    hasOther:ifHasData(other.data,other.saveText),
   };
 }
 
@@ -29,9 +44,11 @@ function mapDispatchToProps(dispatch) {
       //保存模式切换结果
       dispatch(saveMode(confirmType)).then((res)=>{
         if(res.data.code=='0'&&res.data.data){
-          //切换后只会影响下一个点的模块(主诉、现病史、其他史)是否有模板
+          //清空所有数据
+          pushAllDataList('','clear');
           dispatch({type: CONFIRM_TYPE, confirmType});
-          Notify.success("模式切换成功");
+          Notify.success("修改成功");
+          dispatch(allCheckedShow(false))    //全选反选显示重置
         }else{
           Notify.error(res.data.msg+",请稍后再试");
         }

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

@@ -215,7 +215,7 @@ export function setOtherHisModule(){
     const otherModel = initData.otherHisModel;
     const block = Object.assign(JSON.parse(config.textLabel),{full:true});
     const mode = state.typeConfig.typeConfig;
-    const model = otherModel&&otherModel.length>0?[...otherModel]:[block];     //其他史模板
+    const model = otherModel&&otherModel.length>0?[...otherModel]:[block];     //其他史模板,没有模板数据则显示一个空文本标签
     const arr = deepClone(initData.otherHis);        //最近其他史数据
     const arrSave = deepClone(initData.otherHisSave);    //最近其他史saveText
     const selects = initData.otherSelecteds?[...initData.otherSelecteds]:[];  //其他史杂音类选中项