|
@@ -3,8 +3,9 @@ import className from 'classnames';
|
|
|
import {NumberUnitPan} from '@commonComp';
|
|
|
import style from './index.less';
|
|
|
import config from '@config/index.js';
|
|
|
-import {filterArr,handleEnter} from '@utils/tools.js';
|
|
|
+import {filterArr,handleEnter,isIE} from '@utils/tools.js';
|
|
|
import {Notify} from '@commonComp';
|
|
|
+import $ from 'jquery';
|
|
|
/***
|
|
|
* 带单位数字组件
|
|
|
* 接收参数:
|
|
@@ -69,37 +70,43 @@ class NumberUnitDrop extends Component{
|
|
|
//数字框失焦,保存值到store中
|
|
|
numInpBlur(e){
|
|
|
e.stopPropagation();
|
|
|
+ const {handleSelect,ikey,suffix,prefix,mainSaveText} = this.props;
|
|
|
+ const {editable} = this.state;
|
|
|
+ if(editable){
|
|
|
+ const text = e.target.innerText;
|
|
|
+ // this.$span.current.innerText=''; //修改生成文字变成输入的2倍bug
|
|
|
+ handleSelect&&handleSelect({ikey,text,suffix,prefix,mainSaveText});
|
|
|
+ }
|
|
|
this.setState({
|
|
|
isClosed:false,
|
|
|
numEditable:true,
|
|
|
hasSelect:false,
|
|
|
editable:false
|
|
|
});
|
|
|
- const text = e.target.innerText;
|
|
|
- this.$span.current.innerText=''; //修改生成文字变成输入的2倍bug
|
|
|
- const {handleSelect,ikey,suffix,prefix,mainSaveText} = this.props;
|
|
|
- handleSelect&&handleSelect({ikey,text,suffix,prefix,mainSaveText});
|
|
|
+
|
|
|
}
|
|
|
|
|
|
handleSpanInp(e){ //数字框输入事件
|
|
|
e.stopPropagation();
|
|
|
// 主诉字数达到上限时不允许输入
|
|
|
const {mainSaveText,ikey,type,handleSelect,suffix,prefix,boxMark} = this.props;
|
|
|
- const {labelVal} = this.state;
|
|
|
+ const {labelVal,editable} = this.state;
|
|
|
let mainText = filterArr(mainSaveText);//主诉字数
|
|
|
- let val = e.target.innerText;
|
|
|
- if(+boxMark==1){
|
|
|
- if(mainText.length >= config.limited){
|
|
|
- if(val.length > labelVal.length){
|
|
|
- e.target.innerText = labelVal;
|
|
|
- Notify.info(config.limitText);
|
|
|
- return
|
|
|
- }else if(val.length == labelVal.length){
|
|
|
- this.setState({
|
|
|
- labelVal:val
|
|
|
- });
|
|
|
- }else{
|
|
|
- handleSelect&&handleSelect({ikey,text:val,suffix,prefix,mainSaveText});
|
|
|
+ if(editable){//避免IE中点击标签也会触发
|
|
|
+ let val = e.target.innerText;
|
|
|
+ if(+boxMark==1){
|
|
|
+ if(mainText.length >= config.limited){
|
|
|
+ if(val.length > labelVal.length){
|
|
|
+ e.target.innerText = labelVal;
|
|
|
+ Notify.info(config.limitText);
|
|
|
+ return
|
|
|
+ }else if(val.length == labelVal.length){
|
|
|
+ this.setState({
|
|
|
+ labelVal:val
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ handleSelect&&handleSelect({ikey,text:val,suffix,prefix,mainSaveText});
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -126,6 +133,13 @@ class NumberUnitDrop extends Component{
|
|
|
handleDbclick && handleDbclick({id:patId||id});
|
|
|
}
|
|
|
}
|
|
|
+ componentDidMount(){
|
|
|
+ if(isIE()){
|
|
|
+ $(this.$span.current).onIe8Input(function(e){
|
|
|
+ this.handleSpanInp(e)
|
|
|
+ },this);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
render(){
|
|
|
const {placeholder,prefix,suffix,show,value,handleHide} = this.props;
|