OperationContainer.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. // function mapStateToProps({print}) {
  15. function mapStateToProps(state) {
  16. const {print,homePage} = state;
  17. return ({
  18. print,
  19. winWidth:homePage.windowWidth,
  20. chronicMagItem: state.diagnosticList.chronicMagItem,//慢病疾病
  21. chronicDesease:state.mainSuit.chronicDesease,//主诉存的慢病
  22. });
  23. }
  24. function mapDispatchToProps(dispatch) {
  25. return {
  26. showPrintPreview: () => {
  27. dispatch({
  28. type: SHOW_PRINT_PREVIEW
  29. });
  30. },
  31. closePrintPreview: () => {
  32. dispatch({
  33. type: CLOSE_PRINT_PREVIEW
  34. });
  35. },
  36. showPreview: () => {
  37. dispatch({
  38. type: SHOW_PREVIEW
  39. });
  40. },
  41. closePreview: () => {
  42. dispatch({
  43. type: CLOSE_PREVIEW
  44. });
  45. },
  46. save: () => {
  47. dispatch(saveClickNum);
  48. dispatch(() => saveMessage())
  49. },
  50. clear: (flag) => {
  51. clearMessages();
  52. // 清除时如果是慢病模板则重新获取模板
  53. if(flag){
  54. dispatch(getInitModules);
  55. }
  56. },
  57. saveDataAll(val,sex){
  58. dispatch(saveTemplateDetail(val,sex))
  59. },
  60. diagShowTmp(bool){
  61. dispatch({
  62. type: DIAG_SHOW,
  63. data:bool
  64. });
  65. }
  66. };
  67. }
  68. const OperationComtainer = connect(
  69. mapStateToProps,
  70. mapDispatchToProps
  71. )(Operation);
  72. export default OperationComtainer;