|
@@ -1,48 +1,67 @@
|
|
import React,{Component} from 'react';
|
|
import React,{Component} from 'react';
|
|
import style from './index.less';
|
|
import style from './index.less';
|
|
|
|
+import infoShow from '@common/images/info-show.png';
|
|
|
|
+import infoMove from '@common/images/info-move.png';
|
|
import $ from 'jquery';
|
|
import $ from 'jquery';
|
|
|
|
|
|
class HasInfoItem extends Component {
|
|
class HasInfoItem extends Component {
|
|
constructor(props) {
|
|
constructor(props) {
|
|
super(props)
|
|
super(props)
|
|
|
|
+ this.state = {
|
|
|
|
+ hasEnterItem: false,
|
|
|
|
+ hasEnterImg: false
|
|
|
|
+ }
|
|
}
|
|
}
|
|
handleMouseEnterDrug(){
|
|
handleMouseEnterDrug(){
|
|
-
|
|
|
|
|
|
+ this.setState({
|
|
|
|
+ hasEnterItem: true
|
|
|
|
+ })
|
|
}
|
|
}
|
|
handleMouseLeaveDrug(){
|
|
handleMouseLeaveDrug(){
|
|
-
|
|
|
|
|
|
+ this.setState({
|
|
|
|
+ hasEnterItem: false
|
|
|
|
+ })
|
|
}
|
|
}
|
|
handleMouseEnterImg(){
|
|
handleMouseEnterImg(){
|
|
-
|
|
|
|
|
|
+ this.setState({
|
|
|
|
+ hasEnterImg: true
|
|
|
|
+ })
|
|
}
|
|
}
|
|
- onMouseLeave(){
|
|
|
|
-
|
|
|
|
|
|
+ handleMouseLeaveImg(){
|
|
|
|
+ this.setState({
|
|
|
|
+ hasEnterImg: false
|
|
|
|
+ })
|
|
}
|
|
}
|
|
- setDrugInfo(){
|
|
|
|
-
|
|
|
|
|
|
+ setDrugInfo(item){
|
|
|
|
+ const{ setDrugInfo } = this.props
|
|
|
|
+ setDrugInfo && setDrugInfo(item)
|
|
|
|
+ }
|
|
|
|
+ handleSelect(){
|
|
|
|
+ const{ handleSelect, position } = this.props
|
|
|
|
+ handleSelect && handleSelect(position)
|
|
}
|
|
}
|
|
|
|
|
|
render(){
|
|
render(){
|
|
const { item } = this.props
|
|
const { item } = this.props
|
|
- return (<span onMouseEnter={this.handleMouseEnterDrug.bind(this,item)}
|
|
|
|
- onMouseLeave = {this.handleMouseLeaveDrug}
|
|
|
|
- className={style['drug-name-wrapper']}
|
|
|
|
- >
|
|
|
|
- <span className={style['drug-name']}
|
|
|
|
|
|
+ const { hasEnterItem, hasEnterImg} = this.state
|
|
|
|
+ return (<span className={style['drug-name-wrapper']} >
|
|
|
|
+ <span className={`${style['drug-name']} ${item.forbidden === '2' ? style['disabled']: item.selected ? style['selected'] : ''}`}
|
|
// onDoubleClick={() =>{this.setDrugInfo(it);showDrugInfo();}} //药品说明双击显示(现在为点击图标显示)
|
|
// onDoubleClick={() =>{this.setDrugInfo(it);showDrugInfo();}} //药品说明双击显示(现在为点击图标显示)
|
|
- onClick={()=>{item.forbidden === '2' ? '' : this.handleSelect(index2,index3)}}
|
|
|
|
- style={item.forbidden === '2' ? {opacity: '0.3', filter:'alpha(opacity=30)',filter:'progid:DXImageTransform.Microsoft.Alpha(opacity=30)'} : item.selected ? {color: '#3B9ED0', borderBottom: '1px solid #3B9ED0'}:''}
|
|
|
|
|
|
+ onClick={()=>{item.forbidden === '2' ? '' : this.handleSelect()}}
|
|
|
|
+ onMouseEnter={this.handleMouseEnterDrug.bind(this)}
|
|
|
|
+ onMouseLeave = {this.handleMouseLeaveDrug.bind(this)}
|
|
>
|
|
>
|
|
{item.medicitionName}
|
|
{item.medicitionName}
|
|
|
|
+ {<img className={`${style['info-img']} ${hasEnterItem?style['show-content']:style['hide-content']}`}
|
|
|
|
+ title='点击i图标可查看详细说明'
|
|
|
|
+ src={hasEnterImg?infoMove:infoShow}
|
|
|
|
+ onMouseEnter={this.handleMouseEnterImg.bind(this)}
|
|
|
|
+ onMouseLeave = {this.handleMouseLeaveImg.bind(this)}
|
|
|
|
+ onClick={this.setDrugInfo.bind(this,item)}/>}
|
|
</span>
|
|
</span>
|
|
- {/* {<img className={style['info-img']}
|
|
|
|
- title='点击i图标可查看详细说明'
|
|
|
|
- style ={currentIndex === index2 ? (index3 === currentImg ? {display: "inline-block"} : {display: "none"}) : {display: "none"}}
|
|
|
|
- src={currentIndex === index2 ? (index3 === currentImg ? (hasEnterImg ? info3 : info2) : info2): info2}
|
|
|
|
- onMouseEnter={this.handleMouseEnterImg.bind(this, index3, index2)}
|
|
|
|
- onMouseLeave = {this.handleMouseLeaveImg}
|
|
|
|
- onClick={this.setDrugInfo.bind(this,item)}/>} */}
|
|
|
|
- {item.forbidden === '1' ? <span className={style['info-flag']} style={{border: '1px solid #F4C051', background: '#F4C051',marginLeft: '5px'}}>慎用</span>: item.forbidden === '2' ? <span className={style['info-flag']} style={{opacity: '0.3',filter:'alpha(opacity=30)',filter:'progid:DXImageTransform.Microsoft.Alpha(opacity=30)',border: '1px solid #000',marginLeft: '5px'}}>禁用</span> : ''}
|
|
|
|
|
|
+ {(item.forbidden === '1'||item.forbidden === '2') && <span className={`${style['info-flag']} ${item.forbidden === '1' ? style['cautious']:item.forbidden === '2'?style['disabled']:''}`}>
|
|
|
|
+ {item.forbidden === '1' ? "慎用":item.forbidden === '2'? "禁用":""}
|
|
|
|
+ </span>}
|
|
{/*<span style={item.forbidden === '2' ? {opacity: '0.3', filter:'alpha(opacity=30)',filter:'progid:DXImageTransform.Microsoft.Alpha(opacity=30)'} : ''}> 使用率{item.rate}</span>*/}
|
|
{/*<span style={item.forbidden === '2' ? {opacity: '0.3', filter:'alpha(opacity=30)',filter:'progid:DXImageTransform.Microsoft.Alpha(opacity=30)'} : ''}> 使用率{item.rate}</span>*/}
|
|
|
|
|
|
</span>)
|
|
</span>)
|