import React, { Component } from 'react'; import style from './index.less'; import {ConfirmModal} from '@commonComp'; import Notify from '@commonComp/Notify'; import {getChronic} from '@store/async-actions/homePage.js'; import {storageLocal} from '@utils/tools'; class DiagnosticItem extends Component{ constructor(props){ super(props); this.state = { visible: 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) } confirm() { this.close(); const diagType = 1; this.addDiagodal(diagType) } cancel() { this.close(); const diagType = 2; this.addDiagodal(diagType) } close(){ this.setState({ visible: false }) } chooseDiagodal(item) { const { diagnosticList,getTips } = this.props; // getTips && getTips(item); getTips && getTips({id:item.id,type:7}); for (let i = 0; i < diagnosticList.length; i++) { if(diagnosticList[i].id === item.id && diagnosticList[i].name === item.name) { Notify.info('该诊断已存在'); return } } this.setState({ visible: true }) } addDiagodal(diagType){ const {item, isChronicMag,mode} = this.props; item.type = diagType; // setTimeout(()=>{ // this.setState({ // visible: false, // },()=>{ const { diagnosticList, addDiagnostic, clearInput, hideSearch } = this.props; // for (let i = 0; i < diagnosticList.length; i++) { // if(diagnosticList[i].id === item.id && diagnosticList[i].name === item.name) { // Notify.info('该诊断已存在'); // return // } // } if(item.type == 2&&mode==0) { isChronicMag(item); } // 从缓存取慢病列表 // let chronicList = JSON.parse(storageLocal.get('chronic')); // if(!chronicList){ // getChronic(); // chronicList = JSON.parse(storageLocal.get('chronic')); // } // console.log(999,chronicList) // for(let i=0; i {this.chooseDiagodal(item)}}> {item.name} {item.showType === 2 || item.showType === 3 ? '('+ item.retrievalName+')': ''}
确定选择“{item.name}”为
) } } export default DiagnosticItem;