| | |
| | | import { DndProvider } from 'react-dnd' |
| | | import HTML5Backend from 'react-dnd-html5-backend' |
| | | import { Button, Card, Modal, Collapse, notification, Select, List, Icon } from 'antd' |
| | | // import DragElement from './dragelement' |
| | | import DragElement from './dragelement' |
| | | import SourceElement from './dragelement/source' |
| | | import Api from '@/api' |
| | | // import SearchForm from './searchform' |
| | | // import ActionForm from './actionform' |
| | | // import ColumnForm from './columnform' |
| | | // import SettingForm from './settingform' |
| | | import SettingForm from './settingform' |
| | | // import EditCard from './editcard' |
| | | import MenuForm from './menuform' |
| | | import zhCN from '@/locales/zh-CN/comtable.js' |
| | |
| | | UNSAFE_componentWillMount () { |
| | | const {menu, editAction} = this.props |
| | | |
| | | let _config = JSON.parse(JSON.stringify((Source.baseConfig))) |
| | | |
| | | this.setState({ |
| | | // config: _config, |
| | | // selectedTables: _config.tables || [], |
| | | config: _config, |
| | | selectedTables: _config.tables || [], |
| | | modalformlist: [ |
| | | { |
| | | type: 'text', |
| | |
| | | MenuID: 'button', |
| | | text: this.state.dict['header.form.button'] |
| | | }] |
| | | } |
| | | ] |
| | | }) |
| | | } |
| | | |
| | | handleAction = (card) => { |
| | | this.setState({ |
| | | visible: true, |
| | | formtemp: 'action', |
| | | card: card, |
| | | formlist: [ |
| | | { |
| | | type: 'text', |
| | | key: 'label', |
| | | label: this.state.dict['header.form.name'], |
| | | initVal: card.label, |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'OpenType', |
| | | label: this.state.dict['header.form.openType'], |
| | | initVal: card.OpenType, |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'pop', |
| | | text: this.state.dict['header.form.pop'] |
| | | }, { |
| | | MenuID: 'prompt', |
| | | text: this.state.dict['header.form.prompt'] |
| | | }, { |
| | | MenuID: 'exec', |
| | | text: this.state.dict['header.form.exec'] |
| | | }, { |
| | | MenuID: 'tab', |
| | | text: this.state.dict['header.form.tab'] |
| | | }, { |
| | | MenuID: 'blank', |
| | | text: this.state.dict['header.form.blank'] |
| | | }, { |
| | | MenuID: 'newpage', |
| | | text: this.state.dict['header.form.newpage'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'pageTemplate', |
| | | label: this.state.dict['header.form.pageTemplate'], |
| | | initVal: card.pageTemplate, |
| | | required: true, |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'intertype', |
| | | label: this.state.dict['header.form.intertype'], |
| | | initVal: card.intertype, |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'inner', |
| | | text: this.state.dict['header.form.interface.inner'] |
| | | }, { |
| | | MenuID: 'outer', |
| | | text: this.state.dict['header.form.interface.outer'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'innerFunc', |
| | | label: this.state.dict['header.form.innerFunc'], |
| | | initVal: card.innerFunc, |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'interface', |
| | | label: this.state.dict['header.form.interface'], |
| | | initVal: card.interface, |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'outerFunc', |
| | | label: this.state.dict['header.form.outerFunc'], |
| | | initVal: card.outerFunc, |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'Ot', |
| | | label: this.state.dict['header.form.isRequired'], |
| | | initVal: card.Ot, |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'notRequired', |
| | | text: this.state.dict['header.form.notRequired'] |
| | | }, { |
| | | MenuID: 'requiredSgl', |
| | | text: this.state.dict['header.form.requiredSgl'] |
| | | }, { |
| | | MenuID: 'required', |
| | | text: this.state.dict['header.form.required'] |
| | | }, { |
| | | MenuID: 'requiredOnce', |
| | | text: this.state.dict['header.form.requiredOnce'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'callbackFunc', |
| | | label: this.state.dict['header.form.callbackFunc'], |
| | | initVal: card.callbackFunc, |
| | | required: false, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'icon', |
| | | label: this.state.dict['header.form.icon'], |
| | | initVal: card.icon, |
| | | required: false, |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'class', |
| | | label: this.state.dict['header.form.class'], |
| | | initVal: card.class, |
| | | required: false, |
| | | options: [] |
| | | } |
| | | ] |
| | | }) |
| | | } |
| | | |
| | | handleColumn = (card) => { |
| | | this.setState({ |
| | | visible: true, |
| | | formtemp: 'columns', |
| | | card: card, |
| | | formlist: [ |
| | | { |
| | | type: 'text', |
| | | key: 'label', |
| | | label: this.state.dict['header.form.name'], |
| | | initVal: card.label, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'field', |
| | | label: this.state.dict['header.form.field'], |
| | | initVal: card.field, |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'type', |
| | | label: this.state.dict['header.form.type'], |
| | | initVal: card.type, |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'text', |
| | | text: this.state.dict['header.form.text'] |
| | | }, { |
| | | MenuID: 'picture', |
| | | text: this.state.dict['header.form.picture'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'Align', |
| | | label: this.state.dict['header.form.align'], |
| | | initVal: card.Align, |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'left', |
| | | text: this.state.dict['header.form.alignLeft'] |
| | | }, { |
| | | MenuID: 'right', |
| | | text: this.state.dict['header.form.alignRight'] |
| | | }, { |
| | | MenuID: 'center', |
| | | text: this.state.dict['header.form.alignCenter'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | key: 'Hide', |
| | | label: this.state.dict['header.form.Hide'], |
| | | initVal: card.Hide, |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'true', |
| | | text: this.state.dict['header.form.true'] |
| | | }, { |
| | | MenuID: 'false', |
| | | text: this.state.dict['header.form.false'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'IsSort', |
| | | label: this.state.dict['header.form.IsSort'], |
| | | initVal: card.IsSort, |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'true', |
| | | text: this.state.dict['header.form.true'] |
| | | }, { |
| | | MenuID: 'false', |
| | | text: this.state.dict['header.form.false'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'Width', |
| | | decimal: 0, |
| | | label: this.state.dict['header.form.columnWidth'], |
| | | initVal: card.Width, |
| | | required: true |
| | | } |
| | | ] |
| | | }) |
| | |
| | | |
| | | render () { |
| | | return ( |
| | | <div className="common-table-board"> |
| | | <div className="modal-form-board"> |
| | | <DndProvider backend={HTML5Backend}> |
| | | <div className="tools"> |
| | | <Collapse accordion defaultActiveKey="0" bordered={false}> |
| | | <Panel header="基本信息" key="0" id="common-basedata"> |
| | | <Panel header="基本信息" key="0" id="modal-basedata"> |
| | | <MenuForm |
| | | dict={this.state.dict} |
| | | formlist={this.state.modalformlist} |
| | |
| | | value={'请选择表名'} |
| | | onChange={this.onTableChange} |
| | | showArrow={false} |
| | | getPopupContainer={() => document.getElementById('common-basedata')} |
| | | getPopupContainer={() => document.getElementById('modal-basedata')} |
| | | filterOption={(input, option) => { |
| | | return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 |
| | | }} |
| | |
| | | </div> |
| | | } style={{ width: '100%' }}> |
| | | <Icon type="setting" onClick={this.changeSetting} /> |
| | | {/* <div className="search-list"> |
| | | {this.state.config.search && !this.state.searchloading && |
| | | <DragElement |
| | | <div className="search-list"> |
| | | {<DragElement |
| | | list={this.state.config.search} |
| | | type="search" |
| | | placeholder={this.state.dict['header.form.search.placeholder']} |
| | | handleList={this.handleList} |
| | | handleMenu={this.handleSearch} |
| | | />} |
| | | </div> */} |
| | | </div> |
| | | </Card> |
| | | </div> |
| | | </DndProvider> |
| | |
| | | card={this.state.card} |
| | | wrappedComponentRef={(inst) => this.formRef = inst} |
| | | />} |
| | | {this.state.formtemp === 'action' && <ActionForm |
| | | dict={this.state.dict} |
| | | card={this.state.card} |
| | | formlist={this.state.formlist} |
| | | wrappedComponentRef={(inst) => this.formRef = inst} |
| | | />} |
| | | {this.state.formtemp === 'columns' && <ColumnForm |
| | | dict={this.state.dict} |
| | | card={this.state.card} |
| | | formlist={this.state.formlist} |
| | | wrappedComponentRef={(inst) => this.formRef = inst} |
| | | />} |
| | | </Modal> |
| | | <Modal |
| | | title={this.state.dict['header.edit']} |
| | |
| | | {(!this.state.fields || this.state.fields.length === 0) && |
| | | <Empty /> |
| | | } |
| | | </Modal> |
| | | </Modal> */} |
| | | <Modal |
| | | title={this.state.dict['header.edit']} |
| | | visible={this.state.settingVisible} |
| | |
| | | destroyOnClose |
| | | > |
| | | 菜单配置已修改,是否保存配置信息? |
| | | </Modal> */} |
| | | </Modal> |
| | | </div> |
| | | ) |
| | | } |