| | |
| | | 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 } from '@ant-design/icons' |
| | | import { DoubleLeftOutlined, DoubleRightOutlined, HomeOutlined, LoginOutlined, RedoOutlined, ArrowLeftOutlined } from '@ant-design/icons' |
| | | |
| | | import Api from '@/api' |
| | | import Utils, { setGLOBFuncs } from '@/utils/utils.js' |
| | |
| | | import MKEmitter from '@/utils/events.js' |
| | | import MenuUtils from '@/utils/utils-custom.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import backurl from '@/assets/img/back.jpg' |
| | | |
| | | import './index.scss' |
| | | |
| | |
| | | let param = { |
| | | MenuID: menu.MenuID, |
| | | copyMenuId: menu.copyMenuId || '', |
| | | clearMenu: menu.clearMenu !== 'false', |
| | | type: 'view' |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | } else { |
| | | config.components = MenuUtils.resetConfig(config.components) |
| | | config.components = MenuUtils.resetConfig(config.components, {}, urlParam.clearMenu) |
| | | config.enabled = false |
| | | message.success('复制成功,保存后生效。') |
| | | } |
| | |
| | | const { config } = this.state |
| | | |
| | | let traversal = (components) => { |
| | | let list = components.map(item => { |
| | | let list = [] |
| | | components.forEach(item => { |
| | | let m = { |
| | | key: item.uuid, |
| | | title: item.name, |
| | | children: [] |
| | | } |
| | | |
| | | if (item.type === 'topbar' || item.type === 'login' || item.type === 'navbar') { |
| | | if (item.type === 'topbar' || item.type === 'login' || item.type === 'navbar' || (item.type === 'menubar' && item.subtype === 'commonbar')) { |
| | | return null |
| | | } else if (item.type === 'tabs') { |
| | | let tabs = [] |
| | | let mm = [] |
| | | item.subtabs.forEach(tab => { |
| | | let s = traversal(tab.components) |
| | | |
| | |
| | | title: tab.label, |
| | | children: s |
| | | }) |
| | | |
| | | mm.push(...s) |
| | | }) |
| | | |
| | | if (tabs.length > 0) { |
| | | m.children = tabs |
| | | } |
| | | |
| | | if (item.setting.permission === 'true') { |
| | | list.push(m) |
| | | } else if (mm.length) { |
| | | list.push(...mm) |
| | | } |
| | | |
| | | return null |
| | | } else if (item.type === 'group') { |
| | | m.children = traversal(item.components) |
| | | |
| | | if (item.setting.permission === 'true') { |
| | | list.push(m) |
| | | } else if (m.children.length) { |
| | | list.push(...m.children) |
| | | } |
| | | |
| | | return null |
| | | } if (item.plot && item.plot.permission !== 'true') { |
| | | return null |
| | | } if (item.wrap && item.wrap.permission !== 'true') { |
| | | return null |
| | | } else if (item.type === 'card' || (item.type === 'table' && item.subtype === 'tablecard')) { |
| | | item.action && item.action.forEach(btn => { |
| | | this.checkBtn(btn) |
| | |
| | | }) |
| | | } |
| | | |
| | | return m |
| | | list.push(m) |
| | | }) |
| | | |
| | | list = list.filter(Boolean) |
| | | |
| | | return list |
| | | } |
| | |
| | | config.enabled = false |
| | | } |
| | | |
| | | let roleParam = {type: 'view', key: config.uuid, title: config.MenuName, children: []} |
| | | let roleParam = {type: 'view', version: '1.0', key: config.uuid, title: config.MenuName, children: []} |
| | | roleParam.children = this.getMenuMessage() |
| | | |
| | | if (config.components.findIndex(item => item.type === 'login') > -1) { |
| | | roleParam.login = true |
| | | config.loginview = true |
| | | } else { |
| | | config.loginview = false |
| | | config.tabview = false |
| | | |
| | | if (config.permission !== 'true') { |
| | | roleParam.pass = true |
| | | roleParam.children = [] |
| | | } |
| | | |
| | | config.components.forEach(item => { |
| | | if (item.type === 'login') { |
| | | roleParam.login = true |
| | | roleParam.children = [] |
| | | config.loginview = true |
| | | } else if (item.type === 'navbar') { |
| | | config.tabview = true |
| | | } |
| | | }) |
| | | |
| | | if (adapters.includes('wxmini')) { |
| | | config = this.getMiniStyle(config) |
| | |
| | | |
| | | let roles = { |
| | | type: 'navbar', |
| | | version: '1.0', |
| | | key: item.uuid, |
| | | title: item.name, |
| | | children: [] |
| | | } |
| | | |
| | | if (item.wrap.permission === 'true') { |
| | | roles.children = item.menus.map(menu => { |
| | | return { |
| | | key: menu.MenuID, |
| | | title: menu.name |
| | | } |
| | | }) |
| | | } else { |
| | | roles.pass = true |
| | | } |
| | | |
| | | let _param = { |
| | | func: 'sPC_TrdMenu_AddUpt', |
| | |
| | | } |
| | | |
| | | verifyConfig = (show) => { |
| | | const { config, viewType } = this.state |
| | | const { config } = this.state |
| | | let error = '' |
| | | let searchSum = 0 |
| | | let swipes = [] |
| | |
| | | swipes.push(item.name) |
| | | } |
| | | |
| | | if (['voucher'].includes(item.subtype)) return |
| | | if (['propcard', 'brafteditor', 'sandbox', 'tabbar', 'stepform', 'tabform'].includes(item.subtype) && item.wrap.datatype === 'static') return |
| | | if (['balcony'].includes(item.type) && item.wrap.datatype === 'static') return |
| | | if (['menubar'].includes(item.type) && item.wrap.datatype !== 'dynamic') return |
| | |
| | | |
| | | check(config.components) |
| | | |
| | | if (!error && viewType === 'userbind' && config.components.filter(item => item.type === 'login').length === 0) { |
| | | error = '用户绑定页面必须添加登录。' |
| | | } |
| | | // if (!error && viewType === 'userbind' && config.components.filter(item => item.type === 'login').length === 0) { |
| | | // error = '用户绑定页面必须添加登录。' |
| | | // } |
| | | |
| | | if (!error && searchSum > 1) { |
| | | error = '搜索组件与导航栏的搜索功能不可同时使用。' |
| | |
| | | insert = (item) => { |
| | | let config = fromJS(this.state.config).toJS() |
| | | |
| | | if (item.type === 'topbar' && config.components.findIndex(m => m.type === 'topbar') > -1) { |
| | | if (item.type === 'search') { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '移动端搜索组件不可粘贴!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | if (item.type === 'topbar') { |
| | | if (config.components.findIndex(m => m.type === 'topbar') > -1) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '导航栏不可重复添加!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | if (!config.style.paddingTop) { |
| | | config.style.paddingTop = '50px' |
| | | } |
| | | } |
| | | |
| | | config.components.push(item) |
| | |
| | | <div className="wrap"> |
| | | <Button type="primary" onClick={this.submitConfig} id="save-config" loading={menuloading}>{dict['mob.save']}</Button> |
| | | <Switch className="big" checkedChildren={dict['mob.enable']} unCheckedChildren={dict['mob.disable']} checked={config && config.enabled} onChange={this.onEnabledChange} /> |
| | | <img title="后退" className="back-view" onClick={this.backView} src={backurl} alt=""/> |
| | | <ArrowLeftOutlined title="后退" className="back-view" onClick={this.backView}/> |
| | | <CreateView resetmenu={this.getAppMenus} /> |
| | | <PasteController insert={this.insert} /> |
| | | <StyleCombControlButton menu={config} /> |