| | |
| | | |
| | | 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 '@/templates/modalconfig/dragelement/source' |
| | |
| | | |
| | | const { Panel } = Collapse |
| | | const { confirm } = Modal |
| | | const CommonDict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | const PasteComponent = asyncComponent(() => import('./pastecomponent')) |
| | | const ModalForm = asyncComponent(() => import('@/templates/zshare/modalform')) |
| | | const DragElement = asyncComponent(() => import('@/mob/components/formdragelement')) |
| | |
| | | } |
| | | |
| | | state = { |
| | | dict: CommonDict, // 字典 |
| | | config: null, // 页面配置,包括模板类型、模态框设置、添加表名、表单列表 |
| | | visible: false, // 表单编辑模态框,显示控制 |
| | | formlist: null, // 表单编辑模态框,可编辑字段 |
| | |
| | | |
| | | render () { |
| | | const { btn } = this.props |
| | | const { config, dict, saving } = this.state |
| | | const { config, saving } = this.state |
| | | |
| | | return ( |
| | | <div className="mob-form-board"> |
| | | <DndProvider backend={HTML5Backend}> |
| | | <div className="tools"> |
| | | <Collapse accordion defaultActiveKey="1" bordered={false}> |
| | | <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 onClick={this.cancelConfig}>返回</Button> |
| | | <PasteComponent config={config} updateConfig={this.insert} /> |
| | | <Button type="danger" onClick={this.clearConfig}>清空</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="setting"> |
| | | <div className="mob-shell" style={{width: window.GLOB.shellWidth, height: window.GLOB.shellHeight}}> |
| | |
| | | list={config.fields} |
| | | setting={config.setting} |
| | | showField={this.state.showField} |
| | | placeholder={this.state.dict['header.form.modal.placeholder']} |
| | | handleList={this.handleList} |
| | | handleForm={this.handleForm} |
| | | closeForm={this.closeForm} |
| | |
| | | </div> |
| | | </DndProvider> |
| | | <Modal |
| | | title={this.state.dict['model.edit']} |
| | | title="编辑" |
| | | visible={this.state.visible} |
| | | width={950} |
| | | maskClosable={false} |
| | |
| | | destroyOnClose |
| | | > |
| | | <ModalForm |
| | | dict={this.state.dict} |
| | | card={this.state.card} |
| | | formlist={this.state.formlist} |
| | | inputSubmit={this.handleSubmit} |
| | |
| | | /> |
| | | </Modal> |
| | | <Modal |
| | | title={this.state.dict['model.edit']} |
| | | title="编辑" |
| | | visible={this.state.settingVisible} |
| | | width={900} |
| | | maskClosable={false} |
| | |
| | | > |
| | | <SettingForm |
| | | config={config} |
| | | dict={this.state.dict} |
| | | isSubTab={!!this.props.editTab} |
| | | inputSubmit={this.settingSave} |
| | | wrappedComponentRef={(inst) => this.settingRef = inst} |