123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- import React from "react";
- import {connect} from "react-redux";
- import Operation from "../components/Operation";
- import {
- SHOW_PRINT_PREVIEW,
- CLOSE_PRINT_PREVIEW,
- SHOW_PREVIEW,
- CLOSE_PREVIEW,
- DIAG_SHOW
- } from "../store/types/print";
- import {saveMessage,clearMessages} from "../store/async-actions/print";
- import {saveTemplateDetail,getDepartments,saveAdminTemplateDetail } from '@store/async-actions/tabTemplate';
- import {getDptLis} from '@store/actions/tabTemplate';
- import {saveClickNum,getInitModules} from '@store/async-actions/homePage';
- import {getOtherHisRecord} from '@store/async-actions/fetchModules';
- import {RECOVER_TAG_MAIN} from '@store/types/mainSuit';
- import {RECOVER_TAG_CURRENT} from '@store/types/currentIll';
- import {RECOVER_TAG_OTHER} from '@store/types/otherHistory';
- import {RECOVER_TAG_CHECK} from '@store/types/checkBody';
- import {Notify} from '@commonComp';
- import {didPushParamChange} from '@utils/tools.js';
- import {billing} from '@store/async-actions/pushMessage';
- import {ISREAD} from '@store/types/homePage';
- // function mapStateToProps({print}) {
- function mapStateToProps(state) {
- const {print,homePage} = state;
- return ({
- print,
- winWidth:homePage.windowWidth,
- admin:homePage.admin,
- chronicMagItem: state.diagnosticList.chronicMagItem,//慢病疾病
- chronicDesease:state.mainSuit.chronicDesease,//主诉存的慢病
- departLis:state.tabTemplate.departLis,
- });
- }
- function mapDispatchToProps(dispatch) {
- return {
- handleClearValue:()=> {
- dispatch(dispatch(getDptLis([])))
- },
- handleChangeValue:(val)=> {
- val&&dispatch(getDepartments(val))
- },
- showPrintPreview: () => {
- dispatch({
- type: SHOW_PRINT_PREVIEW
- });
- },
- closePrintPreview: () => {
- dispatch({
- type: CLOSE_PRINT_PREVIEW
- });
- },
- showPreview: () => {
- dispatch({
- type: SHOW_PREVIEW
- });
- },
- closePreview: () => {
- dispatch({
- type: CLOSE_PREVIEW
- });
- },
- save: () => {
- dispatch(saveClickNum);
- dispatch(() => saveMessage())
- },
- clear: (flag) => {
- clearMessages();
- dispatch(getOtherHisRecord()); //清除后重新获取其他史记录
- // 清除时如果是慢病模板则重新获取模板
- if(flag){
- dispatch(getInitModules);
- }
- },
- saveDataAlls(val,sex,id){
- dispatch(saveAdminTemplateDetail(val,sex,id))
- },
- saveDataAll(val,sex){
- dispatch(saveTemplateDetail(val,sex))
- },
- diagShowTmp(bool){
- dispatch({
- type: DIAG_SHOW,
- data:bool
- });
- },
- cancelDelTag(){
- const maps = {
- '1':RECOVER_TAG_MAIN,
- '2':RECOVER_TAG_CURRENT,
- '3':RECOVER_TAG_OTHER,
- '4':RECOVER_TAG_CHECK
- };
- const deledTags = localStorage.getItem('deletedTags')?JSON.parse(localStorage.getItem('deletedTags')):[];
- if(deledTags.length===0){
- Notify.info('暂无标签可还原');
- return ;
- }
- const arr = deledTags[0].delIndex.split("-");
- const item = deledTags[0];
- dispatch({
- type:maps[arr[0]],
- data:item.tagType?item:item.tags,
- index:arr[1]
- });
- dispatch({
- type:ISREAD
- });
- //删除文字选中状态
- window.getSelection().empty();
- //右侧推送
- setTimeout(function(){ //延迟待确定后的数据更新后推送,避免获取的参数还是旧的
- if(didPushParamChange()){ //操作后内容有变化才推送
- dispatch(billing());
- }
- },200);
- }
- };
- }
- const OperationComtainer = connect(
- mapStateToProps,
- mapDispatchToProps
- )(Operation);
- export default OperationComtainer;
|