zhouna před 6 roky
rodič
revize
ee5b7c3eb6
1 změnil soubory, kde provedl 6 přidání a 6 odebrání
  1. 6 6
      src/common/components/EditableSpan/index.jsx

+ 6 - 6
src/common/components/EditableSpan/index.jsx

@@ -50,7 +50,7 @@ class EditableSpan extends Component{
   onChange(e){
     e.stopPropagation();
     const {handleChange,boxMark,i,handleSearch,value,mainSaveText,mainIds} = this.props;
-    const {labelVal,oldText,searchPre} = this.state;
+    const {labelVal,searchPre} = this.state;
     const text1 =e.target.innerText;
     let mainText = filterArr(mainSaveText);//主诉字数
     if(+boxMark==1){
@@ -83,14 +83,14 @@ class EditableSpan extends Component{
       let temp = '';
       let search='';
       clearTimeout(that.state.timer);
-      // temp = newText.replace(oldText.replace(/(^\s*)|(\s*$)/g,''),'');
       temp = newText.replace(searchPre.replace(/(^\s*)|(\s*$)|(^\,*)|(\,*$)/g,''),'');
       search = temp.replace(/(^\s*)|(\s*$)|(^\,*)|(\,*$)/g,'');
-      // console.log(111,labelVal,searchPre,333,newText,444,search);
+      //console.log(labelVal,'旧:',searchPre,'新:',newText,'搜索:',search);
       handleSearch&&handleSearch({text:search,boxMark,mainIds});
-      /*that.setState({
-        oldText:newText.replace(search,'')
-      })*/
+      //搜索后保持现在的值,继续输入时要用于对比
+      that.setState({
+        searchPre:newText
+      });
     },config.delayTime);
     this.setState({
       timer