123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- // 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;
|