InlineTag.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 {CHANGEOTHERTEXTLABEL} from "../store/types/otherHistory";
  10. import {CHANGECHECKTEXTLABEL} from "../store/types/checkBody";
  11. import {CHANGE_LABELVAL} from "../store/types/mainSuit";
  12. function mapStateToProps(state){
  13. return {}
  14. }
  15. const tagInpActions = {
  16. 1:SETMAININPUT,
  17. 2:SETCURRENTINPUT,
  18. 3:SETOTHERINPUT,
  19. 4:SETCHECKINPUT
  20. };
  21. function mapDispatchToProps(dispatch,store){
  22. return {
  23. handleInput(params) {
  24. const type = params.ikey.substr(0,1); //当前所在的项目
  25. const {ikey,text,prefix,suffix} = params;
  26. const i = getLabelIndex(ikey);
  27. const inner = params.ikey.split("-")[2];
  28. dispatch({
  29. type:tagInpActions[+type],
  30. i,
  31. text,
  32. prefix,
  33. suffix,
  34. subIndex:inner
  35. })
  36. },
  37. }
  38. }
  39. const InlineTagCont = connect(mapStateToProps,mapDispatchToProps)(InlineTag);
  40. export default InlineTagCont;