| | |
| | | UNSAFE_componentWillMount () { |
| | | let _config = fromJS(this.props.config).toJS() |
| | | |
| | | let BID = '' |
| | | let BData = window.GLOB.CacheData.get(_config.$pageId) |
| | | |
| | | if (BData) { |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | let params = [] |
| | | if (_config.type !== 'group') { |
| | | _config.components = this.formatSetting(_config.components, params) |
| | | _config.components = this.formatSetting(_config.components, params, BID) |
| | | } else { |
| | | let delay = 110 |
| | | _config.components.forEach(item => { |
| | |
| | | config: _config |
| | | }, () => { |
| | | if (params.length > 0) { |
| | | this.loadmaindata(params) |
| | | this.loadmaindata(params, BID) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | formatSetting = (components, params) => { |
| | | formatSetting = (components, params, BID) => { |
| | | let delay = 110 |
| | | return components.map(item => { |
| | | if (item.type === 'tabs') return item |
| | | if (item.type === 'group') { |
| | | item.components = this.formatSetting(item.components, params) |
| | | item.components = this.formatSetting(item.components, params, BID) |
| | | return item |
| | | } |
| | | |
| | |
| | | item.setting.sync = 'false' |
| | | item.setting.onload = 'false' |
| | | } else { |
| | | params.push(getStructDefaultParam(item, searchlist, params.length === 0)) |
| | | let backend = false |
| | | if (window.backend && params.length === 0 && window.GLOB.CacheData.has('sql_' + item.uuid)) { |
| | | backend = true |
| | | } else if (window.backend && params[0] && params[0].exps) { |
| | | backend = true |
| | | } |
| | | |
| | | if (backend && !window.GLOB.CacheData.has('sql_' + item.uuid)) { |
| | | item.setting.sync = 'false' |
| | | } else { |
| | | params.push(getStructDefaultParam(item, searchlist, params.length === 0, BID)) |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | /** |
| | | * @description 主表数据加载 |
| | | */ |
| | | loadmaindata = (params) => { |
| | | loadmaindata = (params, BID) => { |
| | | const { config } = this.state |
| | | let BID = '' |
| | | let BData = window.GLOB.CacheData.get(config.$pageId) |
| | | |
| | | if (BData) { |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | let param = getStructuredParams(params, config, BID) |
| | | |
| | | if (config.$cache && config.$time) { |
| | | Api.getLCacheConfig(params[0].uuid, config.$time, BID).then(res => { |
| | | Api.getLCacheConfig(params[0].uuid || params[0].id, config.$time, BID).then(res => { |
| | | if (!res.valid) { |
| | | this.getMainData(param, params, config.uuid) |
| | | } |
| | |
| | | } |
| | | |
| | | params.forEach((item) => { |
| | | let _data = result[item.name] || '' |
| | | let _data = result[item.dataName] || '' |
| | | if (_data && !Array.isArray(_data)) { |
| | | _data = [_data] |
| | | } |
| | | window.GLOB.SyncData.set(item.name, _data) |
| | | window.GLOB.SyncData.set(item.dataName, _data) |
| | | }) |
| | | |
| | | MKEmitter.emit('transferSyncData', tabId) |