| | |
| | | import { is, fromJS } from 'immutable' |
| | | import moment from 'moment' |
| | | import HTML5Backend from 'react-dnd-html5-backend' |
| | | import { ConfigProvider, notification, Modal, Collapse, Card, Switch, Button, Typography, Spin } from 'antd' |
| | | import { notification, Modal, Collapse, Card, Switch, Button, Typography, Spin } from 'antd' |
| | | import { DoubleLeftOutlined, DoubleRightOutlined, EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons' |
| | | import html2canvas from 'html2canvas' |
| | | import md5 from 'md5' |
| | | |
| | | import Api from '@/api' |
| | | import Utils, { setGLOBFuncs } from '@/utils/utils.js' |
| | | import antdZhCN from 'antd/es/locale/zh_CN' |
| | | import Utils from '@/utils/utils.js' |
| | | import { langs } from '@/store/options' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import { getTables, getFuncsAndInters } from '@/utils/utils-custom.js' |
| | | import { getTables, getFuncsAndInters, getLangTrans } from '@/utils/utils-custom.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | |
| | | import '@/assets/css/design.scss' |
| | |
| | | const { Panel } = Collapse |
| | | const { confirm } = Modal |
| | | const { Paragraph } = Typography |
| | | const _locale = antdZhCN |
| | | |
| | | const MenuForm = asyncComponent(() => import('./menuform')) |
| | | const HomeForm = asyncComponent(() => import('./homeform')) |
| | |
| | | eyeopen: false, |
| | | view: '', |
| | | popConfig: null, |
| | | langName: '', |
| | | needUpdate: false |
| | | } |
| | | |
| | |
| | | |
| | | sessionStorage.setItem('MenuType', param.MenuType || 'custom') |
| | | |
| | | if (param.lang) { |
| | | sessionStorage.setItem('lang', param.lang) |
| | | } |
| | | |
| | | this.setState({ |
| | | MenuType: param.MenuType, |
| | | MenuId: param.MenuId || param.MenuID, |
| | | ParentId: param.ParentId || '', |
| | | MenuName: param.MenuName || '', |
| | | MenuNo: param.MenuNo || '', |
| | | langName: sessionStorage.getItem('lang') !== 'zh-CN' && langs[sessionStorage.getItem('lang')] ? `(${langs[sessionStorage.getItem('lang')]})` : '' |
| | | }, () => { |
| | | this.getMenuParam() |
| | | }) |
| | |
| | | MKEmitter.addListener('changeEditMenu', this.changeEditMenu) |
| | | setTimeout(() => { |
| | | this.getRoleFields() |
| | | setGLOBFuncs() |
| | | // setGLOBFuncs() |
| | | }, 1000) |
| | | |
| | | document.onkeydown = (event) => { |
| | |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } else if (this.checklog()) { |
| | | if (sessionStorage.getItem('langList') && !config.trans) { |
| | | |
| | | } else { |
| | | notification.success({ |
| | | top: 92, |
| | | message: '当前配置未修改,无需保存。', |
| | | duration: 5 |
| | | }) |
| | | MKEmitter.emit('completeSave') |
| | | return |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | } else { |
| | | let urlparam = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) |
| | | urlparam.type = 'admin' |
| | | urlparam.lang = sessionStorage.getItem('lang') |
| | | |
| | | url = window.btoa(window.encodeURIComponent(JSON.stringify(urlparam))) |
| | | config.tbkey = key |
| | | } |
| | | |
| | | let interfaces = getFuncsAndInters(config) |
| | | let urlFields = config.urlFields ? config.urlFields.join(',') : '' |
| | | let langSql = getLangTrans(config) |
| | | |
| | | let param = { |
| | | func: 'sPC_TrdMenu_AddUpt', |
| | |
| | | MenuName: config.MenuName || '', |
| | | PageParam: JSON.stringify({Template: 'CustomPage', OpenType: config.OpenType || 'newtab', hidden: config.hidden || 'false', menuColor: config.menuColor || '', interfaces, urlFields}), |
| | | open_edition: config.open_edition, |
| | | LText: '', |
| | | LTexttb: '', |
| | | // LText: '', |
| | | // LTexttb: '', |
| | | debug_md5: key, |
| | | debug_url: url, |
| | | debug_list: window.btoa(tbs), |
| | | LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(config))) |
| | | } |
| | | |
| | | if (langSql) { |
| | | param.lang_translation = window.btoa(window.encodeURIComponent(langSql)) |
| | | } |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | |
| | | } |
| | | |
| | | render () { |
| | | const { view, comloading, MenuType, MenuId, config, settingshow, ParentId, menuloading, eyeopen, needUpdate } = this.state |
| | | const { view, comloading, MenuType, MenuId, config, settingshow, ParentId, menuloading, eyeopen, needUpdate, langName } = this.state |
| | | |
| | | return ( |
| | | <ConfigProvider locale={_locale}> |
| | | <Header menuName={config ? config.MenuName : ''}/> |
| | | <> |
| | | <Header menuName={config ? config.MenuName + langName : ''}/> |
| | | <DndProvider backend={HTML5Backend}> |
| | | {view !== 'popview' ? <div className={'pc-menu-view ' + (MenuType || '')}> |
| | | <div className="menu-body"> |
| | |
| | | <PasteController insert={this.insert} /> |
| | | {config ? <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={config.enabled} onChange={this.onEnabledChange} /> : null} |
| | | <Button type="primary" id="save-config" className={needUpdate ? 'update-tip' : ''} onClick={this.submitConfig} loading={menuloading}>保存</Button> |
| | | <Button type="default" onClick={this.closeView}>关闭</Button> |
| | | <Button type="default" disabled={menuloading} onClick={this.closeView}>关闭</Button> |
| | | </div> |
| | | } style={{ width: '100%' }}> |
| | | {config && !comloading ? <MenuShell menu={config} handleList={this.updateConfig} /> : <Spin className="loading-config" size="large" />} |
| | |
| | | <ModalController /> |
| | | <StyleController /> |
| | | <StyleCombController /> |
| | | </ConfigProvider> |
| | | </> |
| | | ) |
| | | } |
| | | } |