| | |
| | | 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' |
| | | |
| | |
| | | curgroup: null, // 当前组,新建或编辑 |
| | | optionLibs: null, // 自定义下拉选项库 |
| | | sources: null, // 表单类型 |
| | | pasteVisible: null, // 表单粘贴 |
| | | sqlVerifing: false, // sql验证 |
| | | openEdition: '' // 编辑版本标记,防止多人操作 |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | 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 |
| | | } |
| | | |
| | | /** |
| | | * @description 编辑功能完成更新,包括解冻按钮、粘贴、替换等 |
| | | */ |
| | | updateConfig = (res) => { |
| | | if (res.type === 'paste') { |
| | | this.setState({ |
| | | config: _config, |
| | | pasteVisible: null |
| | | }, () => { |
| | | this.handleForm(res, 'edit') |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '配置信息格式错误!', |
| | | duration: 10 |
| | | config: res.content |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | render () { |
| | |
| | | <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> |
| | |
| | | <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 => { |
| | |
| | | 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> |