From ff4295358a99b2d35265a5fed445e4407cf6ed9a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 18 五月 2020 14:48:10 +0800
Subject: [PATCH] 2020-05-18

---
 src/templates/sharecomponent/actioncomponent/index.jsx |   30 +++++++++++++++++-------------
 1 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/src/templates/sharecomponent/actioncomponent/index.jsx b/src/templates/sharecomponent/actioncomponent/index.jsx
index 7f03402..45f5777 100644
--- a/src/templates/sharecomponent/actioncomponent/index.jsx
+++ b/src/templates/sharecomponent/actioncomponent/index.jsx
@@ -1,6 +1,6 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { fromJS } from 'immutable'
+import { is, fromJS } from 'immutable'
 import { Icon, Tooltip, Modal, notification, Button } from 'antd'
 import moment from 'moment'
 
@@ -63,6 +63,8 @@
     if (nextProps.pasteContent && nextProps.pasteContent.copyType === 'action') {
       this.setState({actionlist: [...actionlist, nextProps.pasteContent]})
       this.handleAction(nextProps.pasteContent)
+    } else if (!is(fromJS(nextProps.config.action), fromJS(this.props.config.action)) && !is(fromJS(nextProps.config.action), fromJS(actionlist))) {
+      this.setState({actionlist: fromJS(nextProps.config.action).toJS()})
     }
   }
 
@@ -76,8 +78,9 @@
       this.setState({actionlist: list})
       this.handleAction(card)
     } else {
-      this.setState({actionlist: list})
-      this.props.updateaction({...config, action: list})
+      this.setState({actionlist: list}, () => {
+        this.props.updateaction({...config, action: list})
+      })
     }
   }
 
@@ -349,9 +352,9 @@
           actionlist: _actionlist,
           copying: false,
           visible: false
+        }, () => {
+          this.props.updateaction({...config, action: _actionlist, gridBtn: _gridBtn}, copyActionId)
         })
-
-        this.props.updateaction({...config, action: _actionlist, gridBtn: _gridBtn}, copyActionId)
       })
     })
   }
@@ -549,10 +552,6 @@
 
         _actionlist = _actionlist.filter(item => item.uuid !== card.uuid)
 
-        _this.setState({
-          actionlist: _actionlist
-        })
-        
         let _hasGridbtn = _actionlist.filter(act => act.position === 'grid').length > 0
         let _gridBtn = config.gridBtn ? fromJS(config.gridBtn).toJS() : null
 
@@ -577,7 +576,11 @@
           card: card
         }
 
-        _this.props.updateaction({...config, action: _actionlist, gridBtn: _gridBtn}, '', delcard)
+        _this.setState({
+          actionlist: _actionlist
+        }, () => {
+          _this.props.updateaction({...config, action: _actionlist, gridBtn: _gridBtn}, '', delcard)
+        })
       },
       onCancel() {}
     })
@@ -616,8 +619,9 @@
       this.setState({
         actionlist: _actionlist,
         profVisible: false
+      }, () => {
+        this.props.updateaction({...config, action: _actionlist})
       })
-      this.props.updateaction({...config, action: _actionlist})
     })
   }
 
@@ -785,9 +789,9 @@
 
           this.setState({
             actionlist: _actionlist
+          }, () => {
+            this.props.updateaction({...config, action: _actionlist, gridBtn: _gridBtn})
           })
-
-          this.props.updateaction({...config, action: _actionlist, gridBtn: _gridBtn})
         })
       })
     })

--
Gitblit v1.8.0