|
@@ -1,6 +1,6 @@
|
|
|
import React,{Component} from 'react';
|
|
|
-import {handleEnter,getPageCoordinate,windowEventHandler} from '@utils/tools.js';
|
|
|
-import {DropList} from '@commonComp';
|
|
|
+import {handleEnter,getPageCoordinate,windowEventHandler,filterDataArr,getLabelIndex} from '@utils/tools.js';
|
|
|
+import {DropList,Notify} from '@commonComp';
|
|
|
import config from '@config/index';
|
|
|
import style from "./index.less";
|
|
|
import classNames from 'classnames';
|
|
@@ -26,7 +26,8 @@ class RadioInpDrop extends Component{
|
|
|
boxTop:0,
|
|
|
tmpScroll:0,
|
|
|
tmpTop:0,
|
|
|
- texts:props.vals||{0:props.value||props.placeholder}
|
|
|
+ texts:props.vals||{0:props.value||props.placeholder},
|
|
|
+ over:false
|
|
|
};
|
|
|
this.$cont = React.createRef();
|
|
|
this.isIE = navigator.appName=="Microsoft Internet Explorer" && navigator.appVersion.split(";")[1].replace(/[ ]/g,"")=="MSIE8.0";
|
|
@@ -147,22 +148,44 @@ class RadioInpDrop extends Component{
|
|
|
handleDbclick&&handleDbclick({id:patId||id});
|
|
|
}
|
|
|
handleInnerInp(i,val){
|
|
|
- const {ikey,boxMark,handleSaveInp} = this.props;
|
|
|
- let vals = this.state.texts;
|
|
|
+ const {ikey,boxMark,handleSaveInp,mainSaveText} = this.props;
|
|
|
+ let vals = this.state.texts;
|
|
|
+
|
|
|
+ // 主诉字数限制
|
|
|
+ if(boxMark==1){
|
|
|
+ let preText = vals[i].value;
|
|
|
+ let mainText = filterDataArr(mainSaveText);
|
|
|
+ let lengths = 0;
|
|
|
+ if(preText){
|
|
|
+ lengths = mainText.length + (val.length - preText.length);
|
|
|
+ }else{
|
|
|
+ lengths = mainText.length + val.length;
|
|
|
+ }
|
|
|
+ console.log("val:",val,"preVal:",preText,"mainText:",mainText,"lengths:",lengths,this.state.texts)
|
|
|
+ if(lengths >= config.limited){
|
|
|
+ Notify.info(config.limitText);
|
|
|
+ this.setState({
|
|
|
+ over:true
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
vals[i].value=val;
|
|
|
this.setState({
|
|
|
- texts:vals
|
|
|
+ texts:vals,
|
|
|
+ over:false
|
|
|
});
|
|
|
- handleSaveInp({values:vals,ikey,boxMark});
|
|
|
+ handleSaveInp({values:vals,ikey,boxMark,mainSaveText});
|
|
|
}
|
|
|
parseInputDom(){
|
|
|
const {value,placeholder} = this.props;
|
|
|
- const {texts} = this.state;
|
|
|
+ const {texts,over} = this.state;
|
|
|
let temp='',list=[];
|
|
|
for(let i in texts){
|
|
|
temp = texts[i];
|
|
|
if(typeof temp=='object'){
|
|
|
- list.push(<InputComp handleInp={this.handleInnerInp} editable={true} index={i} value={temp.value}></InputComp>);
|
|
|
+ list.push(<InputComp handleInp={this.handleInnerInp} editable={true} index={i} value={temp.value} over={over}></InputComp>);
|
|
|
}else{
|
|
|
list.push(<span> {temp}</span>);
|
|
|
}
|
|
@@ -207,7 +230,7 @@ class InputComp extends Component{
|
|
|
handleBlur(e){
|
|
|
e.stopPropagation();
|
|
|
const text = e.target.innerText;
|
|
|
- const {handleInp,index} = this.props;
|
|
|
+ const {handleInp,index,value} = this.props;
|
|
|
e.target.innerText = '';
|
|
|
handleInp(index,text);
|
|
|
}
|