DiagResultSearch.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import React from 'react';
  2. import { connect } from 'react-redux';
  3. import {
  4. SHOW_SEARCH,
  5. HIDE_SEARCH,
  6. SHOW_TCM_SEARCH,
  7. HIDE_TCM_SEARCH,
  8. GET_SEARCH_RESULT,
  9. SHOWNODATATEXT,
  10. } from '@store/types/diagnosticSearch';
  11. import { getSearchResult, getSearchList } from '@store/async-actions/diagnosticSearch';
  12. import DiagResultSearch from '@components/DiagResultSearch';
  13. function mapStateToProps(state) {
  14. return {
  15. show: state.diagnosticSearch.show,
  16. showTcm: state.diagnosticSearch.showTcm,
  17. showSym:state.diagnosticSearch.showSym,
  18. searchValue: state.diagnosticSearch.searchValue,
  19. searchResult: state.diagnosticSearch.searchResult,
  20. isShowNoDataInfo: state.diagnosticSearch.isShowNoDataInfo,
  21. };
  22. }
  23. function mapDispatchToProps(dispatch) {
  24. return {
  25. showSearch:()=>{
  26. dispatch({
  27. type: SHOW_SEARCH
  28. })
  29. },
  30. hideSearch:()=>{
  31. dispatch({
  32. type: HIDE_SEARCH
  33. })
  34. },
  35. showTcmSearch:()=>{
  36. dispatch({
  37. type: SHOW_TCM_SEARCH
  38. })
  39. },
  40. hideTcmSearch:()=>{
  41. dispatch({
  42. type: HIDE_TCM_SEARCH
  43. })
  44. },
  45. showSymSearch:(flag)=>{
  46. dispatch({
  47. type: 'SHOW_SYM_SEARCH',
  48. show:flag
  49. })
  50. },
  51. clearSearchResult: ()=>{
  52. dispatch({
  53. type: GET_SEARCH_RESULT,
  54. searchResult: []
  55. })
  56. },
  57. handleChangeValue: (val, isClear)=>{
  58. if(isClear === 'clear'||val=='') {
  59. dispatch({
  60. type: SHOWNODATATEXT,
  61. isShowNoDataInfo: false
  62. });
  63. }
  64. dispatch(getSearchList(val))
  65. }
  66. }
  67. }
  68. const DiagnosticSearchContainer = connect(
  69. mapStateToProps,
  70. mapDispatchToProps
  71. )(DiagResultSearch);
  72. export default DiagnosticSearchContainer