Browse Source

Merge branch 'dev5.3.3' into dev/new1

zhangxc 5 năm trước cách đây
mục cha
commit
666144aeec

+ 53 - 8
src/components/PushItems/RecommendInspect/index.jsx

@@ -2,14 +2,19 @@ import React, {Component} from 'react';
 import style from './index.less'
 import showImg from "@common/images/show.png";
 import hideImg from "@common/images/close.png";
+import infoShow from '@common/images/info-show.png';
+import infoMove from '@common/images/info-move.png';
 
 
 class RecommendInspect extends Component {
     constructor(props) {
         super(props)
         this.state = {
-            showAll: false
+          showAll: false,
+          hasEnterItem: -1,
+          hasEnterImg: false
         }
+       
         this.renderItem = this.renderItem.bind(this)
     }
     changeShowFlag() {
@@ -17,9 +22,15 @@ class RecommendInspect extends Component {
         showAll: !this.state.showAll
       })
     }
+    getTips(item) {
+      const { getInfomation, type } = this.props
+      const name = type === 12 ? item.uniqueName :item.name
+      getInfomation && getInfomation({ name: name || '', type: type, position: 1 })
+    }
     
-    renderItem(item) {
-      const { changeFlag } = this.props
+    renderItem(item, index) {
+      const { changeFlag,getInfomation } = this.props
+      const { hasEnterItem,hasEnterImg  } = this.state
       return <span className={style['itemLabelBox']} title={item.name}>
           <input
             id={item.id + item.name}
@@ -27,15 +38,49 @@ class RecommendInspect extends Component {
             type="checkbox"
             checked={item.checked}
           />
-          <label  for={item.id + item.name}>{item.name}</label>
+          <span className={style['itemLabelNameBox']}
+              onMouseEnter={this.handleMouseEnterDrug.bind(this , index)}
+              onMouseLeave = {this.handleMouseLeaveDrug.bind(this, index)}
+          >
+            <label className={style['itemLabel']}  for={item.id + item.name}>{item.name}</label>
+            <img 
+              className={style['info-img']} 
+              title='点击i图标可查看详细说明'
+              style ={hasEnterItem ===index  ? {display: "inline-block"} : {display: "none"}}
+              src={hasEnterImg ? infoMove : infoShow} 
+              onMouseEnter={this.handleMouseEnterImg.bind(this)}
+              onMouseLeave = {this.handleMouseLeaveImg.bind(this)}
+              onClick={this.getTips.bind(this,item)}
+             />
+          </span>
       </span>
     }
+    handleMouseEnterDrug(index) {
+      this.setState({
+          hasEnterItem: index, 
+      })
+    }
+    handleMouseLeaveDrug() {
+      this.setState({
+          hasEnterItem: -1, 
+      })
+    }
+    handleMouseEnterImg() {
+      this.setState({
+        hasEnterImg: true
+      })
+    }
+    handleMouseLeaveImg() {
+      this.setState({
+        hasEnterImg: false
+      })
+    }
 
     render() {
       const { title,list, changeFlag, border } = this.props
       const { showAll } = this.state
-      const listAll = list.map(item => {
-          return this.renderItem(item)
+      const listAll = list.map((item,index) => {
+          return this.renderItem(item,index)
       });
       let firstLineNum = 0;   //第一行字数
       let secondLineNum = 0;      //第二行字数
@@ -53,11 +98,11 @@ class RecommendInspect extends Component {
           if(secondLineNum > 20) {
             return;
           } else {
-            return this.renderItem(item)
+            return this.renderItem(item, index)
           }
         } else {
 
-          return this.renderItem(item)
+          return this.renderItem(item, index)
         }
       });
 

+ 69 - 54
src/components/PushItems/RecommendInspect/index.less

@@ -2,57 +2,72 @@
 
     
         
-        .inspectItem{
-          padding: 10px 0px 4px 0px;
-          overflow: hidden;
-          .title{
-            float: left;
-            height: 26px;
-            line-height: 26px;
-            padding: 0px 0px 0px 0px ;
-          }
-          .content{
-            float: left;
-            width: 349px;
-            line-height: 26px;
-            padding: 0px 0px 0px 0px;
-            span{
-              .ellipsis;
-              font-size: 14px;
-              line-height: 14px;
-              display: inline-block;
-              margin: 6px;
-              max-width: 280px;
-              cursor: pointer;
-              input[type='checkbox']{
-                float: left;
-                width: 14px;
-                height: 14px;
-                margin-right: 2px;
-                background-color: #fff;
-                -webkit-appearance:none;
-                border: 1px solid #c9c9c9;
-                border-radius: 2px;
-                outline: none;
-                cursor: pointer;
-              }
-              input[type=checkbox]:checked{
-                background: url("../../../common/images/checked.png")no-repeat center;
-                background-size: 12px 12px;
-              }
-              label {
-                cursor: pointer;
-              }
-            }
-          }
-        }
-        .show {
-            float: right;
-            color:  #58ACD7;;
-            font-size: 14px;
-            cursor: pointer;
-            img {
-              width: 12px;
-              height: 12px;
-            }
-          }
+.inspectItem{
+padding: 10px 0px 4px 0px;
+overflow: hidden;
+.title{
+  float: left;
+  height: 26px;
+  line-height: 26px;
+  padding: 0px 0px 0px 0px ;
+}
+.content{
+  float: left;
+  width: 349px;
+  line-height: 26px;
+  padding: 0px 0px 0px 0px;
+  span{
+   
+    font-size: 14px;
+    line-height: 14px;
+    display: inline-block;
+    margin: 0 6px 6px 6px;
+    cursor: pointer;
+    input[type='checkbox']{
+      float: left;
+      width: 14px;
+      height: 14px;
+      margin-right: 2px;
+      background-color: #fff;
+      -webkit-appearance:none;
+      border: 1px solid #c9c9c9;
+      border-radius: 2px;
+      outline: none;
+      cursor: pointer;
+    }
+    input[type=checkbox]:checked{
+      background: url("../../../common/images/checked.png")no-repeat center;
+      background-size: 12px 12px;
+    }
+    label {
+      .ellipsis;
+      display: inline-block;
+      cursor: pointer;
+      max-width: 260px;
+    }
+  }
+}
+}
+.show {
+  float: right;
+  color:  #58ACD7;;
+  font-size: 14px;
+  cursor: pointer;
+  img {
+    width: 12px;
+    height: 12px;
+  }
+}
+.itemLabelNameBox{
+  position: relative;
+}
+.info-img {
+  display: none;
+  position: absolute;
+  width: 15px;
+  top: -14px;
+  left: 50%;
+  margin-left: -7px;
+  cursor: pointer;
+  z-index: 2;
+}

+ 5 - 1
src/components/PushItems/index.jsx

@@ -165,7 +165,7 @@ class PushItems extends Component {
       showPartName,
       showAllName
     } = this.props.pushMessage;
-    const { tipsDiscalimer,chronicPushItems,wholeIndexs,setPushEmergencyIdx,sysConfig,windowHeight,hideAllDrop} = this.props;
+    const { tipsDiscalimer,chronicPushItems,wholeIndexs,setPushEmergencyIdx,sysConfig,windowHeight,hideAllDrop,getInfomation} = this.props;
     const {
       billing,
       changeCheck,
@@ -251,12 +251,16 @@ class PushItems extends Component {
                       list = {assay}
                       changeFlag = {changeAssay}
                       border = "true"
+                      type = {12}
+                      getInfomation = {getInfomation}
                     >
                     </RecommendInspect>
                     <RecommendInspect
                       title = '检查'
                       list = {check}
+                      type = {6}
                       changeFlag = {changeCheck}
+                      getInfomation = {getInfomation}
                     >
                     </RecommendInspect>
                   </ul>)}

+ 4 - 0
src/containers/PushItemsContainer.js

@@ -6,6 +6,7 @@ import { ADD_DIAGNOSTIC, GET_DIAGNOSTIC_STR } from '@store/types/diagnosticList'
 import {billing, getAllConceptDetail} from '../store/async-actions/pushMessage';
 import { isAddMainSuit } from '@store/async-actions/diagnosticList';
 import { HIDEDROP } from '@store/types/homePage.js';
+import { getConceptDetail } from '@store/async-actions/pushMessage';
 
 function mapStateToProps(state) {//console.log(state)
   const {pushMessage,diagnosticList,inspect} = state;
@@ -56,6 +57,9 @@ function mapDispatchToProps(dispatch) {
                 check: checkedCheck,
             })
         },
+        getInfomation(item){
+            dispatch(getConceptDetail(item))
+        },
         getTipsDetails: (item) => {
             dispatch(getAllConceptDetail(item))
         },