Sfoglia il codice sorgente

Merge branch 'optimize' into optimize-zxc

zhangxc 6 anni fa
parent
commit
7ff93c817c

+ 1 - 0
src/components/AddInspect/SlideExcel/index.less

@@ -42,6 +42,7 @@
 .table {
   color: #000;
   width: 80%;
+  display: inline-block;
   tr {
       line-height: 18px;
       height: 18px;

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

@@ -6,15 +6,15 @@ import ScaleItem from "./ScaleItem";
 import Information from '../Information'
 import ChartItem from "./ChartItem";
 import Notify from '@commonComp/Notify';
-import {readyKeepHistory} from '@utils/tools';
+import {readyKeepHistory,deepClone} from '@utils/tools';
 import loadingIcon from '@common/images/loading.gif';
 
 class AssessResult extends Component {
   constructor(props) {
     super(props);
-    const chooseSelecteds = JSON.parse(JSON.stringify(props.chooseSelecteds)||{});
-    const wholeIndexs = JSON.parse(JSON.stringify(props.wholeIndexs)||{});      //深度复制,Object.assgin为浅复制,下下级会同源
-    const wholeScale = JSON.parse(JSON.stringify(props.wholeScaleItems)||{});
+    const chooseSelecteds = deepClone(props.chooseSelecteds);
+    const wholeIndexs = deepClone(props.wholeIndexs);      //深度复制,Object.assgin为浅复制,下下级会同源
+    const wholeScale = deepClone(props.wholeScaleItems);
 
     this.state={
       chooseSelecteds:chooseSelecteds,     //大数据选择模块

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

@@ -4,8 +4,6 @@ import chronicPic from "../../common/images/chronic.png";
 import level1 from "../../common/images/级别1.png";
 import tableIcon from '@common/images/table.png';
 import allTableIcon from '@common/images/all-table.png';
-import add from '@common/images/add-result.png';
-import added from '@common/images/first.png';
 import checkIcon from '@common/images/check.png';
 import up from '@common/images/slide-up.png';
 import down from '@common/images/slide-down.png';
@@ -152,6 +150,9 @@ class ChronicInfo extends React.Component{
         return ;
       }
       this.handleAddAssessItem(scaleParam.v,scaleParam.i,scaleParam.j);
+      this.setState({
+        scaleParam:{}
+      });
     }
     this.props.hideList({name:'showTable',value:false});
   }
@@ -216,8 +217,9 @@ class ChronicInfo extends React.Component{
     addAssessItem(v,pIndex,i);
   }
   addFormula(it,v,pIndex,i){
+    const {chronicMagItem} = this.props;
     this.closeFormula(it);
-    this.handleAddAssessItem(v,pIndex,i);
+    chronicMagItem&&this.handleAddAssessItem(v,pIndex,i);
   }
   handleReg(e){   //只能输入数字
     const hasDot = e.target.value.indexOf('.')!=-1;
@@ -267,14 +269,14 @@ class ChronicInfo extends React.Component{
   }
   confirmOption(parent,pIndex,i){//可能结果确定
     const {radioVal,possible} = this.state;
-    const {savePossibleResult} = this.props;
+    const {savePossibleResult,chronicMagItem} = this.props;
     this.setState({
       possible:Object.assign({},possible,radioVal),
       radioVal:Object.assign({},possible,radioVal),//不设置radioVal只有最近一次选中的值
       optionId:null,
     });
     savePossibleResult&&savePossibleResult({possible:Object.assign({},possible,radioVal),radioVal:Object.assign({},possible,radioVal)})
-    this.handleAddAssessItem(parent,pIndex,i);
+    chronicMagItem&&this.handleAddAssessItem(parent,pIndex,i);
 
   }
   handleSaveCalcu(obj){
@@ -343,7 +345,7 @@ class ChronicInfo extends React.Component{
   }
   
   getDetail(){
-    const {data,formulaResult,calcuResult,indexs} = this.props;
+    const {data,formulaResult,calcuResult,chronicMagItem} = this.props;
     const {formulaId,optionId,possible,radioVal,calcuValues,currentIndex,hasEnterImg} = this.state;
     let list = data&&data.map((v,i)=>{
                     return <div className={style["list"]}>
@@ -387,7 +389,7 @@ class ChronicInfo extends React.Component{
                             </span>
                             {formulaId&&formulaId==v.conceptId&&<MiniToast title={it.content.name}
                                 icon={allTableIcon}
-                                confirmText='加入病例记录'
+                                confirmText={chronicMagItem?'加入病例记录':'确定'}
                                 show={formulaId&&formulaId==v.conceptId?true:false}
                                 close={this.closeFormula.bind(this,it)}
                                 confirm={this.addFormula.bind(this,it,v,i,j)}
@@ -451,7 +453,7 @@ class ChronicInfo extends React.Component{
                             </span>
                             <MiniToast title='结果选择'
                                 icon={checkIcon}
-                                confirmText='加入病例记录'
+                                confirmText={chronicMagItem?'加入病例记录':'确定'}
                                 show={optionId&&optionId==v.conceptId?true:false}
                                 close={this.closeOption}
                                 confirm={this.confirmOption.bind(this,v,i,j)}
@@ -498,9 +500,9 @@ class ChronicInfo extends React.Component{
     const {comfirnFlag,flag,ff} = this.state;
     const {chronicMagItem,chronicDesease,formulaResult,showHide,slideUp} = this.props;
     const scaleFooter = <Footer print={true}
-                                footText={showHide.isPop?"确定":"加入病例记录"}
+                                footText={showHide.isPop||!chronicMagItem?"确定":"加入病例记录"}
                                 handlePrint={this.onPrint}
-                                handleConfirm={()=>{this.comfirnTable()}}/>;
+                                handleConfirm={this.comfirnTable}/>;
     return <div className={style["tips"]} style={{marginBottom:'15px'}}>
               <div className={`${style["tips-title"]} ${style["chronic"]}`}>
                 <div className={style["tips-name"]}>

+ 1 - 1
src/components/CurrentIll/index.jsx

@@ -52,7 +52,7 @@ class CurrentIll extends Component{
       })
     }else if(!text) {//现病史框里没有内容时才设置模板
       let num = moduleNum.num;//主诉使用了几个模板
-      console.log(999,isChronic)
+      //console.log(999,isChronic)
       if(data.length==0 && !isChronic){
         clearTimeout(setDataTimer);
         setDataTimer = setTimeout(function(){//延时,等待主诉失焦数据返回

+ 9 - 2
src/components/PushItems/TipsMsg/index.jsx

@@ -1,13 +1,20 @@
 import React, { Component } from 'react';
 import style from './index.less';
+import $ from 'jquery';
 
 class TipsMsg extends Component {
     constructor(props) {
-        super(props)
+        super(props);
+    }
+    componentWillReceiveProps(){
+        //滚动条定位到提示信息模块
+        const {patDom} = this.props;
+        const ht = $(patDom.current).height();
+        $(patDom.current).scrollTop(ht);
     }
 
     render() {
-        const { tips, showTips, tipsDiscalimer, tipsImg, tmpFlg} = this.props
+        const { tips, showTips, tipsDiscalimer, tipsImg, tmpFlg} = this.props;
         return <div className={style["tips"]}>
         <h1>
           <img src={tipsImg} />

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

@@ -251,8 +251,9 @@ class PushItems extends Component {
               </div>
             </div>
             {/*{chronicPushItems&&chronicPushItems.length>0?<ChronicInfo data={chronicPushItems}></ChronicInfo>:''}*/}
-            {<ChronicInfo></ChronicInfo>}
+            {chronicPushItems&&chronicPushItems.length>0?<ChronicInfo data={chronicPushItems}></ChronicInfo>:''}
             <TipsMsg
+              patDom={this.$cont}
              tmpFlg = {tmpFlg}
              tipsImg = {tipsImg}
               tips = {tips}

+ 1 - 1
src/containers/ChronicInfo.js

@@ -14,7 +14,7 @@ function mapStateToProps(state){
   const {pushMessage,assessResult} = state;
   return{
     chronicMagItem: state.diagnosticList.chronicMagItem,//慢病疾病
-    data:pushMessage.chronicPushItems,     //慢病右侧推送
+    //data:pushMessage.chronicPushItems,     //慢病右侧推送
     tableList: pushMessage.tableList,
     showList: pushMessage.showList,
     showHide: pushMessage.showHide,

+ 1 - 1
src/containers/CurrentIll.js

@@ -11,7 +11,7 @@ import {getModule} from '@store/async-actions/fetchModules.js';
 import {didPushParamChange} from '@utils/tools.js';
 
 
-function mapStateToProps(state) { console.log(111,state);
+function mapStateToProps(state) {
   const {homePage,currentIll,mainSuit,diagnosticList} = state;
     return {
         data:currentIll.data,//主诉模板

+ 1 - 1
src/containers/PushItemsContainer.js

@@ -15,7 +15,7 @@ function mapStateToProps(state) {
         clickDiag: diagnosticList.clickDiag,
         tableList: pushMessage.tableList,
         showList: pushMessage.showList,
-        //chronicPushItems: pushMessage.chronicPushItems,
+        chronicPushItems: pushMessage.chronicPushItems,
     }
 }
 

+ 13 - 5
src/store/actions/homePage.js

@@ -31,17 +31,25 @@ export const showDrop=(state,action)=>{
 export const confirmHide=(state,action)=>{
   let res = Object.assign({},state);
   let obj = res.showDrop||{};
+  //页面空白时不更新
+  if(Object.keys(res.showDrop).length==0){
+    return res;
+  }
   let temp = Object.assign({},obj);
   let keyArr = Object.keys(obj);
+  let flag = false;
   for(let i=0; i<keyArr.length; i++){
-    temp[JSON.parse(keyArr[i])] = false;
+    if(temp[keyArr[i]]){
+      flag = true;
+      temp[keyArr[i]] = false;
+    }
+  }
+  if(!flag){      //未修改值时不更新
+    return res;
   }
-  /*for(let i in obj){
-    temp[i] = false;
-  };*/
   res.showDrop = temp;
   res.commSymHide = true;
-  res.update=Math.random();
+  //res.update=Math.random();     //temp已是新对象,无需再update唤起更新
   return res;
 }
 

+ 2 - 0
src/store/actions/pushMessage.js

@@ -260,6 +260,8 @@ export const clearAllPushMessage = (state, action) => {
 	res.assay = [];
 	res.check = [];
 	res.chronicPushItems = [];//量表
+	res.formulaResult = {};   //量表计算结果
+	res.scaleInfo = {};			//量表选中项
 	res.drugList = []; //开单药品列表
 	return res;
 }

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

@@ -1,5 +1,5 @@
 import {SET_ASSESS_DATA,SET_INDEX_DATA,SET_SAVE_ASSESS_DATA,SET_INDEX_SUB_TYPE,ADD_ASSESS_ITEMS,
-  REMOVE_ASSESS_ITEMS,CLEAR_INDEX_DATA,SET_CHRONIC_CALCU_RESULT,ADD_WHOLE_SCALE_ITEMS,SET_CALCU_VALUES} from '@types/assessResult';
+  REMOVE_ASSESS_ITEMS,CLEAR_INDEX_DATA,SET_CHRONIC_CALCU_RESULT,ADD_WHOLE_SCALE_ITEMS,SET_CALCU_VALUES,CLEAR_ASSESS_RESULT_VALUE} from '@types/assessResult';
 import config from "@config";
 
 const init = {
@@ -46,6 +46,14 @@ export default (state=init,action)=>{
       res.indexData = {};
       res.indexTimeTypes = {};
       return res;
+    case CLEAR_ASSESS_RESULT_VALUE:
+      res.addedScaleIds = [];
+      res.calcuResult = {};
+      res.calcuValues = {};
+      res.wholeAssess = [];
+      res.wholeIndexs = {};
+      res.wholeResults = {};
+      return res;
     case SET_INDEX_SUB_TYPE:
       if(!index){
         return res;

+ 2 - 1
src/store/types/assessResult.js

@@ -7,4 +7,5 @@ export const REMOVE_ASSESS_ITEMS = 'REMOVE_ASSESS_ITEMS';  //整体评估删除
 export const CLEAR_INDEX_DATA = 'CLEAR_INDEX_DATA';     //删除图表数据
 export const SET_CHRONIC_CALCU_RESULT = 'SET_CHRONIC_CALCU_RESULT';   //保存评估中计算结果
 export const ADD_WHOLE_SCALE_ITEMS  = 'ADD_WHOLE_SCALE_ITEMS';    //从全部量表中添加的整体评估
-export const SET_CALCU_VALUES = 'SET_CALCU_VALUES';  //保存计算公式数据
+export const SET_CALCU_VALUES = 'SET_CALCU_VALUES';  //保存计算公式数据
+export const CLEAR_ASSESS_RESULT_VALUE = 'CLEAR_ASSESS_RESULT_VALUE';       //清空加入病例及指标推送的数据

+ 6 - 2
src/utils/tools.js

@@ -10,8 +10,8 @@ import {CLEAR_ALL_PUSH_MESSAGE, SET_TIPS} from '@store/types/pushMessage';
 import {ISREAD, SETREADDITEMS} from "../store/types/homePage";
 import {CLEAR_FIRST_MAIN_DIAG, CLEAR_ALL_TREAT} from "../store/types/treat";
 import {tabChange} from '@store/actions/tabTemplate';
+import {CLEAR_ASSESS_RESULT_VALUE} from '@types/assessResult';
 import config from '@config/index.js';
-import $ from 'jquery';
 import up from '@images/up.png';
 import down from '@images/down.png';
 
@@ -259,7 +259,11 @@ const pushAllDataList =(whichSign,action,reData,type) =>{           //回读清
         });
         store.dispatch({
           type: CLEAR_ALL_TREAT,
-        })
+        });
+        //清空已选的指标推送数据及填的值
+        store.dispatch({
+          type: CLEAR_ASSESS_RESULT_VALUE,
+        });
         storageLocal.remove('emrParam');
        // Notify.success('页面已清空')
     }else{