CheckBody.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import {connect} from 'react-redux';
  2. import CheckBody from '@components/CheckBody';
  3. import {getModule,getInitData,pregetCheckbodyData} from '@store/async-actions/fetchModules.js';
  4. import {HIDE,RESET,SETDROPSHOW,ISREAD,MODI_LOADING} from '@store/types/homePage.js';
  5. import {SELECTSEARCHDATA,REPUSH_CHECK_LABELS} from "@store/types/checkBody";
  6. import {billing} from '@store/async-actions/pushMessage';
  7. import {didPushParamChange,filterDataArr} from '@utils/tools.js';
  8. function mapStateToProps(state){
  9. const {homePage,mainSuit,checkBody} = state;
  10. const hasMain = filterDataArr(mainSuit.saveText);//||mainSuit.data.length;
  11. return {
  12. data:checkBody.data,
  13. defaultShowAll:checkBody.showAll,
  14. isEmpty:checkBody.isEmpty,
  15. update:checkBody.update, //用于触发更新
  16. showArr:homePage.showDrop,
  17. totalHide:homePage.totalHide,
  18. saveText:checkBody.saveText,
  19. searchData:checkBody.searchData, //延迟搜索结果
  20. hasMain,//主诉选中的数据
  21. focusTextIndex:checkBody.focusIndex, //聚焦的自由文本标签index
  22. span:checkBody.span,
  23. searchInEnd:checkBody.searchInEnd, //是否在搜索末尾插入结果
  24. importLabel:checkBody.importLabel, //需高亮的标签id
  25. typeConfig: state.typeConfig, //bug2764
  26. }
  27. }
  28. function mapDispatchToProps(dispatch){
  29. return {
  30. getInit(){
  31. //dispatch({type:MODI_LOADING,flag:true});
  32. dispatch(getInitData());
  33. },
  34. fetchModules(param){
  35. const {id,name,index,span,searchInEnd} = param;
  36. getModule(id).then((res)=>{
  37. if(res.data.code=='0'){
  38. dispatch({
  39. type:SELECTSEARCHDATA,
  40. index,
  41. name,
  42. data: res.data.data,
  43. span,
  44. isReplace:false,
  45. searchInEnd
  46. });
  47. dispatch({
  48. type:ISREAD
  49. });
  50. //调右侧推送
  51. if(didPushParamChange()) {
  52. dispatch(billing());
  53. }
  54. }
  55. });
  56. },
  57. rePush(){console.log(222)
  58. dispatch(pregetCheckbodyData(false,true));
  59. }
  60. }
  61. }
  62. const CheckBodyCont = connect(mapStateToProps,mapDispatchToProps)(CheckBody);
  63. export default CheckBodyCont;