From 2a3cc4e6cecfc6dab8b60adf93f7fde898ddc939 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 25 七月 2023 16:36:23 +0800 Subject: [PATCH] 2023-07-25 --- src/tabviews/custom/index.jsx | 32 ++++++++++++++++++++++++++------ 1 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 83bf8a9..df5b969 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -204,11 +204,12 @@ } config.$cache = config.cacheLocal === 'true' + config.$time = config.localCacheTime || 0 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.MenuName, MenuID, MenuID) + config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, param, MenuID, config.interfaces, popview, config.$cache, config.$time, config.MenuName, MenuID, MenuID) let params = [] let BID = param.$BID || '' @@ -342,10 +343,11 @@ } } - filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache, MenuName, searchId, syncId) => { + filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache, time, MenuName, searchId, syncId) => { return components.filter(item => { item.$pageId = pageId item.$cache = cache + item.$time = time item.$searchId = searchId item.$syncId = syncId @@ -439,6 +441,8 @@ item.subtabs = item.subtabs.map(tab => { tab.$pageId = pageId + tab.$cache = cache + tab.$time = time let _searchId = searchId @@ -451,7 +455,7 @@ } }) - tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache, MenuName, _searchId, tab.uuid) + tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache, time, MenuName, _searchId, tab.uuid) return tab }) @@ -464,7 +468,7 @@ return false } - item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache, MenuName, searchId, syncId) + item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache, time, MenuName, searchId, syncId) return true } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart', 'antvG6', 'antvX6'].includes(item.type)) { @@ -1125,6 +1129,22 @@ this.setState({loading: true, loadingview: false}) + if (config.$cache && config.$time) { + Api.getLCacheConfig(params[0].uuid, config.$time).then(res => { + if (!res) { + this.getMainData(param, params, config.MenuID) + } else { + this.setState({ + loading: false + }) + } + }) + } else { + this.getMainData(param, params, config.MenuID) + } + } + + getMainData = (param, params, MenuID) => { Api.genericInterface(param).then(result => { this.setState({ loading: false @@ -1153,9 +1173,9 @@ window.GLOB.SyncData.set(item.name, _data) }) - MKEmitter.emit('transferSyncData', config.MenuID) + MKEmitter.emit('transferSyncData', MenuID) } else { - MKEmitter.emit('transferSyncData', config.MenuID) + MKEmitter.emit('transferSyncData', MenuID) if (!result.message) return if (result.ErrCode === 'N') { -- Gitblit v1.8.0