// import React from "react"; import {connect} from "react-redux"; import Multiple from "@components/Multiple"; import {RESET,SETDROPSHOW,HIDEDROP,CLICKCOUNT,ISREAD} from '@store/types/homePage.js'; import {CURRENT_MUL,CURRENT_TEXT_LABEL} from '@types/currentIll'; import {MAINSUIT_MUL,CHANGE_LABELVAL} from '@types/mainSuit'; import {OTHERHIS_MUL,CHANGEOTHERTEXTLABEL} from '@types/otherHistory'; import {CHECKBODY_MUL,CHANGECHECKTEXTLABEL} from '@types/checkBody'; import {getLabelIndex,fullfillText,getIds} from '@common/js/func.js'; import {filterArr,filterDataArr} from '@utils/tools.js'; import config from '@config/index.js'; import {Notify} from '@commonComp'; function handleMainSuit(dispatch,params){ const {ikey,seleData,seleId,value,mainSaveText} = params; //字数限制 let mainText = filterDataArr(mainSaveText); let lengths = value?mainText.length - value.length + seleData.length:mainText.length + seleData.length; if(lengths > config.limited){ Notify.info(config.limitText); return } const index = getLabelIndex(ikey); dispatch({ type:MAINSUIT_MUL, data:{seleData,seleId,ikey:index} }) } function handleCurrent(dispatch,params){ const {ikey,seleData,seleId} = params; const index = getLabelIndex(ikey); dispatch({ type:CURRENT_MUL, data:{seleData,seleId,ikey:index,fullIkey:ikey} }) } function handleOtherHis(dispatch,params){ const {ikey,seleData,seleId} = params; const index = getLabelIndex(ikey); dispatch({ type:OTHERHIS_MUL, data:{seleData,seleId,ikey:index,fullIkey:ikey} }) } function handleCheckBody(dispatch,params){ const {ikey,seleData,seleId} = params; const index = getLabelIndex(ikey); dispatch({ type:CHECKBODY_MUL, data:{seleData,seleId,ikey:index,fullIkey:ikey} }) } function handleDiff(dispatch,params){ const {type} = params; switch(+type){ case 1: handleMainSuit(dispatch,params); break; case 2: handleCurrent(dispatch,params); break; case 3: handleOtherHis(dispatch,params); break; case 4: handleCheckBody(dispatch,params); break; default: } } /*****************双击标签改变值**********************/ function changeMainSuit(dispatch,obj){ const {ikey,changeVal} = obj; const index = getLabelIndex(ikey); dispatch({ type:CHANGE_LABELVAL, data:{changeVal,ikey:index} }) } function changeCurrent(dispatch,obj){ const {ikey,changeVal} = obj; const index = getLabelIndex(ikey); dispatch({ type:CURRENT_TEXT_LABEL, data:{changeVal,ikey:index} }) } //其他史 function changeOtherHis(dispatch,obj){ const {ikey,changeVal} = obj; const index = getLabelIndex(ikey); dispatch({ type:CHANGEOTHERTEXTLABEL, data:{changeVal,ikey:index} }) } //查体 function changeCheckBody(dispatch,obj){ const {ikey,changeVal} = obj; const index = getLabelIndex(ikey); dispatch({ type:CHANGECHECKTEXTLABEL, data:{changeVal,ikey:index} }) } function handleLabel(dispatch,obj){ const {type} = obj; switch (+type) { case 1: changeMainSuit(dispatch,obj); break; case 2: changeCurrent(dispatch,obj); break; case 3: changeOtherHis(dispatch,obj); break; case 4: changeCheckBody(dispatch,obj); break; default: } } function mapStateToProps(state){ return{ mainSaveText:state.mainSuit.saveText, } } function mapDispatchToProps(dispatch){ return{ handleShow(obj){ dispatch({ type:CLICKCOUNT, data:obj, clickType:'单击', num:1 }); dispatch({ type:SETDROPSHOW, data:obj }); dispatch({ type: RESET }); }, handleHide(){ dispatch({ type:HIDEDROP }) }, handleDbclick(obj){//双击统计 dispatch({ type:CLICKCOUNT, data:obj, clickType:'双击', num:1 }); }, handleLabelChange(obj){//标签内输入 handleLabel(dispatch,obj); }, handleConfirm(params){ handleDiff(dispatch,params); } } } const MultipleContainer = connect(mapStateToProps,mapDispatchToProps)(Multiple); export default MultipleContainer;