From eebe63a6727e6495321d1433ebd2779b5a36d45a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 31 十二月 2020 22:08:14 +0800
Subject: [PATCH] 2020-12-31

---
 src/menu/menushell/index.jsx |   57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 55 insertions(+), 2 deletions(-)

diff --git a/src/menu/menushell/index.jsx b/src/menu/menushell/index.jsx
index de7b7da..36a5852 100644
--- a/src/menu/menushell/index.jsx
+++ b/src/menu/menushell/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({...menu, components: cards.filter(item => item.uuid !== card.uuid)})
       },
       onCancel() {}
@@ -81,6 +133,7 @@
         tabs: '鏍囩缁�',
         pie: '楗煎浘',
         search: '鎼滅储',
+        table: '琛ㄦ牸',
         card: '鍗$墖'
       }
       let i = 1
@@ -119,7 +172,7 @@
         targetId = item.dropTargetId
         delete item.dropTargetId
       } else if (cards.length > 0) {
-        targetId = cards[cards.length - 1].uuid
+        targetId = cards.slice(-1)[0].uuid
       }
 
       const { index: overIndex } = findCard(`${targetId}`)
@@ -130,7 +183,7 @@
   })
 
   return (
-    <div ref={drop} className="menu-shell-inner" style={menu.style}>
+    <div ref={drop} className="menu-shell-inner" id="menu-shell-inner" style={menu.style}>
       <div className="ant-row">
         {cards.map(card => (
           <Card

--
Gitblit v1.8.0