OperationContainer.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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} from '@store/async-actions/homePage';
  14. function mapStateToProps({print}) {
  15. return ({
  16. print
  17. });
  18. }
  19. function mapDispatchToProps(dispatch) {
  20. return {
  21. showPrintPreview: () => {
  22. dispatch({
  23. type: SHOW_PRINT_PREVIEW
  24. });
  25. },
  26. closePrintPreview: () => {
  27. dispatch({
  28. type: CLOSE_PRINT_PREVIEW
  29. });
  30. },
  31. showPreview: () => {
  32. dispatch({
  33. type: SHOW_PREVIEW
  34. });
  35. },
  36. closePreview: () => {
  37. dispatch({
  38. type: CLOSE_PREVIEW
  39. });
  40. },
  41. save: () => {
  42. dispatch(saveClickNum);
  43. dispatch(() => saveMessage())
  44. },
  45. clear: () => {
  46. clearMessages()
  47. },
  48. saveDataAll(val){
  49. dispatch(saveTemplateDetail(val))
  50. },
  51. diagShowTmp(bool){
  52. dispatch({
  53. type: DIAG_SHOW,
  54. data:bool
  55. });
  56. }
  57. };
  58. }
  59. const OperationComtainer = connect(
  60. mapStateToProps,
  61. mapDispatchToProps
  62. )(Operation);
  63. export default OperationComtainer;