Bladeren bron

模板列表获取时机

Luolei 6 jaren geleden
bovenliggende
commit
a03cece3ea
2 gewijzigde bestanden met toevoegingen van 4 en 5 verwijderingen
  1. 0 5
      src/components/Operation/index.jsx
  2. 4 0
      src/store/async-actions/homePage.js

+ 0 - 5
src/components/Operation/index.jsx

@@ -7,7 +7,6 @@ import PrintPreviewContainer from '@containers/PrintPreviewContainer';
 import PreviewContainer from '@containers/PreviewContainer';
 import { ConfirmModal, Notify } from '@commonComp';
 import {getAllDataList,getAllDataStringList} from '@utils/tools';
-import { initItemList } from '@store/async-actions/tabTemplate';
 import store from '@store';
 
 
@@ -152,11 +151,7 @@ class Operation extends Component {
   }
   saveHis(type) {
     const { diagShowTmp } = this.props;
-    let baseList = store.getState();
     let flg = this.getAllData();
-    if(baseList.tabTemplate.items.length == 0){
-      store.dispatch(initItemList());         //获取模板列表
-    }
     if(flg){
       this.setState({
         title: '',

+ 4 - 0
src/store/async-actions/homePage.js

@@ -7,6 +7,7 @@ import store from '@store';
 import {fullfillText} from '@common/js/func';
 import {getOtherHisRecord,getInitData} from '@store/async-actions/fetchModules.js';
 import {initHistoryDetails} from '@store/async-actions/patInfo';
+import { initItemList } from '@store/async-actions/tabTemplate';
 
 const api = {
   getModules:'/api/icss/moduleInfo/getAll',
@@ -57,6 +58,9 @@ export const getInitModules= (dispatch,getStore)=>{
           saveEmpty:initSaveText.currentEmpty,
         });
         dispatch(getOtherHisRecord());          //获取其他史最近记录
+        if(state.tabTemplate.items.length == 0){
+          dispatch(initItemList());         //模板列表没有就获取模板列表
+        }
         initHis(dispatch)
       }else{
         initHis(dispatch)