import React, { Component } from 'react'; import style from './index.less'; import {ConfirmModal} from '@commonComp'; import Notify from '@commonComp/Notify'; import store from '@store'; import infoShow from '@common/images/info-show.png'; import infoMove from '@common/images/info-move.png'; import {getChronic} from '@store/async-actions/homePage.js'; import {storageLocal} from '@utils/tools'; import { getMRAnalyse } from '@store/async-actions/pushMessage'; class DiagnosticItem extends Component{ constructor(props){ super(props); this.state = { visible: false, hasEnterItem: false, hasEnterImg: false } this.addDiagodal = this.addDiagodal.bind(this); this.chooseDiagodal = this.chooseDiagodal.bind(this); this.confirm = this.confirm.bind(this); this.cancel = this.cancel.bind(this) this.close = this.close.bind(this) this.getTips = this.getTips.bind(this) } confirm() { this.props.setHighter&&this.props.setHighter(80) this.close(); const diagType = 1; this.addDiagodal(diagType) } cancel() { this.props.setHighter&&this.props.setHighter(80) this.close(); const diagType = 2; this.addDiagodal(diagType) } close(){ this.setState({ visible: false }) } chooseDiagodal(item) { const { diagnosticList,isTcm,tcmList,symList,showSym} = this.props; const list = isTcm?(showSym?symList:tcmList):diagnosticList; const tipName = isTcm?(showSym?'中医症候':'中医诊断'):'诊断'; for (let i = 0; i < list.length; i++) { if(list[i].name === item.name) { Notify.info('该'+tipName+'已存在'); return } } this.props.setHighter&&this.props.setHighter(80) const diagType = 1; this.addDiagodal(diagType) this.setState({ visible: true }) } getTips(item, e) { e.stopPropagation(); const {getTips } = this.props; getTips && getTips({id:item.id,type:7,name: item.name, position: 1}); } addDiagodal(diagType){ const {item,EMRScrollCont,isTcm,showSym,type,addDiagnostic, clearInput, hideSearch} = this.props; item.type = diagType; /*if(item.type == 2&&mode=='0') { //文本模式不走慢病。6.0慢病取消 isChronicMag(item); }*/ addDiagnostic&&addDiagnostic(item,isTcm,showSym); clearInput&&clearInput(); hideSearch&&hideSearch(); this.context.scrollArea&&this.context.scrollArea.refresh(); //document.getElementById("diagnosisResult").scrollIntoView(true) if(type == 'disSelect') { const scrollTop = document.getElementById("diagnosisResult").offsetTop setTimeout(() =>{ EMRScrollCont.scrollYTo(scrollTop); }) } store.dispatch(getMRAnalyse()) } handleMouseEnterDrug() { this.setState({ hasEnterItem: true, }) } handleMouseLeaveDrug() { this.setState({ hasEnterItem: false, }) } handleMouseEnterImg() { this.setState({ hasEnterImg: true }) } handleMouseLeaveImg() { this.setState({ hasEnterImg: false }) } render(){ const { visible,hasEnterItem,hasEnterImg } = this.state const { item, title, type } = this.props return ( {this.chooseDiagodal(item)}} >

{item.name}

{/* {type== 'disSelect' &&} */}
{/*
确定选择“{item.name}”为
*/}
) } } DiagnosticItem.contextTypes = { scrollArea: React.PropTypes.object }; export default DiagnosticItem;