Explorar o código

Merge remote-tracking branch 'remotes/origin/dev5.3.2' into dev/new1

luolei %!s(int64=5) %!d(string=hai) anos
pai
achega
d453fcff32

+ 19 - 5
src/common/components/EditableSpan/index.jsx

@@ -85,7 +85,7 @@ class EditableSpan extends Component{
     this.setState({
       labelVal:text1
     });
-    
+
     const that = this;
     handleChange&&handleChange({text1,boxMark,i});
 
@@ -176,7 +176,7 @@ class EditableSpan extends Component{
         }
         if(obj){
           this.moveEnd(obj[0]);
-        } 
+        }
       }
     }
     if(ev.keyCode==39){//向右
@@ -193,7 +193,7 @@ class EditableSpan extends Component{
         }
       }
     }
-  }  
+  }
   handleKeyup(e){
     const {boxMark,handleKeydown,removeId,handleClear,removeSpan} = this.props;
     const {preVal,index} = this.state;
@@ -233,7 +233,7 @@ class EditableSpan extends Component{
       }
     }
 
-    if(ev.keyCode==8){     
+    if(ev.keyCode==8){
       // 主诉现病史去重:删除最后一个字的时候移除该数据(将name、id和value替换成空)并移除id
       // 前面是标签,内容为空时再删一次才移除标签;前面是文本,则直接移除;
       let preObj = $(this.$span.current).prev();
@@ -243,7 +243,21 @@ class EditableSpan extends Component{
         if(preObj[0].nodeName !=="DIV"){
           this.moveEnd(preObj[0]);
         }
+      }
+
+      if(innerVal !== preVal){
+
       }else{
+        // 中英文数字和下划线--单独删除标签
+        /*const reg = new RegExp("([\u4E00-\uFA29]|[\uE7C7-\uE7F3]|[a-zA-Z0-9_])");
+        if(index!==0 && reg.test(innerVal)){
+          let obj = preObj[0].nodeName=="DIV"?preObj.prev():preObj;
+          delSingleLable && delSingleLable({boxMark,i:index});
+          this.moveEnd(obj[0]);
+          this.setState({
+            index: null
+          })
+        }*/
         let data = innerVal.trim();
         //判断是否为空、中英文:, 。、;,且不是第一位
         // let pattern = new RegExp(/^\,?$|^\,?$|^\.?$|^\。?$|^\、?$|^\;?$|^\;?$|^\:?$|^\:?$|\s/);
@@ -264,7 +278,7 @@ class EditableSpan extends Component{
         removeSpan();
       }
     }
-    
+
   }
   componentWillReceiveProps(next){
     const isRead = this.props.isRead;

+ 7 - 21
src/components/AddAssistCheck/Textarea/index.jsx

@@ -1,7 +1,6 @@
 import React, { Component } from "react";
 import style from "./index.less";
 import config from '@config/index';
-import ScrollArea from 'react-scrollbar';
 import $ from 'jquery';
 
 class Textarea extends Component {
@@ -20,7 +19,8 @@ class Textarea extends Component {
   handleInput(e){
     const {handleChangeAssistValue,idx,handlePush} = this.props;
     const text = (e.target.innerHTML || e.target.innerText);
-    $(e.target).find('img').remove()
+    $(e.target).find('img').remove();
+    this.context.scrollArea.scrollBottom();       //避免滚动条上移不见
     // e.target.innerHTML = e.target.textContent
     const stimer = this.state.timer;
     handleChangeAssistValue&&handleChangeAssistValue(text,idx);
@@ -70,24 +70,7 @@ class Textarea extends Component {
   }
   render() {
     const {idx,disabled} = this.props;
-    //出现滚动条时阻止滚动冒泡,未出现时不阻止,否则外部滚动条滚不动
-    const showedBar = $("#datePick .scrollbar-container").length===1;
-    const contStyle={
-      opacity:'0.4',
-      right:'0',
-      top:'1px',
-      zIndex:'15',
-      width:'8px',
-      background:'#f1f1f1'};
-    const barStyle={background:'#777',width:'100%'};
-    return (<ScrollArea speed={0.8}
-                        horizontal={false}
-                        stopScrollPropagation={showedBar?true:false}
-                        style={{maxHeight:'100px'}}
-                        className={style["area"]}
-                        verticalContainerStyle={contStyle}
-                        verticalScrollbarStyle={barStyle}
-                        contentClassName="content">
+    return (
       <div className={style.textWap}>
         <div className={style.divTextarea}
             contenteditable={disabled?false:true}
@@ -96,8 +79,11 @@ class Textarea extends Component {
             onKeyUp={this.handleInput}
         ></div>
         <p ref={this.textInput} onClick={this.handleFocus} className={style.textareaWarring}></p>
-      </div></ScrollArea>
+      </div>
     );
   }
 }
+Textarea.contextTypes = {
+  scrollArea: React.PropTypes.object
+};
 export default Textarea;

+ 29 - 1
src/components/AddAssistCheck/index.jsx

@@ -183,6 +183,16 @@ class AddAssistCheck extends React.Component {
   getAssistLabel() {
     const { assistLabel,checkedListImport, handleChangeAssistValue, handleChangeDate, isRead, handlePush, winWidth,getInfomation,assistList } = this.props;
     const { visible,activeName,id,date } = this.state;
+    //出现滚动条时阻止滚动冒泡,未出现时不阻止,否则外部滚动条滚不动
+    const showedBar = $("#datePick .scrollbar-container").length===1;
+    const contStyle={
+      opacity:'0.4',
+      right:'0',
+      top:'1px',
+      zIndex:'15',
+      width:'8px',
+      background:'#f1f1f1'};
+    const barStyle={background:'#777',width:'100%'};
     return <React.Fragment>
       {
         checkedListImport.map((part,index)=>{
@@ -197,7 +207,16 @@ class AddAssistCheck extends React.Component {
                     </span>
                   </span>
                   <div className={styles.textareaWrap}>
-                    <Textarea value={item.value} disabled={item.disabled} handlePush={handlePush} isRead={isRead} handleChangeAssistValue={handleChangeAssistValue} idx={idx}></Textarea>
+                    <ScrollArea speed={0.8}
+                                horizontal={false}
+                                stopScrollPropagation={showedBar?true:false}
+                                style={{maxHeight:'100px'}}
+                                className={styles["area"]}
+                                verticalContainerStyle={contStyle}
+                                verticalScrollbarStyle={barStyle}
+                                contentClassName="content">
+                      <Textarea value={item.value} disabled={item.disabled} handlePush={handlePush} isRead={isRead} handleChangeAssistValue={handleChangeAssistValue} idx={idx}></Textarea>
+                    </ScrollArea>
                   </div>
                   <div className={styles.pointerFinger}>
                     <p>报告日期:<span>{item.time || this.state.dateTime}</span></p>
@@ -240,7 +259,16 @@ class AddAssistCheck extends React.Component {
                 </span>
               </span>
               <div className={styles.textareaWrap}>
+                <ScrollArea speed={0.8}
+                            horizontal={false}
+                            stopScrollPropagation={showedBar?true:false}
+                            style={{maxHeight:'100px'}}
+                            className={styles["area"]}
+                            verticalContainerStyle={contStyle}
+                            verticalScrollbarStyle={barStyle}
+                            contentClassName="content">
                 <Textarea value={item.value} disabled={item.disabled} handlePush={handlePush} isRead={isRead} handleChangeAssistValue={handleChangeAssistValue} idx={idx}></Textarea>
+                </ScrollArea>
               </div>
               <div className={styles.pointerFinger}>
                 <p onClick={() => this.handleShowDate(idx)}>报告日期:<span>{item.time || this.state.dateTime}</span></p>