瀏覽代碼

文本模式其他史不受主诉为空限制,切换模式后其他史重新获取

zhouna 6 年之前
父節點
當前提交
b7259ea858

+ 2 - 2
src/common/components/Textarea/index.jsx

@@ -48,10 +48,10 @@ class Textarea extends Component {
       })
       return;
     }
-    if(boxMark=='3'&&!hasMain){
+    /*if(boxMark=='3'&&!hasMain){
       e.target.innerText = '';
       return;
-    }
+    }*/
     this.setState({
       inpText:text,
       overFlag:false

+ 7 - 5
src/components/OtherHistory/index.jsx

@@ -38,7 +38,8 @@ class OtherHistory extends Component{
     return list;
   }
   handleInput(e){     //主诉未填无法输入
-    if(!this.props.hasMain){
+    const {type,hasMain} = this.props;
+    if(+type===0&&!hasMain){
       e.target.innerText='';
     }
   }
@@ -46,14 +47,15 @@ class OtherHistory extends Component{
     //第一次聚焦其他史时,主诉有数据则获取最近一次其他史记录(没有的话显示初始模板),主诉无数据则显示提示;其他时间其他史模板数据不调接口
     const {hasMain,type,setInitData,data,saveText,changeEditClear} = this.props;
     const hasData = saveText.join("")||data.length>0;
-    if(hasData){
+    if(hasData){      //其他史已有数据不获取
       return;
     }
-    if(hasMain){
-      setInitData();
-    }else{
+    if(+type===0&&!hasMain){
       Notify.error("无法操作,请先输入主诉");
+      return;
     }
+    //智能模式有主诉或者文本模式获取最近历史
+    setInitData();
 
     //回读后容器框要不可编辑,否则自由文本标签onInput,onFocus事件失效(原因未知)
     /*if(data.length>0){

+ 4 - 0
src/containers/OtherHistory.js

@@ -7,6 +7,7 @@ import {getModule} from '@store/async-actions/fetchModules.js';
 import {billing} from '@store/async-actions/pushMessage';
 import {fullfillText} from '@common/js/func';
 import {didPushParamChange} from '@utils/tools.js';
+import {ISREAD} from "../store/types/homePage";
 
 function mapStateToProps(state){
   const {otherHistory,homePage,typeConfig,mainSuit} = state;
@@ -44,6 +45,9 @@ function mapDispatchToProps(dispatch,store){
           data:listObj.newArr,
           save:listObj.saveText
         });
+        dispatch({
+          type:ISREAD
+        })
       });
       //右侧推送
       setTimeout(function(){      //延迟待确定后的数据更新后推送,避免获取的参数还是旧的

+ 5 - 4
src/containers/TypeConfigContainer.js

@@ -3,7 +3,7 @@ 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 {pushAllDataList} from '@utils/tools';
-import {saveMode} from '@store/async-actions/fetchModules';
+import {saveMode,getOtherHisRecord} from '@store/async-actions/fetchModules';
 import config from "@config/index";
 import { initItemList } from '@store/async-actions/tabTemplate';
 import { allCheckedShow } from '@store/actions/tabTemplate';
@@ -29,13 +29,14 @@ function mapDispatchToProps(dispatch) {
       dispatch({type: CHANGE_TYPE, typeConfig})
     },
     confirmType: confirmType => {
-      //清空所有数据
-      pushAllDataList('','clear');
-      Notify.success("模式切换成功");
       //保存模式切换结果
       dispatch(saveMode(confirmType)).then((res)=>{
         if(res.data.code=='0'&&res.data.data){
+          pushAllDataList('','clear');
           dispatch({type: CONFIRM_TYPE, confirmType});
+          //清空所有数据
+          dispatch(getOtherHisRecord());          //获取其他史最近记录
+          Notify.success("模式切换成功");
           dispatch(initItemList(confirmType));
           dispatch(allCheckedShow(false))    //全选反选显示重置
         }else{

+ 6 - 4
src/store/async-actions/fetchModules.js

@@ -57,24 +57,26 @@ export const getOtherHisRecord = ()=>{
   return (dispatch,getStore)=>{
     const state = getStore();
     const {message} =state.patInfo;
+    const mode = state.typeConfig.typeConfig;
     const param = {
       hospitalCode:message.hospitalCode,
       patientCode:message.patientCode,
-      sign:state.typeConfig.typeConfig
+      sign:mode
     };
     json(api.getOtherHisRecord,param).then((res)=>{
       if(res.data.code=='0'){
         const data = res.data.data;
-        const obj = JSON.parse(data.dataJson);
+        const obj = JSON.parse(data.dataJson||'{}');
+        const objStr = JSON.parse(data.otherStr||'[]');
         let arr = [];
-        if(!obj||!obj.other||obj.other.length==0){        //无其他史历史记录用默认模板
+        if((!obj||!obj.other||obj.other.length==0)&&!objStr[0]){        //无其他史历史记录用默认模板
           //arr = state.homePage.initData.otherHis;
         }else{
           arr = obj.other;
           dispatch({
             type:SETOTHERHISTORY,
             data:arr,
-            save:JSON.parse(data.otherStr)
+            save:objStr
           });
         }
       }