From bc4308e222af3e19f721a129ab132fb69909778e Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 23 十二月 2020 18:01:52 +0800
Subject: [PATCH] 2020-12-23

---
 src/menu/components/card/table-card/index.jsx |   31 ++++++++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/src/menu/components/card/table-card/index.jsx b/src/menu/components/card/table-card/index.jsx
index 6f572c1..9ce09b3 100644
--- a/src/menu/components/card/table-card/index.jsx
+++ b/src/menu/components/card/table-card/index.jsx
@@ -97,6 +97,7 @@
 
   componentDidMount () {
     MKEmitter.addListener('submitStyle', this.getStyle)
+    MKEmitter.addListener('logButton', this.logButton)
   }
 
   shouldComponentUpdate (nextProps, nextState) {
@@ -111,6 +112,21 @@
       return
     }
     MKEmitter.removeListener('submitStyle', this.getStyle)
+    MKEmitter.removeListener('logButton', this.logButton)
+  }
+
+  logButton = (id, item) => {
+    const { card } = this.state
+
+    if (id !== card.uuid) return
+
+    let btnlog = card.btnlog || []
+    btnlog.push(item)
+
+    this.setState({
+      card: {...card, btnlog}
+    })
+    this.props.updateConfig({...card, btnlog})
   }
 
   /**
@@ -154,7 +170,20 @@
       content: '纭畾鍒犻櫎鍗$墖鍚楋紵',
       onOk() {
         card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid)
-    
+        
+        let uuids = []
+        cell.elements && cell.elements.forEach(c => {
+          if (c.eleType === 'button') {
+            uuids.push(c.uuid)
+          }
+        })
+
+        MKEmitter.emit('delButtons', uuids)
+
+        if (card.btnlog) {
+          card.btnlog = card.btnlog.filter(c => c.$parentId !== cell.uuid)
+        }
+
         _this.setState({card})
         _this.props.updateConfig(card)
       },

--
Gitblit v1.8.0