| | |
| | | loading: false, // 数据加载状态 |
| | | data: null, |
| | | BData: '', |
| | | group: null, |
| | | group: null |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | if (_config.wrap.datatype !== 'static') { |
| | | if (_config.wrap.datatype === 'dynamic') { |
| | | _config.setting.onload = _config.setting.sync === 'true' ? 'false' : 'true' |
| | | |
| | | if (_config.setting.sync === 'true' && window.GLOB.SyncData.has(_config.dataName)) { |
| | | _data = window.GLOB.SyncData.get(_config.dataName) || [] |
| | | _data = _data[0] || {$$empty: true} |
| | |
| | | BID: BID || '', |
| | | BData: BData || '', |
| | | config: _config, |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | }, () => { |
| | | if (_config.wrap.datatype !== 'static' && config.setting.sync !== 'true' && _config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | | } |
| | | arr_field: _config.columns.map(col => col.field).join(',') |
| | | }) |
| | | } |
| | | |
| | |
| | | if (config.setting.sync === 'true') { |
| | | MKEmitter.addListener('transferSyncData', this.transferSyncData) |
| | | } |
| | | |
| | | this.initExec() |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | } |
| | | |
| | | initExec = () => { |
| | | const { config } = this.state |
| | | |
| | | if (config.wrap.datatype === 'dynamic' && config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay || 0) |
| | | } |
| | | } |
| | | |
| | | transferSyncData = (syncId) => { |
| | | const { config, group } = this.state |
| | | const { config } = this.state |
| | | |
| | | if (config.$syncId !== syncId) return |
| | | |
| | |
| | | _data = _data[0] || {$$empty: true} |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | |
| | | let _group = group |
| | | |
| | | this.setState({data: _data, group: null}, () => { |
| | | this.setState({group: _group}) |
| | | }) |
| | | this.setState({data: _data}) |
| | | |
| | | window.GLOB.SyncData.delete(config.dataName) |
| | | |