king
2021-08-26 e9c48bd7356462ba9257540b130a47a65ad1861d
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})} />