浏览代码

搜索为空清除列表数据

Luolei 6 年之前
父节点
当前提交
fe9e87d5e0

+ 1 - 1
src/common/components/SearchOption/index.jsx

@@ -57,7 +57,7 @@ class SearchOption extends React.Component {
               show:true
           })
       }else{
-          // this.handleClearVal()
+          this.handleClearVal('')            //这个要放开,输入为空清除列表
           this.setState({
               show:false
           })

+ 10 - 6
src/components/PushContainer/index.jsx

@@ -36,6 +36,8 @@ class PushContainer extends Component {
             oKBg:'',
             okColor:'red',
             num:0,          //计数
+            text:'',
+            currId:''
         }
         this.$cont = React.createRef();
         this.itemList = null;
@@ -46,6 +48,7 @@ class PushContainer extends Component {
         this.handleAllCheckbox=this.handleAllCheckbox.bind(this)
         this.handleMangerTemplate=this.handleMangerTemplate.bind(this)
         this.handleDelList=this.handleDelList.bind(this)
+        this.makeSure=this.makeSure.bind(this)
     }
     componentDidMount(){
         // const height = getWindowInnerHeight()-160;
@@ -114,7 +117,6 @@ class PushContainer extends Component {
         let e = event?event:window.event;
         if(e.keyCode == 13) {
             this.makeSure()
-            // store.dispatch(changeVisible(false))
         }
     }
     handleInput(e){
@@ -148,12 +150,13 @@ class PushContainer extends Component {
      * 改变模板标题
      * @param {模板id和模板title} obj
      */
-    handleTitleChange(obj) {
+    handleTitleChange(id,text) {
         store.dispatch(changeVisible(true))
         this.setState({
             type:3,
-            obj:obj,
-            title:obj.text,
+            currId:id,
+            title:text,
+            text:text,
             okText:'保存',
             okBorderColor:'#3B9ED0',
             okColor:'#fff',
@@ -180,6 +183,7 @@ class PushContainer extends Component {
         store.dispatch(allChecked(false))
         store.dispatch(allCheckedShow(!tmpFlg))
     }
+    
     handleDelList(){          //批量删除
         this.setState({
             type:2,
@@ -199,13 +203,13 @@ class PushContainer extends Component {
             store.dispatch(delBatchItem(this.props.checkItems))
             store.dispatch(changeVisible(false))
         }else if(this.state.type == 3){
-            if(this.state.title == this.state.obj.text){
+            if(this.state.title == this.state.text){
                 store.dispatch(changeVisible(false))
                 Notify.success('标题修改成功');
                 return;
             }
             let tempObj = {
-                id:this.state.obj.id,
+                id:this.state.currId,
                 title:this.state.title
             }
             store.dispatch(changeTitleAsync(tempObj))

+ 2 - 4
src/components/TemplateItems/TemplateItem/index.jsx

@@ -149,10 +149,8 @@ class TemplateItem extends React.Component {
     handleEditIconClick(e) {
         e.stopPropagation();
         const text = this.titleDOM.innerHTML;
-        this.props.handleTitleChange({
-            id: this.props.id,
-            text: text
-        });
+        let currId = this.props.id
+        this.props.handleTitleChange(currId,text);
     }
 
     recoverTitle() {