| | |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import { getModalForm } from '@/templates/zshare/formconfig' |
| | | |
| | | import SourceElement from './dragelement/source' |
| | |
| | | |
| | | const { Panel } = Collapse |
| | | const { confirm } = Modal |
| | | const CommonDict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | |
| | | const Versions = asyncComponent(() => import('@/menu/versions')) |
| | | const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) |
| | |
| | | |
| | | state = { |
| | | menu: null, // 上级菜单,三级菜单或标签 |
| | | dict: CommonDict, // 字典 |
| | | config: null, // 页面配置,包括模板类型、模态框设置、添加表名、表单列表 |
| | | visible: false, // 表单编辑模态框,显示控制 |
| | | modalformlist: null, // 基本信息表单字段 |
| | |
| | | { |
| | | type: 'text', |
| | | key: 'supMenu', |
| | | label: this.state.dict['model.super'] + this.state.dict['model.menu'], |
| | | label: '上级菜单', |
| | | initVal: _menu.MenuName, |
| | | required: true, |
| | | readonly: true |
| | |
| | | |
| | | render () { |
| | | const { editAction } = this.props |
| | | const { config, dict, openEdition } = this.state |
| | | const { config, openEdition } = this.state |
| | | |
| | | if (!config) return null |
| | | |
| | |
| | | <DndProvider backend={HTML5Backend}> |
| | | <div className="tools"> |
| | | <Collapse accordion defaultActiveKey="1" bordered={false}> |
| | | <Panel forceRender={true} header={dict['header.menu.basedata']} key="0" id="modal-basedata"> |
| | | <MenuForm |
| | | dict={dict} |
| | | formlist={this.state.modalformlist} |
| | | /> |
| | | <Panel forceRender={true} header="基本信息" key="0" id="modal-basedata"> |
| | | <MenuForm formlist={this.state.modalformlist}/> |
| | | {/* 表名添加 */} |
| | | <TableComponent |
| | | config={config} |
| | |
| | | updatetable={this.updateconfig} |
| | | /> |
| | | </Panel> |
| | | <Panel header={dict['header.menu.form']} key="1"> |
| | | <Panel header="表单" key="1"> |
| | | <div className="search-element"> |
| | | {SearchItems.map((item, index) => { |
| | | return (<SourceElement key={index} content={item}/>) |
| | |
| | | <Button type="danger" onClick={this.clearConfig}>清空</Button> |
| | | <Versions MenuId={editAction.uuid} open_edition={openEdition} updateConfig={this.refreshConfig}/> |
| | | <ReplaceField type="form" config={config} updateConfig={this.updateconfig}/> |
| | | <EditComponent dict={dict} options={['form']} config={this.state.config} plusFields={this.plusFields}/> |
| | | <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>{dict['model.save']}</Button> |
| | | <Button onClick={this.cancelConfig}>{dict['model.back']}</Button> |
| | | <EditComponent options={['form']} config={this.state.config} plusFields={this.plusFields}/> |
| | | <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>保存</Button> |
| | | <Button onClick={this.cancelConfig}>返回</Button> |
| | | </div> |
| | | } style={{ width: '100%' }}> |
| | | <SettingOutlined onClick={this.changeSetting} /> |
| | |
| | | <Button className="mk-cols-change" onClick={() => this.changecols(2)}>2列</Button> |
| | | <Button className="mk-cols-change" onClick={() => this.changecols(3)}>3列</Button> |
| | | <Button className="mk-cols-change" onClick={() => this.changecols(4)}>4列</Button> |
| | | <Switch checkedChildren={dict['model.switch.open']} unCheckedChildren={dict['model.switch.close']} defaultChecked={this.state.showField} onChange={(val) => this.setState({showField: val})} /> |
| | | <Switch checkedChildren="开" unCheckedChildren="关" defaultChecked={this.state.showField} onChange={(val) => this.setState({showField: val})} /> |
| | | </div> |
| | | <div className="ant-modal-body"> |
| | | <div className="modal-form"> |
| | |
| | | list={config.fields} |
| | | setting={config.setting} |
| | | showField={this.state.showField} |
| | | placeholder={dict['header.form.modal.placeholder']} |
| | | handleList={this.handleList} |
| | | handleForm={this.handleForm} |
| | | closeForm={this.closeForm} |
| | |
| | | <div className="ant-modal-footer"> |
| | | <div> |
| | | <button type="button" className="ant-btn"> |
| | | <span>{dict['model.cancel']}</span> |
| | | <span>取消</span> |
| | | </button> |
| | | <button type="button" className="ant-btn ant-btn-primary"> |
| | | <span>{dict['model.confirm']}</span> |
| | | <span>确定</span> |
| | | </button> |
| | | </div> |
| | | <div className="action-mask"></div> |
| | |
| | | </div> |
| | | </DndProvider> |
| | | <Modal |
| | | title={dict['model.edit']} |
| | | title="编辑" |
| | | visible={this.state.visible} |
| | | width={950} |
| | | maskClosable={false} |
| | |
| | | destroyOnClose |
| | | > |
| | | <ModalForm |
| | | dict={dict} |
| | | card={this.state.card} |
| | | formlist={this.state.formlist} |
| | | inputSubmit={this.handleSubmit} |
| | |
| | | /> |
| | | </Modal> |
| | | <Modal |
| | | title={dict['model.edit']} |
| | | title="编辑" |
| | | visible={this.state.settingVisible} |
| | | width={900} |
| | | maskClosable={false} |
| | |
| | | visible={this.state.closeVisible} |
| | | onCancel={() => { this.setState({closeVisible: false}) }} |
| | | footer={[ |
| | | <Button key="save" className="mk-btn mk-green" loading={this.state.closeloading} onClick={this.submitConfig}>{dict['model.save']}</Button>, |
| | | <Button key="confirm" className="mk-btn mk-yellow" onClick={this.handleViewBack}>{dict['model.notsave']}</Button>, |
| | | <Button key="cancel" onClick={() => { this.setState({closeVisible: false}) }}>{dict['model.cancel']}</Button> |
| | | <Button key="save" className="mk-btn mk-green" loading={this.state.closeloading} onClick={this.submitConfig}>保存</Button>, |
| | | <Button key="confirm" className="mk-btn mk-yellow" onClick={this.handleViewBack}>不保存</Button>, |
| | | <Button key="cancel" onClick={() => { this.setState({closeVisible: false}) }}>取消</Button> |
| | | ]} |
| | | destroyOnClose |
| | | > |
| | | {dict['header.menu.config.placeholder']} |
| | | 配置已修改,是否保存配置信息? |
| | | </Modal> |
| | | <StyleController /> |
| | | </div> |