| | |
| | | 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 = '' |
| | |
| | | |
| | | 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 |
| | |
| | | } |
| | | |
| | | // 格式化默认设置 |
| | | 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 |