| | |
| | | return {tbs, ptbs} |
| | | } |
| | | |
| | | getFuncAndInterface = (config) => { |
| | | let ptbs = [] |
| | | |
| | | let filterBtn = (cell, tbs) => { |
| | | if (cell.intertype === 'inner') { |
| | | tbs.push({ |
| | | label: cell.innerFunc + ' (' + cell.label + ')', |
| | | color: 'orange', |
| | | id: Utils.getuuid(), |
| | | direction: 'left' |
| | | }) |
| | | } else if (cell.intertype === 'outer' || cell.intertype === 'custom') { |
| | | if (cell.innerFunc) { |
| | | tbs.push({ |
| | | label: cell.innerFunc + ' (' + cell.label + ')', |
| | | color: 'orange', |
| | | id: Utils.getuuid(), |
| | | direction: 'left' |
| | | }) |
| | | } |
| | | if (cell.outerFunc) { |
| | | tbs.push({ |
| | | label: cell.outerFunc + ' (' + cell.label + ')', |
| | | color: 'orange', |
| | | id: Utils.getuuid(), |
| | | direction: 'left' |
| | | }) |
| | | } |
| | | if (cell.interface && cell.sysInterface !== 'true') { |
| | | tbs.push({ |
| | | label: cell.interface + ' (' + cell.label + ')', |
| | | color: 'orange', |
| | | id: Utils.getuuid(), |
| | | direction: 'left' |
| | | }) |
| | | } |
| | | if (cell.proInterface) { |
| | | tbs.push({ |
| | | label: cell.proInterface + ' (' + cell.label + ')', |
| | | color: 'orange', |
| | | id: Utils.getuuid(), |
| | | direction: 'left' |
| | | }) |
| | | } |
| | | if (cell.callbackFunc) { |
| | | tbs.push({ |
| | | label: cell.callbackFunc + ' (' + cell.label + ')', |
| | | color: 'orange', |
| | | id: Utils.getuuid(), |
| | | direction: 'left' |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | let filterSetting = (item, tbs) => { |
| | | if (!item.setting) return |
| | | if (item.setting.interType === 'inner') { |
| | | tbs.push({ |
| | | label: item.setting.innerFunc + ' (数据源)', |
| | | color: 'orange', |
| | | id: Utils.getuuid(), |
| | | direction: 'left' |
| | | }) |
| | | } else if (item.setting.interType === 'outer') { |
| | | if (item.setting.outerFunc) { |
| | | tbs.push({ |
| | | label: item.setting.outerFunc + ' (数据源)', |
| | | color: 'orange', |
| | | id: Utils.getuuid(), |
| | | direction: 'left' |
| | | }) |
| | | } |
| | | if (item.setting.interface && item.setting.sysInterface !== 'true') { |
| | | tbs.push({ |
| | | label: item.setting.interface + ' (数据源)', |
| | | color: 'orange', |
| | | id: Utils.getuuid(), |
| | | direction: 'left' |
| | | }) |
| | | } |
| | | if (item.setting.proInterface) { |
| | | tbs.push({ |
| | | label: item.setting.proInterface + ' (数据源)', |
| | | color: 'orange', |
| | | id: Utils.getuuid(), |
| | | direction: 'left' |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | let traversal = (components, extra) => { |
| | | components.forEach(item => { |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | | traversal(tab.components, extra) |
| | | }) |
| | | } else if (item.type === 'group') { |
| | | traversal(item.components, extra) |
| | | } else { |
| | | let tbs = [] |
| | | |
| | | filterSetting(item, tbs) |
| | | |
| | | if (item.action) { |
| | | item.action.forEach(cell => { |
| | | if (cell.OpenType === 'popview') { |
| | | if (cell.config.components) { |
| | | traversal(cell.config.components, `-${cell.label}(弹窗)`) |
| | | } |
| | | } else { |
| | | filterBtn(cell, tbs) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') { |
| | | item.subcards.forEach(card => { |
| | | card.elements && card.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | if (cell.OpenType === 'popview') { |
| | | if (cell.config.components) { |
| | | traversal(cell.config.components, `-${cell.label}(弹窗)`) |
| | | } |
| | | } else { |
| | | filterBtn(cell, tbs) |
| | | } |
| | | }) |
| | | card.backElements && card.backElements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | if (cell.OpenType === 'popview') { |
| | | if (cell.config.components) { |
| | | traversal(cell.config.components, `-${cell.label}(弹窗)`) |
| | | } |
| | | } else { |
| | | filterBtn(cell, tbs) |
| | | } |
| | | }) |
| | | }) |
| | | } else if (item.type === 'balcony') { |
| | | item.elements && item.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | if (cell.OpenType === 'popview') { |
| | | if (cell.config.components) { |
| | | traversal(cell.config.components, `-${cell.label}(弹窗)`) |
| | | } |
| | | } else { |
| | | filterBtn(cell, tbs) |
| | | } |
| | | }) |
| | | } else if (item.type === 'table') { |
| | | let loopCol = (cols) => { |
| | | cols.forEach(col => { |
| | | if (col.type === 'colspan') { |
| | | loopCol(col.subcols) |
| | | } else if (col.type === 'custom') { |
| | | col.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | if (cell.OpenType === 'popview') { |
| | | if (cell.config.components) { |
| | | traversal(cell.config.components, `-${cell.label}(弹窗)`) |
| | | } |
| | | } else { |
| | | filterBtn(cell, tbs) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | loopCol(item.cols) |
| | | } else if (item.type === 'form') { |
| | | item.subcards.forEach(group => { |
| | | filterBtn(group.subButton, tbs) |
| | | }) |
| | | } |
| | | |
| | | if (tbs.length) { |
| | | ptbs.push({ |
| | | label: item.name + extra, |
| | | id: Utils.getuuid(), |
| | | direction: 'left', |
| | | color: 'orange', |
| | | children: tbs |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (config.interfaces) { |
| | | config.interfaces.forEach(item => { |
| | | let tbs = [] |
| | | filterSetting(item, tbs) |
| | | if (tbs.length) { |
| | | ptbs.push({ |
| | | label: item.name, |
| | | id: Utils.getuuid(), |
| | | direction: 'left', |
| | | color: 'orange', |
| | | children: tbs |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | traversal(config.components, '') |
| | | |
| | | return ptbs |
| | | } |
| | | |
| | | trigger = () => { |
| | | const { config } = this.props |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | let funcs = this.getFuncAndInterface(config) |
| | | |
| | | if (funcs.length) { |
| | | data.children.push(...funcs) |
| | | } |
| | | |
| | | if (result.tb_list) { |
| | | result.tb_list.sort((a, b) => a.tbname > b.tbname ? 1 : -1) |
| | | let length = result.tb_list.length |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description 获取接口及函数 |
| | | */ |
| | | export function getFuncsAndInters (config) { |
| | | let inters = [] |
| | | // let funcs = [] |
| | | |
| | | let filterBtn = (cell) => { |
| | | if (cell.intertype === 'inner') { |
| | | // funcs.push(cell.innerFunc) |
| | | } else if (cell.intertype === 'outer' || cell.intertype === 'custom') { |
| | | // if (cell.innerFunc) { |
| | | // funcs.push(cell.innerFunc) |
| | | // } |
| | | // if (cell.outerFunc) { |
| | | // funcs.push(cell.outerFunc) |
| | | // } |
| | | if (cell.interface && cell.sysInterface !== 'true') { |
| | | inters.push(cell.interface) |
| | | } |
| | | if (cell.proInterface) { |
| | | inters.push(cell.proInterface) |
| | | } |
| | | // if (cell.callbackFunc) { |
| | | // funcs.push(cell.callbackFunc) |
| | | // } |
| | | } |
| | | } |
| | | |
| | | let filterSetting = (item) => { |
| | | if (!item.setting) return |
| | | if (item.setting.interType === 'inner') { |
| | | // funcs.push(item.setting.innerFunc) |
| | | } else if (item.setting.interType === 'outer') { |
| | | // if (item.setting.outerFunc) { |
| | | // funcs.push(item.setting.outerFunc) |
| | | // } |
| | | if (item.setting.interface && item.setting.sysInterface !== 'true') { |
| | | inters.push(item.setting.interface) |
| | | } |
| | | if (item.setting.proInterface) { |
| | | inters.push(item.setting.proInterface) |
| | | } |
| | | } |
| | | } |
| | | |
| | | let traversal = (components) => { |
| | | if (!components) return |
| | | |
| | | components.forEach(item => { |
| | | if (item.type === 'tabs') { |
| | | item.subtabs.forEach(tab => { |
| | | traversal(tab.components) |
| | | }) |
| | | } else if (item.type === 'group') { |
| | | traversal(item.components) |
| | | } else { |
| | | filterSetting(item) |
| | | |
| | | if (item.action) { |
| | | item.action.forEach(cell => { |
| | | if (cell.OpenType === 'popview') { |
| | | if (cell.config) { |
| | | traversal(cell.config.components) |
| | | } |
| | | } else { |
| | | filterBtn(cell) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') { |
| | | item.subcards.forEach(card => { |
| | | card.elements && card.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | if (cell.OpenType === 'popview') { |
| | | if (cell.config) { |
| | | traversal(cell.config.components) |
| | | } |
| | | } else { |
| | | filterBtn(cell) |
| | | } |
| | | }) |
| | | card.backElements && card.backElements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | if (cell.OpenType === 'popview') { |
| | | if (cell.config) { |
| | | traversal(cell.config.components) |
| | | } |
| | | } else { |
| | | filterBtn(cell) |
| | | } |
| | | }) |
| | | }) |
| | | } else if (item.type === 'balcony') { |
| | | item.elements && item.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | if (cell.OpenType === 'popview') { |
| | | if (cell.config) { |
| | | traversal(cell.config.components) |
| | | } |
| | | } else { |
| | | filterBtn(cell) |
| | | } |
| | | }) |
| | | } else if (item.type === 'table') { |
| | | let loopCol = (cols) => { |
| | | cols.forEach(col => { |
| | | if (col.type === 'colspan') { |
| | | loopCol(col.subcols) |
| | | } else if (col.type === 'custom') { |
| | | col.elements.forEach(cell => { |
| | | if (cell.eleType !== 'button') return |
| | | |
| | | if (cell.OpenType === 'popview') { |
| | | if (cell.config) { |
| | | traversal(cell.config.components) |
| | | } |
| | | } else { |
| | | filterBtn(cell) |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | loopCol(item.cols) |
| | | } else if (item.type === 'form') { |
| | | item.subcards.forEach(group => { |
| | | filterBtn(group.subButton) |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (config.interfaces) { |
| | | config.interfaces.forEach(item => { |
| | | filterSetting(item) |
| | | }) |
| | | } |
| | | |
| | | traversal(config.components) |
| | | |
| | | // inters = Array.from(new Set(inters)) |
| | | |
| | | return inters.length > 0 ? 'true' : 'false' |
| | | } |
| | | |
| | | /** |
| | | * @description 检测组件内容 |
| | | */ |
| | | export function checkComponent (card) { |
| | |
| | | import React, {Component} from 'react' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Menu, Popover, Modal, notification } from 'antd' |
| | | import { EditOutlined, PlusOutlined, SettingOutlined } from '@ant-design/icons' |
| | | import { EditOutlined, PlusOutlined, SettingOutlined, ApiOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | |
| | | {item.children.map(cell => { |
| | | return ( |
| | | <Menu.Item key={cell.MenuID}> |
| | | <span className="editable-menu-item" onDoubleClick={() => this.editmenu(cell)}>{cell.MenuName}</span> |
| | | <span className="editable-menu-item" onDoubleClick={() => this.editmenu(cell)}>{cell.PageParam && cell.PageParam.interfaces === 'true' ? <ApiOutlined title="菜单中使用了外部接口" /> : null}{cell.MenuName}</span> |
| | | </Menu.Item> |
| | | ) |
| | | })} |
| | |
| | | padding-left: 48px; |
| | | } |
| | | .editable-menu-item { |
| | | position: relative; |
| | | display: block; |
| | | padding-left: 48px; |
| | | cursor: pointer; |
| | | |
| | | .anticon-api { |
| | | position: absolute; |
| | | left: 25px; |
| | | top: 11px; |
| | | color: orange; |
| | | } |
| | | } |
| | | } |
| | | .ant-menu-sub.ant-menu-inline { |
| | |
| | | import Utils, { setGLOBFuncs } from '@/utils/utils.js' |
| | | import antdZhCN from 'antd/es/locale/zh_CN' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import { getTables } from '@/utils/utils-custom.js' |
| | | import { getTables, getFuncsAndInters } from '@/utils/utils-custom.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | |
| | | import '@/assets/css/design.scss' |
| | |
| | | config.tbkey = key |
| | | } |
| | | |
| | | let interfaces = getFuncsAndInters(config) |
| | | |
| | | let param = { |
| | | func: 'sPC_TrdMenu_AddUpt', |
| | | FstID: config.fstMenuId || '', |
| | |
| | | EasyCode: config.easyCode || '', |
| | | Template: 'CustomPage', |
| | | MenuName: config.MenuName || '', |
| | | PageParam: JSON.stringify({Template: 'CustomPage', OpenType: config.OpenType || 'newtab', hidden: config.hidden || 'false'}), |
| | | PageParam: JSON.stringify({Template: 'CustomPage', OpenType: config.OpenType || 'newtab', hidden: config.hidden || 'false', interfaces}), |
| | | open_edition: config.open_edition, |
| | | LText: '', |
| | | LTexttb: '', |
| | |
| | | import Utils, { setGLOBFuncs } from '@/utils/utils.js' |
| | | import antdZhCN from 'antd/es/locale/zh_CN' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import MenuUtils, { getTables } from '@/utils/utils-custom.js' |
| | | import MenuUtils, { getTables, getFuncsAndInters } from '@/utils/utils-custom.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | |
| | | import '@/assets/css/design.scss' |
| | |
| | | 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 interfaces = getFuncsAndInters(config) |
| | | |
| | | let param = { |
| | | func: 'sPC_TrdMenu_AddUpt', |
| | | FstID: 'mk_app', |
| | |
| | | TypeCharOne: sessionStorage.getItem('kei_no'), |
| | | Typename: sessionStorage.getItem('typename'), |
| | | MenuName: config.MenuName || '', |
| | | PageParam: JSON.stringify({Template: 'webPage'}), |
| | | PageParam: JSON.stringify({Template: 'webPage', interfaces}), |
| | | open_edition: config.open_edition, |
| | | menus_rolelist: window.btoa(window.encodeURIComponent(JSON.stringify(roleParam))), |
| | | LText: '', |
| | |
| | | |
| | | import Api from '@/api' |
| | | import Utils, { setGLOBFuncs } from '@/utils/utils.js' |
| | | import { getTables } from '@/utils/utils-custom.js' |
| | | import { getTables, getFuncsAndInters } from '@/utils/utils-custom.js' |
| | | import antdZhCN from 'antd/es/locale/zh_CN' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import MenuUtils from '@/utils/utils-custom.js' |
| | |
| | | config.tbkey = key |
| | | } |
| | | |
| | | let interfaces = getFuncsAndInters(config) |
| | | |
| | | let param = { |
| | | func: 'sPC_TrdMenu_AddUpt', |
| | | FstID: 'mk_app', |
| | |
| | | TypeCharOne: sessionStorage.getItem('kei_no'), |
| | | Typename: 'pc', |
| | | MenuName: config.MenuName || '', |
| | | PageParam: JSON.stringify({Template: 'webPage'}), |
| | | PageParam: JSON.stringify({Template: 'webPage', interfaces}), |
| | | menus_rolelist: window.btoa(window.encodeURIComponent(JSON.stringify(roleParam))), |
| | | open_edition: config.open_edition, |
| | | LText: '', |
| | |
| | | import { Spin, notification, Button, Table, Modal, ConfigProvider, Tree, Input, Empty } from 'antd' |
| | | import moment from 'moment' |
| | | import md5 from 'md5' |
| | | import enUS from 'antd/es/locale/en_US' |
| | | import zhCN from 'antd/es/locale/zh_CN' |
| | | import { ApiOutlined } from '@ant-design/icons' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | const { TreeNode } = Tree |
| | | const { Search } = Input |
| | | |
| | | const _locale = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | const Header = asyncComponent(() => import('./header')) |
| | | const TransferForm = asyncComponent(() => import('@/templates/zshare/basetransferform')) |
| | | |
| | |
| | | title: '菜单名称', dataIndex: 'MenuName', key: 'MenuName', align: 'center', render: (text, record) => { |
| | | if (record.extra) { |
| | | return <span style={{color: '#1890ff'}}>{text}</span> |
| | | } else if (record.interfaces === 'true') { |
| | | return <span><ApiOutlined style={{color: 'orange', marginRight: '5px'}} title="菜单中使用了外部接口" />{text}</span> |
| | | } |
| | | return text |
| | | } |
| | |
| | | let menus = result.menus.map(item => { |
| | | item.nodes = '' |
| | | item.type = 'view' |
| | | if (item.PageParam) { |
| | | try { |
| | | let PageParam = JSON.parse(item.PageParam) |
| | | item.interfaces = PageParam.interfaces || 'false' |
| | | } catch (e) {} |
| | | } |
| | | if (item.menus_rolelist) { |
| | | try { |
| | | let pageParam = JSON.parse(window.decodeURIComponent(window.atob(item.menus_rolelist))) |
| | |
| | | |
| | | return ( |
| | | <div className="mk-role-manage"> |
| | | <ConfigProvider locale={_locale}> |
| | | <ConfigProvider locale={zhCN}> |
| | | <Header app={app} /> |
| | | {loading ? |
| | | <div className="loading-mask"> |
| | |
| | | import Utils, { setGLOBFuncs } from '@/utils/utils.js' |
| | | import antdZhCN from 'antd/es/locale/zh_CN' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import { getTables } from '@/utils/utils-custom.js' |
| | | import { getTables, getFuncsAndInters } from '@/utils/utils-custom.js' |
| | | import SourceElement from '@/templates/zshare/dragsource' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import Source from './source' |
| | |
| | | config.tbkey = key |
| | | } |
| | | |
| | | let interfaces = getFuncsAndInters(config) |
| | | |
| | | let param = { |
| | | func: 'sPC_TrdMenu_AddUpt', |
| | | FstID: config.fstMenuId || '', |
| | |
| | | EasyCode: config.easyCode || '', |
| | | Template: 'BaseTable', |
| | | MenuName: config.MenuName || '', |
| | | PageParam: JSON.stringify({Template: 'BaseTable', OpenType: config.OpenType || 'newtab', hidden: config.hidden || 'false'}), |
| | | PageParam: JSON.stringify({Template: 'BaseTable', OpenType: config.OpenType || 'newtab', hidden: config.hidden || 'false', interfaces}), |
| | | open_edition: config.open_edition, |
| | | LText: '', |
| | | LTexttb: '', |