Browse Source

Merge branch 'ChronicMag' into optimize

Luolei 6 years ago
parent
commit
ebbc4b4078

+ 14 - 1
src/common/components/InlineTag/index.jsx

@@ -29,6 +29,7 @@ class InlineTag extends Component {
     this.handleInput = this.handleInput.bind(this);
     this.handleFocus = this.handleFocus.bind(this);
     this.handleFixClick = this.handleFixClick.bind(this);
+    this.handleBoxInput = this.handleBoxInput.bind(this);
   }
   changeToEdit(e){
     const {handledbClick,id} = this.props;
@@ -43,6 +44,14 @@ class InlineTag extends Component {
     //埋点记录
     handledbClick&&handledbClick({id});
   }
+  handleBoxInput(e){
+    const {handleInput,ikey,prefix,suffix} = this.props;
+    const total = e.target.innerText;
+    const text = this.$span.current.innerText;
+    if(!total){
+      handleInput&&handleInput({text:total,ikey});
+    }
+  }
   changeToClick(event){
     event.returnValue = true;
     const {canEditable} = this.props;
@@ -52,6 +61,7 @@ class InlineTag extends Component {
     });
   }
   handleInput(e){       //输入时保存临时值,在修改灰显为黑色时判断用
+    e.stopPropagation();
     const {handleInput,ikey,prefix,suffix} = this.props;
     const text = e.target.innerText || e.target.innerHTML;
     // 内容全部删除时,要把空值存到store,否则会遗留最后一个字且为灰色无法删除
@@ -130,7 +140,10 @@ class InlineTag extends Component {
                  onDoubleClick={this.changeToEdit}
                   onClick={!editable?this.handleFixClick:''}
                  onkeydown={handleEnter}
-                 onBlur={this.changeToClick} ref={this.$box} contentEditable={editable}>
+                 onBlur={this.changeToClick} 
+                 ref={this.$box} 
+                 contentEditable={editable}
+                 onInput={this.handleBoxInput}>
                 {prefix}
                 <span className={style['free-in']}
                       contentEditable={true}

+ 2 - 2
src/common/less/variables.less

@@ -45,8 +45,8 @@
 @dropdwon-height:200px;
 @selected-bg:#fff;
 @import-color:#ffad5f;
-@closeIcon:url(../images/del_nor.png);
-@closeHor:url(../images/del_hor.png);
+@closeIcon:url(../images/del_nor.png) no-repeat;
+@closeHor:url(../images/del_hor.png) no-repeat;
 
 /*********推送内容容器宽度*************/
 @push-width: 450px;

+ 1 - 1
src/components/AddAssistCheck/index.less

@@ -69,7 +69,7 @@
               height: 15px;
               cursor: pointer;
               position: absolute;
-              right: 3px;
+              right: 2px;
               top: 2px;
               background: @closeIcon;
               background-size: 100% 100%;

+ 2 - 0
src/components/AddInspect/SlideExcel/index.less

@@ -113,6 +113,7 @@
         td {
             text-align: left;
             padding-top: 6px;
+            cursor: default;
         }
         .excelUnit {
             width: auto;
@@ -157,6 +158,7 @@
   left: 50%;
   margin-left: -8px;
   display: none;
+  cursor: pointer;
 }
 .imgInfo:hover {
   background: url('../img/info3.png') no-repeat center center;

+ 6 - 3
src/components/AddInspect/SlideSelect/index.less

@@ -3,7 +3,7 @@
     // cursor: pointer;
     // color: #767676;
     position: relative;
-    padding: 10px 10px 10px 0;
+    padding: 10px 20px 10px 0;
     border-bottom:1px dashed #989DA3;
     i {
         font-style: normal;
@@ -31,7 +31,7 @@
         cursor: pointer;
         display: inline-block;
         position: absolute;
-        right: 3px;
+        right: 2px;
         top: 13px;
         // background-color: #fff;
         background: @closeIcon;
@@ -83,7 +83,8 @@
         height: 18px;
         width: 100%;
         td {
-            padding-top: 3px;
+          cursor: default;
+          padding-top: 3px;
         }
     }
 }
@@ -130,6 +131,7 @@
             td {
                 text-align: left;
                 padding-top: 6px;
+                cursor: default;
             }
             .excelUnit {
                 width: auto;
@@ -175,6 +177,7 @@
   left: 50%;
   margin-left: -8px;
   display: none;
+  cursor: pointer;
 }
 .imgInfo:hover {
   background: url('../img/info3.png') no-repeat center center;

+ 19 - 17
src/components/AddInspect/index.jsx

@@ -206,23 +206,25 @@ class Inspect extends React.Component {
             return (
               <li className={`${styles.itemPart} ${fillActive.details.length > 1 ? '' : styles.itemPartOne}`}>
                 <span className={styles.itemPartL}>{item.name}</span>
-                <select className={styles.itemPartR} onChange={(e) => {
-                  if (e.target.value == '请选择') {
-                    this.changeActivePart(idx, '')
-                    return;
-                  }
-                  this.changeActivePart(idx, e.target.value);
-                }}
-                >
-                  <option value="请选择">请选择</option>
-                  {
-                    (item.questionDetailList).map((val) => {
-                      return <option value={val.name}
-                        selected={val.name == item.value ? true : false}
-                      >{val.name}</option>
-                    })
-                  }
-                </select>
+                <span className={styles.itemPartT}>
+                  <select className={styles.itemPartR} onChange={(e) => {
+                    if (e.target.value == '请选择') {
+                      this.changeActivePart(idx, '')
+                      return;
+                    }
+                    this.changeActivePart(idx, e.target.value);
+                  }}
+                  >
+                    <option value="请选择">请选择</option>
+                    {
+                      (item.questionDetailList).map((val) => {
+                        return <option value={val.name}
+                          selected={val.name == item.value ? true : false}
+                        >{val.name}</option>
+                      })
+                    }
+                  </select>
+                </span>
               </li>
             )
           } else if (item.controlType == 6) {

+ 4 - 3
src/components/AddInspect/index.less

@@ -147,7 +147,8 @@
     .itemPartR {
         width: 62px;
         outline: none;
-        float: right;
+        float: left;
+        margin-top: 5px;
     }
     .itemPartT {
         float: right;
@@ -179,8 +180,8 @@
         width: 15px;
         height: 15px;
         position: absolute;
-        top: -10px;
-        right: -6px;
+        top: -5px;
+        right: -5px;
         z-index: 30;
         border-radius: 50%;
         background: @closeIcon;

BIN
src/components/DiagnosticList/img/delete-on.png


+ 14 - 2
src/components/DiagnosticList/index.jsx

@@ -1,6 +1,7 @@
 import React, { Component } from 'react';
 import style from './index.less';
 import del_icon from './img/delete.png'
+import del_on from './img/delete-on.png'
 import diagUp from './img/diagUp.png'
 import diagDown from './img/diagDown.png'
 import manageIcon from '@common/images/manage.png';
@@ -32,6 +33,7 @@ class DiagnosticList extends Component {
             isAssessConfirm:false,
             radioVal:{},  //可能结果选择内容
             possible:{},  //可能结果
+            hasOndel: false
         }
         this.deleteItem = this.deleteItem.bind(this);
         this.cancel = this.cancel.bind(this);
@@ -232,9 +234,19 @@ class DiagnosticList extends Component {
           })
       }
     }
+    handleEnterDel() {
+      this.setState({
+        hasOndel: true
+      })
+    }
+    handleLeaveDel() {
+      this.setState({
+        hasOndel: false
+      })
+    }
     render(){
         const { list, treatment, showReferRecord, showHistoryCase ,chronicMagItem} = this.props;
-        const { visible, treatTitle ,showAssess, isAssessConfirm, radioVal, possible,assessId,disName} = this.state;
+        const { visible, treatTitle ,showAssess, isAssessConfirm, radioVal, possible,assessId,disName, hasOndel} = this.state;
         const chronicList = JSON.parse(localStorage.getItem('chronic')||null);
         const chronicLine = chronicMagItem&&chronicMagItem.name;     //当前是否走的慢病流程
         let isChronic = false;      //是否要显示管理评估
@@ -263,7 +275,7 @@ class DiagnosticList extends Component {
                                           onClick={this.showAssessFn.bind(this,item)}>
                                         管理评估
                                     </span>:''}
-                                    <img className={style['diag-del']} src={del_icon} onClick={()=>{this.handleDeleteItem(item)}}/>
+                                    <img className={style['diag-del']} src={hasOndel ? del_on : del_icon} onMouseEnter={this.handleEnterDel.bind(this)} onMouseLeave={this.handleLeaveDel.bind(this)} onClick={()=>{this.handleDeleteItem(item)}}/>
                         </div>)
                     })}
                      {treatment&&<Treat title={treatTitle}></Treat>}

+ 4 - 1
src/store/actions/currentIll.js

@@ -864,7 +864,10 @@ export function setInputLabel(state,action){
     }
   }
   if(text){
-    res.saveText[i] = prefix+text+suffix;
+    res.saveText[i] = prefix ||''+ text + suffix||'';
+  }else if(!text && !prefix && !suffix){//整个标签内容完全删除
+    res.data.splice(i,1);
+    res.saveText.splice(i,1);
   }else{//删除完要清空
     res.saveText[i] = "";
   }