From b6e8966b84a0641a29de57e3e7240e1227406765 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 05 一月 2021 11:30:42 +0800 Subject: [PATCH] 2021-01-05 --- src/menu/components/card/cardcellcomponent/index.jsx | 54 ++---------------------------------------------------- 1 files changed, 2 insertions(+), 52 deletions(-) diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx index 2f42da4..7388b7d 100644 --- a/src/menu/components/card/cardcellcomponent/index.jsx +++ b/src/menu/components/card/cardcellcomponent/index.jsx @@ -11,6 +11,7 @@ import { getActionForm } from '@/menu/components/share/actioncomponent/formconfig' import MKEmitter from '@/utils/events.js' +import MenuUtils from '@/menu/utils/menuUtils.js' import ElementForm from './elementform' import DragElement from './dragaction' import './index.scss' @@ -276,64 +277,13 @@ menulist = [] } - let modules = this.getModules(menu.components, cards.uuid) + let modules = MenuUtils.getSubModules(menu.components, cards.uuid) this.setState({ actvisible: true, card: card, formlist: getActionForm(card, functip, cards.setting, usefulFields, 'card', menulist, modules) }) - } - - getModules = (components, selfId) => { - let modules = components.map(item => { - if (item.uuid === selfId) { - return { - children: null - } - } else if (item.format) { - return { - value: item.uuid, - label: item.name - } - } else if (item.type === 'tabs') { - let _item = { - value: item.uuid, - label: item.name, - children: item.subtabs.map(f_tab => { - let subItem = { - value: f_tab.uuid, - label: f_tab.label, - children: this.getModules(f_tab.components, selfId) - } - - if (!subItem.children || subItem.children.length === 0) { - return {children: null} - } - return subItem - }) - } - - _item.children = _item.children.filter(t => t.children !== null) - - if (_item.children.length === 0) { - return {children: null} - } - - return _item - } else { - return { - children: null - } - } - }) - - modules = modules.filter(mod => mod.children !== null) - - if (modules.length === 0) { - return null - } - return modules } /** -- Gitblit v1.8.0