| | |
| | | import { DndProvider } from 'react-dnd' |
| | | import { withRouter } from 'react-router' |
| | | import { is, fromJS } from 'immutable' |
| | | import moment from 'moment' |
| | | import HTML5Backend from 'react-dnd-html5-backend' |
| | | import { ConfigProvider, notification, Modal, Collapse, Switch, Button, message, Spin, Typography } from 'antd' |
| | | import { DoubleLeftOutlined, DoubleRightOutlined, HomeOutlined, LoginOutlined, RedoOutlined, ArrowLeftOutlined, EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | import md5 from 'md5' |
| | | |
| | | import Api from '@/api' |
| | | import Utils, { setGLOBFuncs } from '@/utils/utils.js' |
| | | import zhCN from '@/locales/zh-CN/mob.js' |
| | | import enUS from '@/locales/en-US/mob.js' |
| | | import antdEnUS from 'antd/es/locale/en_US' |
| | | // import antdEnUS from 'antd/es/locale/en_US' |
| | | import antdZhCN from 'antd/es/locale/zh_CN' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import MenuUtils from '@/utils/utils-custom.js' |
| | |
| | | const ViewNodes = asyncComponent(() => import('@/menu/viewnodes')) |
| | | const SourceWrap = asyncComponent(() => import('@/pc/modulesource')) |
| | | const Modulecell = asyncComponent(() => import('@/menu/modulecell')) |
| | | const TableNodes = asyncComponent(() => import('@/menu/tablenodes')) |
| | | const CreateView = asyncComponent(() => import('@/pc/createview')) |
| | | const BgController = asyncComponent(() => import('@/pc/bgcontroller')) |
| | | const Quotecomponent = asyncComponent(() => import('@/pc/quotecomponent')) |
| | |
| | | |
| | | class MenuDesign extends Component { |
| | | state = { |
| | | localedict: sessionStorage.getItem('lang') !== 'en-US' ? antdZhCN : antdEnUS, |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | loading: true, |
| | | MenuId: '', |
| | |
| | | |
| | | if (param.type === 'app') { |
| | | sessionStorage.setItem('appId', param.ID || '') |
| | | sessionStorage.setItem('appName', param.remark || '') |
| | | sessionStorage.setItem('lang', param.lang || 'zh-CN') |
| | | sessionStorage.setItem('kei_no', param.kei_no || '') |
| | | sessionStorage.setItem('role_type', param.role_type || 'true') |
| | | sessionStorage.setItem('login_types', param.login_types || 'false') |
| | | sessionStorage.setItem('sysBgColor', param.sysBgColor || '#ffffff') |
| | | |
| | | this.setState({ |
| | | localedict: sessionStorage.getItem('lang') !== 'en-US' ? antdZhCN : antdEnUS, |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | }) |
| | | this.getAppMessage(param.MenuID) |
| | |
| | | }) |
| | | } |
| | | |
| | | getMenuMessage = () => { |
| | | getMenuMessage = (tbs) => { |
| | | const { config } = this.state |
| | | let nodes = {type: 'view', version: '1.0', key: config.uuid, title: config.MenuName, children: []} |
| | | let popviews = [] |
| | |
| | | let traversal = (components) => { |
| | | let list = [] |
| | | components.forEach(item => { |
| | | if (item.$tables) { |
| | | tbs.push(...item.$tables) |
| | | } |
| | | |
| | | let m = { |
| | | key: item.uuid, |
| | | title: item.name, |
| | |
| | | config.enabled = false |
| | | } |
| | | |
| | | let roleParam = this.getMenuMessage() |
| | | let tbs = [] |
| | | let roleParam = this.getMenuMessage(tbs) |
| | | |
| | | let subMenus = this.getSubMenus() |
| | | let menus_used_list = subMenus.map(m => `'${config.uuid}','${config.MenuName || ''}','${config.MenuNo || ''}','${m.MenuID}','${m.MenuName}'`).join(';') |
| | | menus_used_list = window.btoa(window.encodeURIComponent(menus_used_list || 'del')) |
| | | |
| | | let arr = [] |
| | | tbs = tbs.filter(tb => { |
| | | let _tb = tb.toLowerCase() |
| | | |
| | | if (arr.includes(_tb)) return false |
| | | arr.push(_tb) |
| | | |
| | | return true |
| | | }) |
| | | tbs.sort() |
| | | if (tbs.length && sessionStorage.getItem('mk_tb_names')) { |
| | | let names = sessionStorage.getItem('mk_tb_names') |
| | | tbs = tbs.filter(tb => names.indexOf(',' + tb.toLowerCase() + ',') > -1) |
| | | } |
| | | tbs = tbs.map(tb => `'${tb}'`).join(';') |
| | | |
| | | let key = md5(config.uuid + sessionStorage.getItem('kei_no') + 'pc' + sessionStorage.getItem('lang') + tbs.toLowerCase()) |
| | | let url = '' |
| | | |
| | | if (config.tbkey === key) { |
| | | key = '' |
| | | } else { |
| | | let urlparam = { |
| | | type: 'app', |
| | | MenuID: config.uuid, |
| | | ID: sessionStorage.getItem('appId') || '', |
| | | remark: sessionStorage.getItem('appName') || '', |
| | | lang: sessionStorage.getItem('lang') || '', |
| | | kei_no: sessionStorage.getItem('kei_no') || '', |
| | | typename: 'pc', |
| | | sysBgColor: sessionStorage.getItem('sysBgColor') || '', |
| | | MenuName: config.MenuName || '', |
| | | } |
| | | |
| | | url = window.btoa(window.encodeURIComponent(JSON.stringify(urlparam))) |
| | | config.tbkey = key |
| | | } |
| | | |
| | | let param = { |
| | | func: 'sPC_TrdMenu_AddUpt', |
| | |
| | | open_edition: config.open_edition, |
| | | LText: '', |
| | | LTexttb: '', |
| | | menus_used_list |
| | | menus_used_list, |
| | | debug_md5: key, |
| | | debug_url: url, |
| | | debug_list: window.btoa(tbs) |
| | | } |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | |
| | | } |
| | | |
| | | render () { |
| | | const { localedict, loading, comloading, activeKey, settingshow, controlshow, dict, MenuId, config, menuloading, customComponents, eyeopen } = this.state |
| | | const { loading, comloading, activeKey, settingshow, controlshow, dict, MenuId, config, menuloading, customComponents, eyeopen } = this.state |
| | | |
| | | return ( |
| | | <ConfigProvider locale={localedict}> |
| | | <ConfigProvider locale={antdZhCN}> |
| | | <div className={'mk-pc-view '} id="mk-pc-design-view"> |
| | | {loading ? <Spin className="view-spin" size="large" /> : null} |
| | | <DndProvider backend={HTML5Backend}> |
| | |
| | | <Button className="mk-border-purple" onClick={() => this.setState({eyeopen: !eyeopen})}>{!eyeopen ? <EyeOutlined /> : <EyeInvisibleOutlined />} 组件名</Button> |
| | | <CreateView resetmenu={this.getAppMenus} /> |
| | | <PasteController insert={this.insert} /> |
| | | <TableNodes config={config} /> |
| | | <ViewNodes config={config} MenuId={MenuId}/> |
| | | <SysInterface config={config} updateConfig={this.updateConfig}/> |
| | | <PictureController/> |