From 72419e2f826031a158173f46d723a672064e37cd Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 31 八月 2021 22:42:51 +0800 Subject: [PATCH] 2021-08-31 --- src/menu/components/group/groupcomponents/index.jsx | 52 ++++++++++++++-------------------------------------- 1 files changed, 14 insertions(+), 38 deletions(-) diff --git a/src/menu/components/group/groupcomponents/index.jsx b/src/menu/components/group/groupcomponents/index.jsx index acffe01..52d00b5 100644 --- a/src/menu/components/group/groupcomponents/index.jsx +++ b/src/menu/components/group/groupcomponents/index.jsx @@ -6,6 +6,7 @@ import Utils from '@/utils/utils.js' import MKEmitter from '@/utils/events.js' +import MenuUtils from '@/utils/utils-custom.js' import Card from './card' import './index.scss' @@ -38,49 +39,16 @@ const deleteCard = (id) => { const { card } = findCard(id) - let uuids = [] - if (card.action && card.action.length) { - card.action.forEach(act => { - if (!act.origin) { - uuids.push(act.uuid) - } - }) - } - if (card.type === 'card') { - card.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 (card.type === 'table' && card.subtype === 'tablecard') { - card.subcards.forEach(_card => { - _card.elements && _card.elements.forEach(cell => { - if (cell.eleType === 'button') { - uuids.push(cell.uuid) - } - }) - }) - } else if (card.type === 'table' && card.subtype === 'normaltable') { - card.cols && card.cols.forEach(col => { - if (col.type !== 'action') return - col.elements && col.elements.forEach(cell => { - uuids.push(cell.uuid) - }) - }) - } + let uuids = MenuUtils.getDelButtonIds(card) confirm({ title: `纭畾鍒犻櫎銆�${card.name}銆嬪悧锛焋, onOk() { - MKEmitter.emit('delButtons', uuids) handleList({...config, components: cards.filter(item => item.uuid !== card.uuid)}) + + if (uuids.length === 0) return + + MKEmitter.emit('delButtons', uuids) }, onCancel() {} }) @@ -101,11 +69,19 @@ let names = { bar: '鏌辩姸鍥�', line: '鎶樼嚎鍥�', + tabs: '鏍囩缁�', pie: '楗煎浘', + search: '鎼滅储', table: '琛ㄦ牸', + group: '鍒嗙粍', editor: '瀵屾枃鏈�', + code: '鑷畾涔�', + carousel: '杞挱', + form: '琛ㄥ崟', dashboard: '浠〃鐩�', scatter: '鏁g偣鍥�', + tree: '鏍戝舰鍒楄〃', + balcony: '娴姩鍗�', card: '鍗$墖' } let i = 1 -- Gitblit v1.8.0