import React, { Component } from 'react'; import style from './index.less'; import del_icon from './img/delete.png' import diagUp from './img/diagUp.png' import diagDown from './img/diagDown.png' import {ConfirmModal, Message} from '@commonComp'; import Notify from '@commonComp/Notify'; import Treat from '@containers/Treat' class DiagnosticList extends Component { constructor(props) { super(props); this.state = { visible: false, delItem: {}, treatTitle: '' } this.deleteItem = this.deleteItem.bind(this); this.cancel = this.cancel.bind(this); this.close = this.close.bind(this); this.showTreat = this.showTreat.bind(this); this.handleClickDiag = this.handleClickDiag.bind(this); } componentWillReceiveProps(nextprops) { if (this.props.diagnosticStr != nextprops.diagnosticStr) { this.props.getBilling(); } } upDiagnostic(index) { const { upDiagnostic } = this.props; upDiagnostic && upDiagnostic(index) } downDiagnostic(index) { const { downDiagnostic } = this.props; downDiagnostic && downDiagnostic(index) } deleteItem() { const { delItem } = this.state; const { delDiagnostic } = this.props; delDiagnostic && delDiagnostic(delItem); this.setState({ visible: false, }) Notify.success('删除成功') } cancel() { this.setState({ visible: false }) } close() { this.setState({ visible: false }) } handleDeleteItem(item) { this.setState({ visible: true, delItem: item, }) } showTreat(item, index) { item.treatIndex = index const { showTreat, getTreatResult } = this.props; getTreatResult && getTreatResult(item); showTreat && showTreat(); this.setState({ treatTitle: item.name }) } handleClickDiag(item) { const { getTips } = this.props; getTips && getTips(item); } render(){ const { list, treatment } = this.props const { visible, treatTitle } = this.state const lastIndex = list.length -1; return(
{list && (list.length > 0) && list.map((item, index) => { const hasTreat = item.treat && (item.treat.commonTreatment.content || item.treat.surgeryTreatment.content || item.treat.treatment.length>0) return (
{index === 0 ? '' : {this.upDiagnostic(index)}}>} {list.length === 1 ? '' : index !== 0 ? '' : {this.downDiagnostic(index)}} className={style['diag-down']}>} {index === 0 ? '主' : index+1} {this.handleClickDiag(item)}}>{item.name} {item.type === 1 ? 初诊 : 复诊} {hasTreat && this.showTreat(item, index)}}> 治疗方案 {this.handleDeleteItem(item)}}/>
) })} {treatment&&}
是否删除该诊断?
) } } export default DiagnosticList;