InlineTag.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import React from 'react';
  2. import {connect} from 'react-redux';
  3. import {SETRADIO,CLEARSELECTED,CONFIRMSELECTED,SETOTHERINPUT} from '@types/otherHistory';
  4. import {SETMAININPUT} from '@types/mainSuit';
  5. import {SETCURRENTINPUT,CURRENT_TEXT_LABEL} from '@types/currentIll';
  6. import {SETCHECKINPUT} from "@types/checkBody";
  7. import InlineTag from "../common/components/InlineTag";
  8. import {getLabelIndex} from '@utils/tools.js';
  9. import {SET_SELECTED_AREA} from '@types/homePage';
  10. function mapStateToProps(state){
  11. return {
  12. mainSaveText:state.mainSuit.saveText,
  13. select_start:state.homePage.select_start,
  14. }
  15. }
  16. const tagInpActions = {
  17. 1:SETMAININPUT,
  18. 2:SETCURRENTINPUT,
  19. 3:SETOTHERINPUT,
  20. 4:SETCHECKINPUT
  21. };
  22. function mapDispatchToProps(dispatch,store){
  23. return {
  24. handleInput(params) {
  25. const type = params.ikey.substr(0,1); //当前所在的项目
  26. const {ikey,text,prefix,suffix} = params;
  27. const i = getLabelIndex(ikey);
  28. const inner = params.ikey.split("-")[2];
  29. dispatch({
  30. type:tagInpActions[+type],
  31. i,
  32. text,
  33. prefix,
  34. suffix,
  35. subIndex:inner
  36. })
  37. },
  38. setSelectArea(data){
  39. dispatch({
  40. type:SET_SELECTED_AREA,
  41. data
  42. })
  43. }
  44. }
  45. }
  46. const InlineTagCont = connect(mapStateToProps,mapDispatchToProps)(InlineTag);
  47. export default InlineTagCont;