From 1a11f7115e61c548f9ffc77d0a9e504307ca71b2 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 24 八月 2021 18:37:20 +0800
Subject: [PATCH] 2021-08-24

---
 src/menu/modalconfig/index.jsx |   28 +++++++++++++++++++---------
 1 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/src/menu/modalconfig/index.jsx b/src/menu/modalconfig/index.jsx
index cf6bab2..7aed763 100644
--- a/src/menu/modalconfig/index.jsx
+++ b/src/menu/modalconfig/index.jsx
@@ -16,6 +16,7 @@
 import SettingForm from '@/templates/modalconfig/settingform'
 import asyncComponent from '@/utils/asyncComponent'
 import { SearchItems } from '@/templates/modalconfig/source'
+import MKEmitter from '@/utils/events.js'
 import './index.scss'
 
 const { Panel } = Collapse
@@ -43,7 +44,8 @@
     originConfig: null,    // 鍘熷鑿滃崟
     sqlVerifing: false,    // sql楠岃瘉
     showField: false,      // 鏄剧ず琛ㄥ崟瀛楁鍊�
-    standardform: null
+    standardform: null,
+    saving: false
   }
 
   /**
@@ -61,6 +63,10 @@
     })
   }
 
+  componentDidMount () {
+    MKEmitter.addListener('completeSave', this.completeSave)
+  }
+
   /**
    * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊
    */
@@ -68,6 +74,7 @@
     this.setState = () => {
       return
     }
+    MKEmitter.removeListener('completeSave', this.completeSave)
   }
 
   /**
@@ -288,13 +295,16 @@
   submitConfig = () => {
     const { config } = this.state
 
-    this.setState({originConfig: fromJS(config).toJS()})
+    this.setState({originConfig: fromJS(config).toJS(), saving: true})
     this.props.handleSave(config)
-    notification.success({
-      top: 92,
-      message: '淇濆瓨鎴愬姛銆�',
-      duration: 2
-    })
+
+    setTimeout(() => {
+      MKEmitter.emit('triggerMenuSave')
+    }, 100)
+  }
+
+  completeSave = () => {
+    this.setState({saving: false})
   }
 
   cancelConfig = () => {
@@ -400,7 +410,7 @@
   }
 
   render () {
-    const { config, dict } = this.state
+    const { config, dict, saving } = this.state
 
     return (
       <div className="modal-form-board">
@@ -425,7 +435,7 @@
             <Card title={dict['header.menu.form.configurable']} bordered={false} extra={
               <div>
                 <EditComponent dict={dict} options={['form']} config={this.state.config} refresh={(res) => this.updateConfig(res.config)}/>
-                <Button type="primary" onClick={this.submitConfig}>淇濆瓨</Button>
+                <Button type="primary" loading={saving} onClick={this.submitConfig}>淇濆瓨</Button>
                 <Button onClick={this.cancelConfig}>杩斿洖</Button>
               </div>
             } style={{ width: '100%' }}>

--
Gitblit v1.8.0