From 2a3cc4e6cecfc6dab8b60adf93f7fde898ddc939 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 25 七月 2023 16:36:23 +0800
Subject: [PATCH] 2023-07-25

---
 src/views/menudesign/popview/index.jsx |   39 ++++++++++++++++++++++++---------------
 1 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/src/views/menudesign/popview/index.jsx b/src/views/menudesign/popview/index.jsx
index 4b98125..d5eccea 100644
--- a/src/views/menudesign/popview/index.jsx
+++ b/src/views/menudesign/popview/index.jsx
@@ -12,7 +12,6 @@
 const { Panel } = Collapse
 const { confirm } = Modal
 
-const MenuForm = asyncComponent(() => import('./menuform'))
 const SourceWrap = asyncComponent(() => import('@/menu/modulesource'))
 const Modulecell = asyncComponent(() => import('@/menu/modulecell'))
 const MenuShell = asyncComponent(() => import('@/menu/menushell'))
@@ -113,6 +112,7 @@
 
   completeSave = () => {
     this.setState({
+      oriConfig: fromJS(this.state.config).toJS(),
       menuloading: false
     })
   }
@@ -129,8 +129,14 @@
       return
     }
 
-    if (config.enabled && this.verifyConfig()) {
+    let _pass = this.verifyConfig(config)
+
+    if (config.enabled && !_pass) {
       config.enabled = false
+      config.force = true
+    } else if (!config.enabled && config.force && _pass) {
+      config.enabled = true
+      delete config.force
     }
 
     this.getMenuMessage(config)
@@ -142,23 +148,28 @@
 
     window.GLOB.customMenu = config
 
-    this.props.save(config)
+    this.props.save(fromJS(config).toJS())
   }
 
   onEnabledChange = () => {
     const { config } = this.state
 
-    if (!config.enabled && this.verifyConfig(true)) {
-      return
-    }
+    let _config = {...config, enabled: !config.enabled}
 
-    this.setState({
-      config: {...config, enabled: !config.enabled}
-    })
+    delete _config.force
+
+    if (!_config.enabled) {
+      this.setState({
+        config: _config
+      })
+    } else if (this.verifyConfig(_config)) {
+      this.setState({
+        config: _config
+      })
+    }
   }
 
-  verifyConfig = (show) => {
-    const { config } = this.state
+  verifyConfig = (config) => {
     let error = ''
 
     let check = (components) => {
@@ -185,7 +196,7 @@
 
     check(config.components)
 
-    if (show && error) {
+    if (config.enabled && error) {
       notification.warning({
         top: 92,
         message: error,
@@ -193,7 +204,7 @@
       })
     }
 
-    return error
+    return error === ''
   }
 
   // 鏇存柊閰嶇疆淇℃伅
@@ -253,8 +264,6 @@
             <Collapse accordion defaultActiveKey="basedata" bordered={false}>
               {/* 鍩烘湰淇℃伅 */}
               <Panel header="鍩烘湰淇℃伅" key="basedata">
-                {/* 鑿滃崟淇℃伅 */}
-                <MenuForm config={config} updateConfig={this.updateConfig}/>
                 {/* 琛ㄥ悕娣诲姞 */}
                 <TableComponent config={config} updatetable={this.updatetable}/>
               </Panel>

--
Gitblit v1.8.0