| | |
| | | data: null, // 列表数据集 |
| | | loading: false, // 列表数据加载中 |
| | | visible: false, // 标签页控制 |
| | | shortcuts: null // 快捷键 |
| | | shortcuts: null, // 快捷键 |
| | | loadinginter: false |
| | | } |
| | | |
| | | stepInter = null |
| | | |
| | | /** |
| | | * @description 获取页面配置信息 |
| | |
| | | config = window.decodeURIComponent(window.atob(result.LongParam)) |
| | | config = config.replace(/@mywebsite@\//ig, window.GLOB.baseurl) |
| | | config = JSON.parse(config) |
| | | config.MenuID = MenuID |
| | | } catch (e) { |
| | | console.warn('Parse Failure') |
| | | config = '' |
| | |
| | | |
| | | // 数据缓存设置 |
| | | if (config.cacheUseful === 'true') { |
| | | if (!['day', 'hour'].includes(config.timeUnit)) { |
| | | if (!['day', 'hour', 'minute'].includes(config.timeUnit)) { |
| | | config.timeUnit = 'day' |
| | | } |
| | | config.cacheTime = config.cacheTime || 1 |
| | |
| | | |
| | | config.$cache = config.cacheLocal === 'true' |
| | | |
| | | config.interfaces = this.formatInterSetting(config.interfaces, regs) |
| | | let initInters = [] |
| | | |
| | | config.interfaces = this.formatInterSetting(config.interfaces, regs, MenuID, initInters) |
| | | config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, param, MenuID, config.interfaces, popview, config.$cache) |
| | | |
| | | // 获取主搜索条件 |
| | |
| | | config.components = this.filterBalcony(config.components, balMap) |
| | | } |
| | | |
| | | if (initInters.length > 0) { |
| | | this.stepInter = { |
| | | MenuID: MenuID, |
| | | inters: initInters, |
| | | params: params |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | BID: BID, |
| | | loadinginter: this.stepInter !== null, |
| | | shortcuts: shortcuts.length > 0 ? shortcuts : null, |
| | | config, |
| | | mainSearch |
| | |
| | | ele.innerHTML = config.normalcss |
| | | document.getElementsByTagName('head')[0].appendChild(ele) |
| | | } |
| | | if (params.length === 0) { |
| | | |
| | | if (this.stepInter) { |
| | | |
| | | } else if (params.length === 0) { |
| | | setTimeout(() => { // 延时加载状态 |
| | | this.setState({ |
| | | loadingview: false |
| | |
| | | item.search = Utils.initSearchVal(item.search) |
| | | } |
| | | |
| | | if (item.wrap && item.wrap.supType === 'multi') { // 数据卡多上级组件 |
| | | item.setting.supModule = item.supNodes[0].componentId |
| | | } else if (item.setting && item.setting.supModule && typeof(item.setting.supModule) !== 'string') { |
| | | let pid = item.setting.supModule.pop() |
| | | if (pid && pid !== 'empty') { |
| | | item.setting.supModule = pid |
| | | } else { |
| | | item.setting.supModule = '' |
| | | } |
| | | } |
| | | |
| | | let pass = skip |
| | | |
| | | if (item.wrap && item.wrap.permission === 'false') { |
| | | pass = true |
| | | } |
| | | |
| | | // 权限过滤 |
| | | if (item.action && item.action.length > 0) { |
| | | item.action = item.action.filter(cell => { |
| | | if (cell.hidden === 'true') return false |
| | | |
| | | cell = this.resetButton(item, cell, popview) |
| | | |
| | | cell.$toolbtn = true |
| | | |
| | | if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置 |
| | | cell = this.getPrinter(cell, item.uuid) |
| | | } |
| | | |
| | | return pass || permAction[cell.uuid] |
| | | }) |
| | | } |
| | | |
| | | if (item.type === 'table') { |
| | | let statFields = [] |
| | | let getCols = (cols) => { |
| | |
| | | return false |
| | | } else if (col.Hide === 'true') { |
| | | return false |
| | | } else if (col.type === 'action') { |
| | | col.type = 'custom' |
| | | } |
| | | |
| | | if (col.type === 'number') { |
| | |
| | | col.decimal = col.decimal > 2 ? col.decimal - 2 : 0 |
| | | } |
| | | } |
| | | } else if (col.type === 'formula') { |
| | | if (typeof(col.decimal) === 'number') { |
| | | col.round = Math.pow(10, col.decimal) |
| | | } |
| | | } else if (col.type === 'colspan') { |
| | | col.subcols = getCols(col.subcols || []) |
| | | if (col.subcols.length === 0) { |
| | | return false |
| | | } |
| | | } else if (col.type === 'custom') { |
| | | col.elements = col.elements.map(cell => { |
| | | if (['text', 'number', 'formula'].includes(cell.eleType)) { |
| | | if (!cell.height) { |
| | | cell.innerHeight = 'auto' |
| | | col.elements = col.elements.filter(cell => { |
| | | if (cell.eleType === 'button') { |
| | | if (cell.hidden === 'true') return false |
| | | |
| | | cell = this.resetButton(item, cell, popview) |
| | | |
| | | if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置 |
| | | cell = this.getPrinter(cell, item.uuid) |
| | | } |
| | | if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') { |
| | | cell.round = Math.pow(10, cell.decimal) |
| | | if (cell.format === 'percent') { |
| | | cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 |
| | | } |
| | | } |
| | | |
| | | return pass || permAction[cell.uuid] |
| | | } else { |
| | | cell = this.resetElement(cell) |
| | | } |
| | | return cell |
| | | return true |
| | | }) |
| | | |
| | | if (col.elements.length === 0) { |
| | | return false |
| | | } |
| | | } |
| | | |
| | | if (col.linkmenu && col.linkmenu.length > 0) { |
| | |
| | | |
| | | item.cols = getCols(item.cols) |
| | | item.statFields = statFields |
| | | } |
| | | |
| | | let mutil = false |
| | | if (item.wrap && item.wrap.supType === 'multi') { // 数据卡多上级组件 |
| | | mutil = true |
| | | item.setting.supModule = item.supNodes[0].componentId |
| | | } else if (item.setting && item.setting.supModule && typeof(item.setting.supModule) !== 'string') { |
| | | let pid = item.setting.supModule.pop() |
| | | if (pid && pid !== 'empty') { |
| | | item.setting.supModule = pid |
| | | } else { |
| | | item.setting.supModule = '' |
| | | if (item.subtype === 'editable') { |
| | | item.submit.logLabel = item.$menuname + '-提交' |
| | | item.submit.$menuId = item.uuid |
| | | item.submit.syncComponentId = item.submit.syncComponent ? (item.submit.syncComponent.pop() || '') : '' |
| | | |
| | | if (item.submit.syncComponentId && item.submit.syncComponentId === item.setting.supModule) { |
| | | item.submit.syncComponentId = '' |
| | | if (item.submit.execSuccess === 'grid') { |
| | | item.submit.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 权限过滤 |
| | | if (item.action && item.action.length > 0) { |
| | | item.action = item.action.filter(cell => { |
| | | if (cell.hidden === 'true') return false |
| | | |
| | | cell.logLabel = item.$menuname + '-' + cell.label |
| | | cell.ContainerId = this.state.ContainerId |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = this.props.MenuID |
| | | cell.$view = popview |
| | | cell.$toolbtn = true |
| | | |
| | | if (!mutil && cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | |
| | | if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置 |
| | | cell = this.getPrinter(cell, item.uuid) |
| | | } |
| | | |
| | | if (cell.btnstyle) { // 兼容 |
| | | cell.style = cell.style || {} |
| | | cell.style = {...cell.style, ...cell.btnstyle} |
| | | } |
| | | |
| | | if (cell.controlField) { |
| | | if (/,/ig.test(cell.controlVal)) { |
| | | cell.controlVals = cell.controlVal.split(',') |
| | | } else { |
| | | cell.controlVals = [(cell.controlVal || '')] |
| | | } |
| | | } |
| | | |
| | | return skip || permAction[cell.uuid] |
| | | }) |
| | | } |
| | | |
| | | if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') { |
| | | } else if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') { |
| | | item.subcards && item.subcards.forEach(card => { |
| | | if (card.style.boxShadow) { |
| | | delete card.style.hShadow |
| | |
| | | if (cell.eleType === 'button') { |
| | | if (cell.hidden === 'true') return false |
| | | |
| | | cell.logLabel = item.$menuname + '-' + cell.label |
| | | cell.Ot = cell.Ot || 'requiredSgl' |
| | | cell.ContainerId = this.state.ContainerId |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = this.props.MenuID |
| | | cell.$view = popview |
| | | |
| | | if (!mutil && cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | cell = this.resetButton(item, cell, popview) |
| | | |
| | | if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置 |
| | | cell = this.getPrinter(cell, item.uuid) |
| | | } |
| | | if (cell.controlField) { |
| | | if (/,/ig.test(cell.controlVal)) { |
| | | cell.controlVals = cell.controlVal.split(',') |
| | | } else { |
| | | cell.controlVals = [(cell.controlVal || '')] |
| | | } |
| | | } |
| | | } else if (['text', 'number', 'formula'].includes(cell.eleType)) { |
| | | if (!cell.height) { |
| | | cell.innerHeight = 'auto' |
| | | } |
| | | if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') { |
| | | cell.round = Math.pow(10, cell.decimal) |
| | | if (cell.format === 'percent') { |
| | | cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 |
| | | } |
| | | } |
| | | } else { |
| | | cell = this.resetElement(cell) |
| | | } |
| | | |
| | | return cell.eleType !== 'button' || skip || permAction[cell.uuid] |
| | | return cell.eleType !== 'button' || pass || permAction[cell.uuid] |
| | | }) |
| | | |
| | | if (card.setting.click === 'menus') { |
| | | if (card.menus) { |
| | | card.menus = card.menus.filter(m => !!m.MenuID) |
| | | if (card.menus.length === 0) { |
| | | card.menus = null |
| | | } |
| | | } |
| | | if (!card.menus || item.subtype !== 'datacard' || card.$cardType === 'extendCard') { |
| | | card.setting.click = '' |
| | | } |
| | | } else if (card.setting.click === 'menu') { |
| | | if (!Array.isArray(card.setting.menu)) { |
| | | card.setting.click = '' |
| | | } |
| | | } |
| | | |
| | | if (item.subtype === 'dualdatacard' && card.$cardType !== 'extendCard') { |
| | | if (card.backSetting && card.backSetting.click === 'menu') { |
| | | if (!Array.isArray(card.backSetting.menu)) { |
| | | card.backSetting.click = '' |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (!card.backElements || card.backElements.length === 0) return |
| | | |
| | |
| | | if (cell.eleType === 'button') { |
| | | if (cell.hidden === 'true') return false |
| | | |
| | | cell.logLabel = item.$menuname + '-' + cell.label |
| | | cell.Ot = cell.Ot || 'requiredSgl' |
| | | cell.ContainerId = this.state.ContainerId |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = this.props.MenuID |
| | | cell.$view = popview |
| | | |
| | | if (!mutil && cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | cell = this.resetButton(item, cell, popview) |
| | | |
| | | if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置 |
| | | cell = this.getPrinter(cell, item.uuid) |
| | | } |
| | | if (cell.controlField) { |
| | | if (/,/ig.test(cell.controlVal)) { |
| | | cell.controlVals = cell.controlVal.split(',') |
| | | } else { |
| | | cell.controlVals = [(cell.controlVal || '')] |
| | | } |
| | | } |
| | | } else if (['text', 'number', 'formula'].includes(cell.eleType)) { |
| | | if (!cell.height) { |
| | | cell.innerHeight = 'auto' |
| | | } |
| | | if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') { |
| | | cell.round = Math.pow(10, cell.decimal) |
| | | if (cell.format === 'percent') { |
| | | cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 |
| | | } |
| | | } |
| | | } else { |
| | | cell = this.resetElement(cell) |
| | | } |
| | | |
| | | return cell.eleType !== 'button' || skip || permAction[cell.uuid] |
| | | return cell.eleType !== 'button' || pass || permAction[cell.uuid] |
| | | }) |
| | | }) |
| | | } else if (item.type === 'balcony') { |
| | |
| | | if (cell.eleType === 'button') { |
| | | if (cell.hidden === 'true') return false |
| | | |
| | | cell.logLabel = item.$menuname + '-' + cell.label |
| | | cell.ContainerId = this.state.ContainerId |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = this.props.MenuID |
| | | cell.$view = popview |
| | | |
| | | if (cell.syncComponentId === item.wrap.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | cell = this.resetButton(item, cell, popview) |
| | | |
| | | if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置 |
| | | cell = this.getPrinter(cell, item.uuid) |
| | | } |
| | | if (cell.controlField) { |
| | | if (/,/ig.test(cell.controlVal)) { |
| | | cell.controlVals = cell.controlVal.split(',') |
| | | } else { |
| | | cell.controlVals = [(cell.controlVal || '')] |
| | | } |
| | | } |
| | | } else if (['text', 'number', 'formula'].includes(cell.eleType)) { |
| | | if (!cell.height) { |
| | | cell.innerHeight = 'auto' |
| | | } |
| | | if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') { |
| | | cell.round = Math.pow(10, cell.decimal) |
| | | if (cell.format === 'percent') { |
| | | cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 |
| | | } |
| | | } |
| | | } else { |
| | | cell = this.resetElement(cell) |
| | | } |
| | | |
| | | return cell.eleType !== 'button' || skip || permAction[cell.uuid] |
| | | return cell.eleType !== 'button' || pass || permAction[cell.uuid] |
| | | }) |
| | | } else if (item.type === 'table') { |
| | | item.cols = item.cols.filter(col => { |
| | | if (col.type !== 'action') return true |
| | | col.elements = col.elements.filter(cell => { |
| | | if (cell.hidden === 'true') return false |
| | | |
| | | cell.logLabel = item.$menuname + '-' + cell.label |
| | | cell.Ot = cell.Ot || 'requiredSgl' |
| | | cell.ContainerId = this.state.ContainerId |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = this.props.MenuID |
| | | cell.$view = popview |
| | | |
| | | if (cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | |
| | | if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置 |
| | | cell = this.getPrinter(cell, item.uuid) |
| | | } |
| | | |
| | | if (cell.btnstyle) { // 兼容 |
| | | cell.style = cell.style || {} |
| | | cell.style = {...cell.style, ...cell.btnstyle} |
| | | } |
| | | |
| | | if (cell.controlField) { |
| | | if (/,/ig.test(cell.controlVal)) { |
| | | cell.controlVals = cell.controlVal.split(',') |
| | | } else { |
| | | cell.controlVals = [(cell.controlVal || '')] |
| | | } |
| | | } |
| | | |
| | | return skip || permAction[cell.uuid] |
| | | }) |
| | | return col.elements.length !== 0 |
| | | }) |
| | | |
| | | if (item.subtype === 'editable') { |
| | | item.submit.logLabel = item.$menuname + '-提交' |
| | | item.submit.$menuId = item.uuid |
| | | } |
| | | } else if (item.type === 'form') { |
| | | item.subcards = item.subcards.map(group => { |
| | | group.subButton.uuid = group.uuid |
| | |
| | | group.subButton.Ot = item.wrap.datatype === 'static' ? 'notRequired' : 'requiredSgl' |
| | | } |
| | | |
| | | group.subButton.syncComponentId = group.subButton.syncComponent ? group.subButton.syncComponent.pop() : '' |
| | | group.subButton.syncComponentId = group.subButton.syncComponent ? (group.subButton.syncComponent.pop() || '') : '' |
| | | |
| | | if (group.subButton.syncComponentId === item.setting.supModule) { |
| | | if (group.subButton.syncComponentId && group.subButton.syncComponentId === item.setting.supModule) { |
| | | group.subButton.syncComponentId = '' |
| | | if (group.subButton.execSuccess === 'grid') { |
| | | group.subButton.execSuccess = 'mainline' |
| | |
| | | |
| | | return group |
| | | }) |
| | | } else if (item.subtype === 'voucher') { |
| | | if (item.wrap.supModule && item.wrap.supModule.length > 0) { |
| | | item.wrap.supModule = item.wrap.supModule.pop() |
| | | } else { |
| | | item.wrap.supModule = '' |
| | | } |
| | | } |
| | | |
| | | return true |
| | |
| | | |
| | | return true |
| | | }) |
| | | } |
| | | |
| | | resetButton = (item, cell, popview) => { |
| | | cell.logLabel = item.$menuname + '-' + cell.label |
| | | cell.Ot = cell.Ot || 'requiredSgl' |
| | | cell.ContainerId = this.state.ContainerId |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = this.props.MenuID |
| | | cell.$view = popview |
| | | |
| | | if (cell.btnstyle) { // 兼容 |
| | | cell.style = cell.style || {} |
| | | cell.style = {...cell.style, ...cell.btnstyle} |
| | | } |
| | | |
| | | if (cell.controlField) { |
| | | if (/,/ig.test(cell.controlVal)) { |
| | | cell.controlVals = cell.controlVal.split(',') |
| | | } else { |
| | | cell.controlVals = [(cell.controlVal || '')] |
| | | } |
| | | } |
| | | |
| | | if (cell.syncComponentId) { |
| | | if (cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } else if (cell.syncComponentId === 'multiComponent') { |
| | | let ids = cell.syncComponents.map(m => { |
| | | return m.syncComId.pop() || '' |
| | | }) |
| | | |
| | | if (item.setting.supModule && ids.includes(item.setting.supModule)) { |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | ids = ids.filter(id => id !== item.setting.supModule) |
| | | } |
| | | |
| | | if (ids.length === 0) { |
| | | cell.syncComponentId = '' |
| | | } else { |
| | | cell.syncComponentIds = ids |
| | | } |
| | | } |
| | | } |
| | | |
| | | return cell |
| | | } |
| | | |
| | | resetElement = (cell) => { |
| | | cell.style = cell.style || {} |
| | | if (['text', 'number', 'formula'].includes(cell.eleType)) { |
| | | if (!cell.height) { |
| | | cell.innerHeight = 'auto' |
| | | } |
| | | |
| | | cell.innerHeight = cell.innerHeight || 'auto' |
| | | cell.alignItems = cell.height > 1 ? cell.alignItems : '' |
| | | |
| | | if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') { |
| | | cell.round = Math.pow(10, cell.decimal) |
| | | if (cell.format === 'percent') { |
| | | cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 |
| | | } |
| | | } else if (cell.eleType === 'formula' && typeof(cell.decimal) === 'number') { |
| | | cell.round = Math.pow(10, cell.decimal) |
| | | } |
| | | } else if (cell.eleType === 'icon') { |
| | | if (!cell.innerHeight) { // 兼容 |
| | | let fontSize = 14 |
| | | let lineHeight = 1.5 |
| | | |
| | | if (cell.style.fontSize) { |
| | | fontSize = parseInt(cell.style.fontSize) |
| | | } |
| | | if (cell.style.lineHeight) { |
| | | lineHeight = parseFloat(cell.style.lineHeight) |
| | | } |
| | | |
| | | cell.innerHeight = fontSize * lineHeight |
| | | } |
| | | } |
| | | |
| | | return cell |
| | | } |
| | | |
| | | getPrinter = (item, parentId) => { |
| | |
| | | } |
| | | |
| | | // 格式化默认设置 |
| | | formatInterSetting = (inters, regs) => { |
| | | formatInterSetting = (inters, regs, MenuID, initInters) => { |
| | | if (!inters) return [] |
| | | |
| | | let interfaces = inters.filter(m => m.status === 'true') |
| | | let initlimit = false |
| | | let interfaces = inters.filter(m => { |
| | | if (m.status !== 'true') return false |
| | | |
| | | if (m.setting.loadlevel === 'init') { |
| | | initlimit = true |
| | | initInters.push(m.uuid) |
| | | } |
| | | |
| | | return true |
| | | }) |
| | | |
| | | let delay = 15 |
| | | return interfaces.map(inter => { |
| | | inter.MenuID = MenuID |
| | | inter.setting.delay = delay |
| | | delay += 15 |
| | | |
| | |
| | | } else { |
| | | inter.setting.supModule = '' |
| | | } |
| | | } |
| | | |
| | | if (initlimit && inter.setting.loadlevel !== 'init') { |
| | | inter.setting.onload = 'false' |
| | | } |
| | | |
| | | if (inter.setting.interType !== 'system') return inter |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('interFinish', this.interFinish) |
| | | MKEmitter.addListener('debugChange', this.debugChange) |
| | | MKEmitter.addListener('reloadMenuView', this.reloadMenuView) |
| | | MKEmitter.addListener('resetActiveMenu', this.resetActiveMenu) |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('interFinish', this.interFinish) |
| | | MKEmitter.removeListener('debugChange', this.debugChange) |
| | | MKEmitter.removeListener('reloadMenuView', this.reloadMenuView) |
| | | MKEmitter.removeListener('resetActiveMenu', this.resetActiveMenu) |
| | |
| | | this.state.config.interfaces.forEach(m => { |
| | | window.GLOB.CacheData.delete(m.uuid) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | interFinish = (MenuID, interId) => { |
| | | if (!this.stepInter || this.stepInter.MenuID !== MenuID) return |
| | | |
| | | this.stepInter.inters = this.stepInter.inters.filter(item => item !== interId) |
| | | |
| | | if (this.stepInter.inters.length === 0) { |
| | | this.setState({loadinginter: false}) |
| | | |
| | | if (this.stepInter.params.length === 0) { |
| | | setTimeout(() => { // 延时加载状态 |
| | | this.setState({ |
| | | loadingview: false |
| | | }) |
| | | }, 1000) |
| | | } else { |
| | | this.loadmaindata(this.stepInter.params) |
| | | } |
| | | |
| | | MKEmitter.emit('initFinish', this.stepInter.MenuID) |
| | | |
| | | this.stepInter = null |
| | | } |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | this.stepInter = null |
| | | |
| | | this.setState({ |
| | | BID: '', // 页面跳转时携带ID |
| | | loadingview: true, // 页面加载中 |
| | |
| | | } |
| | | |
| | | getComponents = () => { |
| | | const { config, BID, data, mainSearch } = this.state |
| | | const { config, BID, data, mainSearch, loadinginter } = this.state |
| | | |
| | | if (!config || !config.components) return |
| | | if (!config || !config.components || loadinginter) return |
| | | |
| | | return config.components.map(item => { |
| | | let style = null |
| | |
| | | const { loadingview, viewlost, config, loading, shortcuts, BID } = this.state |
| | | |
| | | return ( |
| | | <div className={'custom-page-wrap ' + (loadingview || loading ? 'loading' : '')} id={this.state.ContainerId} style={config ? config.style : null}> |
| | | <div className={`custom-page-wrap ${config && config.minWidth ? 'mk-scroll' : ''} ${loadingview || loading ? 'loading' : ''}`} id={this.state.ContainerId} style={config ? config.style : null}> |
| | | {(loadingview || (loading && !config.$cache)) ? <Spin className="view-spin" size="large" /> : null} |
| | | <Row id={config ? 'menu' + config.uuid : ''} className="component-wrap">{this.getComponents()}</Row> |
| | | <Row id={config ? 'menu' + config.uuid : ''} style={config && config.minWidth ? {minWidth: config.minWidth} : null} className="component-wrap">{this.getComponents()}</Row> |
| | | {config && config.interfaces.length > 0 ? <MkInterfaces BID={BID} interfaces={config.interfaces}/> : null} |
| | | {config && window.GLOB.breakpoint ? <DebugTable /> : null} |
| | | {!window.GLOB.mkHS && window.GLOB.systemType !== 'production' ? <TableNodes config={config} /> : null} |