OperationContainer.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import React from "react";
  2. import {connect} from "react-redux";
  3. import Operation from "../components/Operation";
  4. import {
  5. SHOW_PRINT_PREVIEW,
  6. CLOSE_PRINT_PREVIEW,
  7. SHOW_PREVIEW,
  8. CLOSE_PREVIEW,
  9. DIAG_SHOW
  10. } from "../store/types/print";
  11. import {saveMessage,clearMessages} from "../store/async-actions/print";
  12. import {saveTemplateDetail} from '@store/async-actions/tabTemplate';
  13. import {saveClickNum,getInitModules} from '@store/async-actions/homePage';
  14. import {getOtherHisRecord} from '@store/async-actions/fetchModules';
  15. // function mapStateToProps({print}) {
  16. function mapStateToProps(state) {
  17. const {print,homePage} = state;
  18. return ({
  19. print,
  20. winWidth:homePage.windowWidth,
  21. chronicMagItem: state.diagnosticList.chronicMagItem,//慢病疾病
  22. chronicDesease:state.mainSuit.chronicDesease,//主诉存的慢病
  23. });
  24. }
  25. function mapDispatchToProps(dispatch) {
  26. return {
  27. showPrintPreview: () => {
  28. dispatch({
  29. type: SHOW_PRINT_PREVIEW
  30. });
  31. },
  32. closePrintPreview: () => {
  33. dispatch({
  34. type: CLOSE_PRINT_PREVIEW
  35. });
  36. },
  37. showPreview: () => {
  38. dispatch({
  39. type: SHOW_PREVIEW
  40. });
  41. },
  42. closePreview: () => {
  43. dispatch({
  44. type: CLOSE_PREVIEW
  45. });
  46. },
  47. save: () => {
  48. dispatch(saveClickNum);
  49. dispatch(() => saveMessage())
  50. },
  51. clear: (flag) => {
  52. clearMessages();
  53. dispatch(getOtherHisRecord()); //清除后重新获取其他史记录
  54. // 清除时如果是慢病模板则重新获取模板
  55. if(flag){
  56. dispatch(getInitModules);
  57. }
  58. },
  59. saveDataAll(val,sex){
  60. dispatch(saveTemplateDetail(val,sex))
  61. },
  62. diagShowTmp(bool){
  63. dispatch({
  64. type: DIAG_SHOW,
  65. data:bool
  66. });
  67. }
  68. };
  69. }
  70. const OperationComtainer = connect(
  71. mapStateToProps,
  72. mapDispatchToProps
  73. )(Operation);
  74. export default OperationComtainer;