| | |
| | | UNSAFE_componentWillMount () { |
| | | let _config = fromJS(this.props.config).toJS() |
| | | |
| | | if (_config.type !== 'group') { |
| | | let params = [] |
| | | let BID = '' |
| | | let BData = window.GLOB.CacheData.get(_config.$pageId) |
| | | |
| | | _config.components = this.formatSetting(_config.components, params) |
| | | |
| | | if (params.length > 0) { |
| | | this.loadmaindata(params) |
| | | } |
| | | if (BData) { |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | let params = [] |
| | | if (_config.type !== 'group') { |
| | | _config.components = this.formatSetting(_config.components, params, BID) |
| | | } else { |
| | | let delay = 110 |
| | | _config.components.forEach(item => { |
| | |
| | | |
| | | this.setState({ |
| | | config: _config |
| | | }, () => { |
| | | if (params.length > 0) { |
| | | 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 || params[0].id, config.$time, BID).then(res => { |
| | | if (!res.valid) { |
| | | this.getMainData(param, params, config.uuid) |
| | | } |
| | | }) |
| | | } else { |
| | | this.getMainData(param, params, config.uuid) |
| | | } |
| | | } |
| | | |
| | | getMainData = (param, params, tabId) => { |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | if (result.message) { |
| | |
| | | } |
| | | |
| | | 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', config.uuid) |
| | | MKEmitter.emit('transferSyncData', tabId) |
| | | } else { |
| | | MKEmitter.emit('transferSyncData', config.uuid) |
| | | MKEmitter.emit('transferSyncData', tabId) |
| | | |
| | | if (!result.message) return |
| | | |
| | | if (/将截断字符串或二进制数据/ig.test(result.message)) { |
| | | result.message = result.message + '请检查字段集' |
| | | } |
| | | if (result.ErrCode === 'N') { |
| | | Modal.error({ |
| | | title: result.message, |
| | |
| | | ) |
| | | } else if (item.type === 'group' && item.subtype === 'normalgroup') { |
| | | return ( |
| | | <Col span={item.width} style={style} key={item.uuid}> |
| | | <NormalGroup config={item}/> |
| | | </Col> |
| | | <NormalGroup config={item} style={style} key={item.uuid}/> |
| | | ) |
| | | } else if (item.type === 'form' && item.subtype === 'simpleform') { |
| | | return ( |
| | |
| | | } |
| | | |
| | | return ( |
| | | <Row className="component-wrap" id={'anchor' + config.uuid} gutter={8}>{this.getComponents(config.components)}</Row> |
| | | <Row className="component-wrap" id={'anchor' + config.uuid}>{this.getComponents(config.components)}</Row> |
| | | ) |
| | | } |
| | | } |