| | |
| | | const CreateView = asyncComponent(() => import('@/pc/createview')) |
| | | const Transfer = asyncComponent(() => import('@/pc/transfer')) |
| | | const Versions = asyncComponent(() => import('@/menu/versions')) |
| | | const ViewNodes = asyncComponent(() => import('@/menu/viewnodes')) |
| | | const SourceWrap = asyncComponent(() => import('@/mob/modulesource')) |
| | | const BgController = asyncComponent(() => import('@/pc/bgcontroller')) |
| | | const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) |
| | |
| | | viewType: /^userbind/.test(param.MenuID) ? 'userbind' : 'menu' |
| | | }, () => { |
| | | this.getMenuParam(param) |
| | | this.getRelationMenus() |
| | | }) |
| | | } |
| | | } catch (e) { |
| | |
| | | let param = { |
| | | MenuID: menu.MenuID, |
| | | copyMenuId: menu.copyMenuId || '', |
| | | clearMenu: menu.clearMenu !== 'false', |
| | | type: 'view' |
| | | } |
| | | |
| | |
| | | this.getAppMenus() |
| | | } |
| | | |
| | | getRelationMenus = () => { |
| | | const { MenuId } = this.state |
| | | |
| | | let param = { |
| | | func: 's_get_menu_used_list', |
| | | TypeCharOne: sessionStorage.getItem('kei_no'), |
| | | typename: sessionStorage.getItem('typename'), |
| | | par_menuid: MenuId, |
| | | // used_menuid: MenuId |
| | | } |
| | | |
| | | Api.getSystemConfig(param).then(result => { |
| | | if (!result.status) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | }) |
| | | } |
| | | |
| | | setUserBindMenu = (config, result) => { |
| | | const { MenuId } = this.state |
| | | let isCreate = !config |
| | |
| | | return item |
| | | }) |
| | | sessionStorage.setItem('appMenus', JSON.stringify(menus)) |
| | | sessionStorage.setItem('allMenus', JSON.stringify(res.menus || [])) |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | } 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) |
| | | |
| | | if (s.length === 0) return |
| | | |
| | | |
| | | tabs.push({ |
| | | key: tab.uuid, |
| | | 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 |
| | | } |
| | |
| | | let trees = traversal(config.components) |
| | | |
| | | return trees |
| | | } |
| | | |
| | | getSubMenus = () => { |
| | | const { config } = this.state |
| | | let menus = [] |
| | | let menuObj = {} |
| | | let allMenus = JSON.parse(sessionStorage.getItem('allMenus')) |
| | | |
| | | allMenus.forEach(item => { |
| | | menuObj[item.MenuID] = item |
| | | }) |
| | | |
| | | let traversal = (components) => { |
| | | components.forEach(item => { |
| | | if (item.type === 'topbar') { |
| | | if (item.wrap.linkmenu && menuObj[item.wrap.linkmenu]) { |
| | | menus.push(menuObj[item.wrap.linkmenu]) |
| | | } |
| | | if (item.wrap.menus) { |
| | | item.wrap.menus.forEach(m => { |
| | | if (!menuObj[m.menu]) return |
| | | |
| | | menus.push(menuObj[m.menu]) |
| | | }) |
| | | } |
| | | } else if (item.type === 'login') { |
| | | if (item.wrap.linkmenu && menuObj[item.wrap.linkmenu]) { |
| | | menus.push(menuObj[item.wrap.linkmenu]) |
| | | } |
| | | } else if (item.type === 'menubar' && item.subtype !== 'commonbar') { |
| | | item.subMenus.forEach(m => { |
| | | if (m.setting.type === 'menu') { |
| | | if (menuObj[m.uuid]) { |
| | | menus.push(menuObj[m.uuid]) |
| | | } else { |
| | | menus.push({ |
| | | MenuID: m.uuid, |
| | | MenuName: m.setting.name, |
| | | MenuNo: m.setting.MenuNo |
| | | }) |
| | | } |
| | | } else if (m.setting.type === 'linkmenu' && menuObj[m.setting.linkMenuId]) { |
| | | menus.push(menuObj[m.setting.linkMenuId]) |
| | | } |
| | | }) |
| | | } else if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | | traversal(tab.components) |
| | | }) |
| | | } else if (item.type === 'group') { |
| | | traversal(item.components) |
| | | } else if (item.type === 'card' || (item.type === 'table' && item.subtype === 'tablecard')) { |
| | | item.action && item.action.forEach(btn => { |
| | | if (btn.linkmenu && menuObj[btn.linkmenu]) { |
| | | menus.push(menuObj[btn.linkmenu]) |
| | | } else if (btn.openmenu && menuObj[btn.openmenu]) { |
| | | menus.push(menuObj[btn.openmenu]) |
| | | } |
| | | }) |
| | | item.subcards.forEach(card => { |
| | | if (card.setting.click === 'menu' && menuObj[card.setting.menu]) { |
| | | menus.push(menuObj[card.setting.menu]) |
| | | } else if (card.setting.click === 'menus' && card.menus) { |
| | | card.menus.forEach(m => { |
| | | if (menuObj[m.menu]) { |
| | | menus.push(menuObj[m.menu]) |
| | | } |
| | | }) |
| | | } |
| | | card.elements && card.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | if (cell.linkmenu && menuObj[cell.linkmenu]) { |
| | | menus.push(menuObj[cell.linkmenu]) |
| | | } else if (cell.openmenu && menuObj[cell.openmenu]) { |
| | | menus.push(menuObj[cell.openmenu]) |
| | | } |
| | | }) |
| | | }) |
| | | } else if (item.type === 'carousel' || item.type === 'timeline') { |
| | | item.subcards.forEach(card => { |
| | | if (card.setting.click === 'menu' && menuObj[card.setting.menu]) { |
| | | menus.push(menuObj[card.setting.menu]) |
| | | } |
| | | card.elements && card.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | if (cell.linkmenu && menuObj[cell.linkmenu]) { |
| | | menus.push(menuObj[cell.linkmenu]) |
| | | } else if (cell.openmenu && menuObj[cell.openmenu]) { |
| | | menus.push(menuObj[cell.openmenu]) |
| | | } |
| | | }) |
| | | }) |
| | | } else if (item.type === 'balcony') { |
| | | item.elements && item.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | if (cell.linkmenu && menuObj[cell.linkmenu]) { |
| | | menus.push(menuObj[cell.linkmenu]) |
| | | } else if (cell.openmenu && menuObj[cell.openmenu]) { |
| | | menus.push(menuObj[cell.openmenu]) |
| | | } |
| | | }) |
| | | } else if (item.type === 'form') { |
| | | item.subcards.forEach(m => { |
| | | if (m.subButton && m.subButton.linkmenu && menuObj[m.subButton.linkmenu]) { |
| | | menus.push(menuObj[m.subButton.linkmenu]) |
| | | } |
| | | }) |
| | | } else if (item.type === 'table' && item.subtype === 'normaltable') { |
| | | item.action && item.action.forEach(btn => { |
| | | if (btn.linkmenu && menuObj[btn.linkmenu]) { |
| | | menus.push(menuObj[btn.linkmenu]) |
| | | } else if (btn.openmenu && menuObj[btn.openmenu]) { |
| | | menus.push(menuObj[btn.openmenu]) |
| | | } |
| | | }) |
| | | item.cols && item.cols.forEach(col => { |
| | | if (col.type !== 'action') return |
| | | col.elements.forEach(btn => { |
| | | if (btn.linkmenu && menuObj[btn.linkmenu]) { |
| | | menus.push(menuObj[btn.linkmenu]) |
| | | } else if (btn.openmenu && menuObj[btn.openmenu]) { |
| | | menus.push(menuObj[btn.openmenu]) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | traversal(config.components) |
| | | |
| | | let map = new Map() |
| | | menus = menus.filter(m => { |
| | | if (map.has(m.MenuID)) return false |
| | | map.set(m.MenuID, true) |
| | | return true |
| | | }) |
| | | |
| | | return menus |
| | | } |
| | | |
| | | checkBtn = (btn) => { |
| | |
| | | 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() |
| | | config.loginview = false |
| | | config.tabview = false |
| | | |
| | | if (config.components.findIndex(item => item.type === 'login') > -1) { |
| | | roleParam.login = true |
| | | config.loginview = true |
| | | } else { |
| | | config.loginview = 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 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 param = { |
| | | func: 'sPC_TrdMenu_AddUpt', |
| | |
| | | open_edition: config.open_edition, |
| | | menus_rolelist: window.btoa(window.encodeURIComponent(JSON.stringify(roleParam))), |
| | | LText: '', |
| | | LTexttb: '' |
| | | LTexttb: '', |
| | | menus_used_list |
| | | } |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | |
| | | |
| | | let roles = { |
| | | type: 'navbar', |
| | | version: '1.0', |
| | | key: item.uuid, |
| | | title: item.name, |
| | | children: [] |
| | | } |
| | | |
| | | roles.children = item.menus.map(menu => { |
| | | return { |
| | | key: menu.MenuID, |
| | | title: menu.name |
| | | } |
| | | }) |
| | | 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 = '搜索组件与导航栏的搜索功能不可同时使用。' |
| | |
| | | <ArrowLeftOutlined title="后退" className="back-view" onClick={this.backView}/> |
| | | <CreateView resetmenu={this.getAppMenus} /> |
| | | <PasteController insert={this.insert} /> |
| | | <StyleCombControlButton menu={config} /> |
| | | <ViewNodes config={config} MenuId={MenuId}/> |
| | | <SysInterface config={config} updateConfig={this.updateConfig}/> |
| | | <PictureController/> |
| | | <Quotecomponent config={config} updateConfig={this.updateConfig}/> |
| | |
| | | <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/> |
| | | <Transfer MenuID={MenuId} /> |
| | | <Versions MenuId={MenuId} open_edition={config ? config.open_edition : ''}/> |
| | | <StyleCombControlButton menu={config} /> |
| | | <Button className="mk-border-danger" onClick={this.refreshView}><RedoOutlined /> 强制刷新</Button> |
| | | <Button type="default" onClick={this.closeView}>关闭</Button> |
| | | </div> |