Explorar el Código

Merge remote-tracking branch 'origin/innterfaceUpdate' into dev/new1

zhouna hace 5 años
padre
commit
baae5576e5
Se han modificado 2 ficheros con 13 adiciones y 10 borrados
  1. 11 9
      src/components/NumberDrop/index.jsx
  2. 2 1
      src/store/actions/otherHistory.js

+ 11 - 9
src/components/NumberDrop/index.jsx

@@ -95,21 +95,21 @@ class NumberDrop extends Component{
       hasSelect:false
     });
   }
-  handleNumFocus(e){console.log('focus')
+  handleNumFocus(e){
     const {placeholder} = this.state;
-    const val = e.target.innerText.trim();//console.log(33,e.target.innerText,placeholder,e.target.innerText.trim() == placeholder)
+    const val = this.$span.current.innerText.trim();//console.log(33,e.target.innerText,placeholder,e.target.innerText.trim() == placeholder)
     if(val!=''&&val == placeholder){
       this.setState({
         placeholder:''
       });
     }
-    e.stopPropagation();
+    e&&e.stopPropagation();
     const {show,handleShow,ikey,id,patId,handleHide} = this.props;
     if(show) {
       handleHide && handleHide();
       return;
     }else{
-      this.$span.current.focus();
+      //this.$span.current.focus();
       this.setState({
         hasSelect:false,
         placeholder:''      //火狐26placeholder点击不隐藏bug修改
@@ -125,8 +125,10 @@ class NumberDrop extends Component{
       handleHide && handleHide();
     }
   }
-  handleNumClick(e){     //数字框不可编辑的状态时点击事件,点击将数字框变为可输入且下拉不再显示直到失焦后再次聚集
+  handleNumClick(e){    //数字框不可编辑的状态时点击事件,点击将数字框变为可输入且下拉不再显示直到失焦后再次聚集
     e.stopPropagation();
+    this.$span.current.focus();
+    //this.handleNumFocus();
     /*const {show,handleShow,ikey,id,patId,handleHide} = this.props;
     if(show) {
       handleHide && handleHide();
@@ -270,12 +272,12 @@ class NumberDrop extends Component{
     const {placeholder,hasSelect} = this.state;
     return <div className={this.getClasses(nospecial)}
                 style={{position:'relative'}}
-                onClick={allClick?this.handleNumClick:null}
+                /*onClick={allClick?this.handleNumClick:null}*/
                 onMouseUp={()=>handleMouseUp({select_start,i,boxMark})}
                 onMouseDown={this.handleMouseDown.bind(this)}>
-      <span className={`${setFontColorSize(val?'':isSelectAll?2:isExtBlue?2:1)} prefixUnset`}>{prefix}</span>
+      <span onClick={allClick?this.handleNumClick:null} className={`${setFontColorSize(val?'':isSelectAll?2:isExtBlue?2:1)} prefixUnset`}>{prefix}</span>
       <span onFocus={this.handleNumFocus}
-            onClick={allClick?null:this.handleNumClick}
+            onClick={e=>e.stopPropagation()}
             contentEditable={true}
             style={{minWidth:'10px',display:'inline-block',textAlign:'center'}}
             ref = {this.$span}
@@ -286,7 +288,7 @@ class NumberDrop extends Component{
             onInput={this.handleSpanInp}
             className={`${this.getSpanClass(nospecial)}`}
             >&nbsp;{val||placeholder}</span>
-      <span className={`${setFontColorSize(val?'':isSelectAll?2:isExtBlue?2:1)} prefixUnset`}>{suffix}</span>
+      <span onClick={allClick?this.handleNumClick:null} className={`${setFontColorSize(val?'':isSelectAll?2:isExtBlue?2:1)} prefixUnset`}>{suffix}</span>
       <NumberPan handleSelect={this.select.bind(this)}
                  noString={formulaCode?true:false}
                  onClose={handleHide}

+ 2 - 1
src/store/actions/otherHistory.js

@@ -169,7 +169,8 @@ export function changeTextLabel(state,action) {
           localStorage.setItem('radio'+item.id,JSON.stringify([li]));
         }
         //取消原选中状态
-        item.questionDetailList.find((it)=>it.selected==true).selected=false;
+        const sltItem = item.questionDetailList.find((it)=>it.selected==true);
+        sltItem?sltItem.selected=false:'';
       }
       item.labelPrefix = prefix||'';
       item.labelSuffix = suffix||'';