| | |
| | | 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 |
| | |
| | | originConfig: null, // 原始菜单 |
| | | sqlVerifing: false, // sql验证 |
| | | showField: false, // 显示表单字段值 |
| | | standardform: null |
| | | standardform: null, |
| | | saving: false |
| | | } |
| | | |
| | | /** |
| | |
| | | }) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('completeSave', this.completeSave) |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新 |
| | | */ |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('completeSave', this.completeSave) |
| | | } |
| | | |
| | | /** |
| | |
| | | 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 = () => { |
| | |
| | | } |
| | | |
| | | render () { |
| | | const { config, dict } = this.state |
| | | const { config, dict, saving } = this.state |
| | | |
| | | return ( |
| | | <div className="modal-form-board"> |
| | |
| | | <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%' }}> |