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/tabs/tabcomponents/index.jsx |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 52 insertions(+), 0 deletions(-)

diff --git a/src/menu/components/tabs/tabcomponents/index.jsx b/src/menu/components/tabs/tabcomponents/index.jsx
index a67e744..44ceaaf 100644
--- a/src/menu/components/tabs/tabcomponents/index.jsx
+++ b/src/menu/components/tabs/tabcomponents/index.jsx
@@ -5,6 +5,7 @@
 import { Empty, notification, Modal } from 'antd'
 
 import Utils from '@/utils/utils.js'
+import MKEmitter from '@/utils/events.js'
 import Card from './card'
 import './index.scss'
 
@@ -46,10 +47,61 @@
       })
     }
 
+    let uuids = []
+    const getUuids = (item) => {
+      if (item.type === 'tabs') {
+        item.subtabs.forEach(tab => {
+          tab.components.forEach(c => {
+            getUuids(c)
+          })
+        })
+      } else {
+        if (item.action && item.action.length) {
+          item.action.forEach(act => {
+            if (!act.origin) {
+              uuids.push(act.uuid)
+            }
+          })
+        }
+        if (item.type === 'card') {
+          item.subcards.forEach(_card => {
+            _card.elements && _card.elements.forEach(cell => {
+              if (cell.eleType === 'button') {
+                uuids.push(cell.uuid)
+              }
+            })
+            _card.backElements && _card.backElements.forEach(cell => {
+              if (cell.eleType === 'button') {
+                uuids.push(cell.uuid)
+              }
+            })
+          })
+        } else if (item.type === 'table' && item.subtype === 'tablecard') {
+          item.subcards.forEach(_card => {
+            _card.elements && _card.elements.forEach(cell => {
+              if (cell.eleType === 'button') {
+                uuids.push(cell.uuid)
+              }
+            })
+          })
+        } else if (item.type === 'table' && item.subtype === 'normaltable') {
+          item.cols && item.cols.forEach(col => {
+            if (col.type !== 'action') return
+            col.elements && col.elements.forEach(cell => {
+              uuids.push(cell.uuid)
+            })
+          })
+        }
+      }
+    }
+
+    getUuids(card)
+
     confirm({
       title: `纭畾鍒犻櫎銆�${card.name}銆嬪悧锛焋,
       content: hasComponent ? '褰撳墠缁勪欢涓惈鏈夊瓙缁勪欢锛�' : '',
       onOk() {
+        MKEmitter.emit('delButtons', uuids)
         handleList({...config, components: cards.filter(item => item.uuid !== card.uuid)})
       },
       onCancel() {}

--
Gitblit v1.8.0