| | |
| | | import { is, fromJS } from 'immutable' |
| | | import HTML5Backend from 'react-dnd-html5-backend' |
| | | import { notification, Modal, Collapse, Switch, Button, message, Spin, Typography } from 'antd' |
| | | import { DoubleLeftOutlined, DoubleRightOutlined, HomeOutlined, LoginOutlined, ArrowLeftOutlined, EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons' |
| | | import { DoubleLeftOutlined, DoubleRightOutlined, HomeOutlined, LoginOutlined, ArrowLeftOutlined, EyeOutlined, EyeInvisibleOutlined, CopyOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | import md5 from 'md5' |
| | | |
| | |
| | | insert = (item) => { |
| | | let config = fromJS(this.state.config).toJS() |
| | | |
| | | config.components.push(item) |
| | | if (item.copyType === 'components') { |
| | | config.components.push(...item.components) |
| | | if (!config.interfaces) { |
| | | config.interfaces = item.interfaces |
| | | } else { |
| | | config.interfaces.push(...item.interfaces) |
| | | } |
| | | } else { |
| | | config.components.push(item) |
| | | } |
| | | |
| | | this.setState({config}) |
| | | window.GLOB.customMenu = config |
| | |
| | | return is(fromJS(oriConfig), fromJS(config)) |
| | | } |
| | | |
| | | copyMenu = () => { |
| | | const { config } = this.state |
| | | |
| | | if (!config.enabled) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '菜单未启用,不可复制。', |
| | | duration: 5 |
| | | }) |
| | | } else { |
| | | let msg = { copyType: 'components', type: 'pc' } |
| | | |
| | | msg.components = [] |
| | | msg.interfaces = config.interfaces || [] |
| | | |
| | | config.components.forEach(item => { |
| | | if (item.type === 'navbar') return |
| | | |
| | | msg.components.push(item) |
| | | }) |
| | | |
| | | if (msg.components.length === 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '未添加组件,不可复制。', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | try { |
| | | msg = window.btoa(window.encodeURIComponent(JSON.stringify(msg))) |
| | | } catch (e) { |
| | | console.warn('Stringify Failure') |
| | | msg = '' |
| | | } |
| | | |
| | | let oInput = document.createElement('input') |
| | | oInput.value = msg |
| | | document.body.appendChild(oInput) |
| | | oInput.select() |
| | | document.execCommand('Copy') |
| | | document.body.removeChild(oInput) |
| | | message.success('复制成功。') |
| | | } |
| | | } |
| | | |
| | | updateLogConfig = (config) => { |
| | | config.open_edition = this.state.config.open_edition || '' |
| | | |
| | |
| | | <UrlFieldComponent config={config} updateConfig={this.updateConfig}/> |
| | | {/* 表名添加 */} |
| | | <TableComponent config={config} updatetable={this.updateConfig}/> |
| | | <Paragraph style={{padding: '15px 0px 0px 18px'}} copyable={{ text: MenuId }}>菜单ID</Paragraph> |
| | | <Paragraph style={{padding: '15px 0px 0px 37px'}} copyable={{ text: MenuId }}>菜单ID</Paragraph> |
| | | <Paragraph style={{padding: '0px 0px 0px 18px'}}>菜单组件:<CopyOutlined onClick={this.copyMenu} style={{cursor: 'pointer', color: '#1890ff'}} /></Paragraph> |
| | | <NormalCss config={config} updateConfig={this.updateConfig}/> |
| | | </> : null} |
| | | </Panel> |
| | |
| | | {config ? <Debug config={config}/> : null} |
| | | <Button className="mk-border-purple" onClick={() => this.setState({eyeopen: !eyeopen})}>{!eyeopen ? <EyeOutlined /> : <EyeInvisibleOutlined />} 组件名</Button> |
| | | <CreateView resetmenu={this.getAppMenus} /> |
| | | <PasteController insert={this.insert} /> |
| | | <PasteController vType="pc" insert={this.insert} /> |
| | | <TableNodes config={config} /> |
| | | <ViewNodes config={config} MenuId={MenuId}/> |
| | | <SysInterface config={config} updateConfig={this.updateConfig}/> |