Bläddra i källkod

通过ID搜索药品说明书(添加数据时查看药品说明书用)

zhangxc 6 år sedan
förälder
incheckning
3b8fdf425f
1 ändrade filer med 16 tillägg och 1 borttagningar
  1. 16 1
      src/components/Treat/DrugTreat/index.jsx

+ 16 - 1
src/components/Treat/DrugTreat/index.jsx

@@ -10,7 +10,7 @@ class DrugTreat extends Component {
     constructor(props) {
         super(props);
         this.state = {
-            currentImg: -1
+            currentImg: -1,
         }
         this.handleSelect = this.handleSelect.bind(this);
         this.setOtherRecommend = this.setOtherRecommend.bind(this);
@@ -43,6 +43,19 @@ class DrugTreat extends Component {
         const { setDrugInfo } = this.props;
         setDrugInfo && setDrugInfo(item);
     }
+    //搜索药品说明书(查看数据用)
+    handleInputDrug(e) {
+        this.setState({
+            drugId: e.target.value
+         })
+    }
+    //搜索药品说明书(查看数据用)
+    searchDrug() {
+        const { showDrugInfo } = this.props
+        this.setDrugInfo({id: this.state.drugId})
+        showDrugInfo && showDrugInfo();
+
+    }
     showTreatDesc() {
         $('#treatDescBox').css({'display': 'block'});
         $('#treatWrapper').animate({'margin-left': '-470px'}, 300);
@@ -58,6 +71,8 @@ class DrugTreat extends Component {
         return(
             treatment && treatment.length > 0 && <div className={style['drug-box']}>
                 <h3 className={style['drug-title']}><img className={style['drug-icon']} src={drugIcon}/> 常用药物治疗</h3>
+                {/* 查看药物说明书 */}
+                <div> <input onInput={this.handleInputDrug.bind(this)} style={{border:'1px solid #000'}} type="text"/><button onClick = {this.searchDrug.bind(this)}>搜索药品说明</button></div>
                 {treatment.map((item, index) => {
                     return(<div className={style['drug-content']}>
                         <div  className={style['drug-name-box']}>