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/mob/modalconfig/index.jsx | 28 +++++++++++++++++++--------- 1 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/mob/modalconfig/index.jsx b/src/mob/modalconfig/index.jsx index fc634fd..6876fc5 100644 --- a/src/mob/modalconfig/index.jsx +++ b/src/mob/modalconfig/index.jsx @@ -15,6 +15,7 @@ import SourceElement from '@/templates/modalconfig/dragelement/source' import SettingForm from '@/templates/modalconfig/settingform' import asyncComponent from '@/utils/asyncComponent' +import MKEmitter from '@/utils/events.js' import { SearchItems } from './source' import './index.scss' @@ -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,11 @@ this.setState = () => { return } + MKEmitter.removeListener('completeSave', this.completeSave) + } + + completeSave = () => { + this.setState({saving: false}) } /** @@ -288,13 +299,12 @@ 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) } cancelConfig = () => { @@ -374,7 +384,7 @@ } render () { - const { config, dict } = this.state + const { config, dict, saving } = this.state return ( <div className="mob-form-board"> @@ -397,7 +407,7 @@ </div> <div className="modal-control"> <Button icon="setting" onClick={this.changeSetting}>璁剧疆</Button> - <Button type="primary" onClick={this.submitConfig}>淇濆瓨</Button> + <Button type="primary" loading={saving} onClick={this.submitConfig}>淇濆瓨</Button> <Button onClick={this.cancelConfig}>杩斿洖</Button> <PasteComponent config={config} updateConfig={this.insert} /> <Switch checkedChildren={dict['model.switch.open']} unCheckedChildren={dict['model.switch.close']} defaultChecked={this.state.showField} onChange={(val) => this.setState({showField: val})} /> -- Gitblit v1.8.0