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/data-card/index.jsx |   35 ++++++++++++++++++++++++++++++++++-
 1 files changed, 34 insertions(+), 1 deletions(-)

diff --git a/src/menu/components/card/data-card/index.jsx b/src/menu/components/card/data-card/index.jsx
index 57b3102..ed51769 100644
--- a/src/menu/components/card/data-card/index.jsx
+++ b/src/menu/components/card/data-card/index.jsx
@@ -108,6 +108,7 @@
   componentDidMount () {
     MKEmitter.addListener('submitStyle', this.getStyle)
     MKEmitter.addListener('submitModal', this.handleSave)
+    MKEmitter.addListener('logButton', this.logButton)
   }
 
   shouldComponentUpdate (nextProps, nextState) {
@@ -123,8 +124,23 @@
     }
     MKEmitter.removeListener('submitStyle', this.getStyle)
     MKEmitter.removeListener('submitModal', this.handleSave)
+    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})
+  }
+  
   /**
    * @description 鍗$墖琛屽灞備俊鎭洿鏂帮紙鏁版嵁婧愶紝鏍峰紡绛夛級
    */
@@ -166,7 +182,24 @@
       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)
+          }
+        })
+        cell.backElements && cell.backElements.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