From 2a347c8d91d6962f4302f0553c55a3b9f743baa5 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 09 九月 2020 21:15:58 +0800 Subject: [PATCH] 2020-09-09 --- src/templates/modalconfig/index.jsx | 67 +++++---------------------------- 1 files changed, 11 insertions(+), 56 deletions(-) diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx index 6659705..954a46a 100644 --- a/src/templates/modalconfig/index.jsx +++ b/src/templates/modalconfig/index.jsx @@ -15,13 +15,13 @@ import { queryTableSql } from '@/utils/option.js' import ModalForm from '@/templates/zshare/modalform' -import PasteForm from '@/templates/zshare/pasteform' import DragElement from './dragelement' import SourceElement from './dragelement/source' import SettingForm from './settingform' import GroupForm from './groupform' import EditCard from './editcard' import MenuForm from './menuform' +import EditComponent from '@/templates/zshare/editcomponent' import { BaseConfig, SearchItems } from './source' import './index.scss' @@ -68,7 +68,6 @@ curgroup: null, // 褰撳墠缁勶紝鏂板缓鎴栫紪杈� optionLibs: null, // 鑷畾涔変笅鎷夐�夐」搴� sources: null, // 琛ㄥ崟绫诲瀷 - pasteVisible: null, // 琛ㄥ崟绮樿创 sqlVerifing: false, // sql楠岃瘉 openEdition: '' // 缂栬緫鐗堟湰鏍囪锛岄槻姝㈠浜烘搷浣� } @@ -1217,44 +1216,15 @@ } } - pasteSubmit = () => { - let _config = JSON.parse(JSON.stringify(this.state.config)) - - this.pasteFormRef.handleConfirm().then(res => { - if (res.copyType === 'form') { - if (_config.groups.length > 0) { - _config.groups.forEach(group => { - if (group.default) { - group.sublist.push(res) - } - }) - } else { - _config.fields.push(res) - } - - if (!this.props.editTab && res.type === 'linkMain') { - notification.warning({ - top: 92, - message: '涓嶆敮鎸佹琛ㄥ崟绫诲瀷锛�', - duration: 10 - }) - return - } - - this.setState({ - config: _config, - pasteVisible: null - }, () => { - this.handleForm(res, 'edit') - }) - } else { - notification.warning({ - top: 92, - message: '閰嶇疆淇℃伅鏍煎紡閿欒锛�', - duration: 10 - }) - } - }) + /** + * @description 缂栬緫鍔熻兘瀹屾垚鏇存柊锛屽寘鎷В鍐绘寜閽�佺矘璐淬�佹浛鎹㈢瓑 + */ + updateConfig = (res) => { + if (res.type === 'paste') { + this.setState({ + config: res.content + }) + } } render () { @@ -1317,6 +1287,7 @@ <div className="setting"> <Card title={this.state.dict['header.menu.form.configurable']} bordered={false} extra={ <div> + <EditComponent dict={this.state.dict} type="form" config={this.state.config} refresh={this.updateConfig}/> <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['model.save']}</Button> <Button onClick={this.cancelConfig}>{this.state.dict['model.back']}</Button> </div> @@ -1330,7 +1301,6 @@ <div className="ant-modal-title">{config.setting.title}</div> </div> <div className="ant-modal-body"> - <Icon className="paste-Icon" type="snippets" title={this.state.dict['header.form.paste']} onClick={() => {this.setState({pasteVisible: true})}} /> <div className="modal-form"> {config.groups.length > 0 && config.groups.map(group => { @@ -1471,21 +1441,6 @@ group={this.state.curgroup} inputSubmit={this.handleGroupSave} wrappedComponentRef={(inst) => this.groupRef = inst} - /> - </Modal> - {/* 鎸夐挳閰嶇疆淇℃伅绮樿创澶嶅埗 */} - <Modal - title={this.state.dict['header.form.paste']} - visible={this.state.pasteVisible} - width={600} - maskClosable={false} - onOk={this.pasteSubmit} - onCancel={() => {this.setState({pasteVisible: null})}} - destroyOnClose - > - <PasteForm - dict={this.state.dict} - wrappedComponentRef={(inst) => this.pasteFormRef = inst} /> </Modal> </div> -- Gitblit v1.8.0