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/datasource/verifycard/settingform/index.jsx |   82 +----------------------------------------
 1 files changed, 2 insertions(+), 80 deletions(-)

diff --git a/src/menu/datasource/verifycard/settingform/index.jsx b/src/menu/datasource/verifycard/settingform/index.jsx
index a063963..d165e93 100644
--- a/src/menu/datasource/verifycard/settingform/index.jsx
+++ b/src/menu/datasource/verifycard/settingform/index.jsx
@@ -4,6 +4,7 @@
 
 import { formRule } from '@/utils/option.js'
 import Utils from '@/utils/utils.js'
+import MenuUtils from '@/menu/utils/menuUtils.js'
 import CodeMirror from '@/templates/zshare/codemirror'
 import './index.scss'
 
@@ -30,7 +31,7 @@
   UNSAFE_componentWillMount () {
     const { menu, config } = this.props
 
-    let modules = this.getModules(menu.components, config.uuid)
+    let modules = MenuUtils.getSupModules(menu.components, config.uuid)
     if (!modules) {
       modules = []
     }
@@ -52,85 +53,6 @@
     }
 
     this.setState({modules, usefulFields})
-  }
-
-  getModules = (components, selfId) => {
-    let modules = components.map(item => {
-      if (item.uuid === selfId) {
-        return {
-          children: null
-        }
-      } else if (item.switchable) {
-        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 if (item.type === 'group') {
-        let _item = {
-          value: item.uuid,
-          label: item.name,
-          children: item.components.map(f_tab => {
-            if (f_tab.uuid === selfId) {
-              return {
-                children: null
-              }
-            } else if (f_tab.switchable) {
-              return {
-                value: f_tab.uuid,
-                label: f_tab.name
-              }
-            }
-            return {
-              children: null
-            }
-          })
-        }
-
-        _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
   }
 
   handleConfirm = () => {

--
Gitblit v1.8.0