| | |
| | | visible: false |
| | | } |
| | | |
| | | loaded = false |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { data, initdata } = this.props |
| | | let _config = fromJS(this.props.config).toJS() |
| | |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | if (_config.setting && _config.wrap.datatype === 'dynamic') { |
| | | if (_config.wrap.datatype === 'dynamic') { |
| | | _sync = _config.setting.sync === 'true' |
| | | |
| | | if (_sync && data) { |
| | |
| | | _data = _data[0] || {$$empty: true} |
| | | } |
| | | _sync = false |
| | | this.loaded = true |
| | | } else if (_sync && initdata) { |
| | | _data = initdata |
| | | if (Array.isArray(_data)) { |
| | | _data = _data[0] || {$$empty: true} |
| | | } |
| | | _sync = false |
| | | this.loaded = true |
| | | } |
| | | } else if (_config.wrap.datatype === 'static') { |
| | | this.loaded = true |
| | | } |
| | | |
| | | _data.$$uuid = _data[_config.setting.primaryKey] || '' |
| | |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config, sync } = this.state |
| | | const { config } = this.state |
| | | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && (config.setting.sync !== 'true' || sync)) { |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res) return |
| | | if (!res || this.loaded) return |
| | | |
| | | let _data = res[0] |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | _data.$$BID = BID || '' |
| | | _data.$$BData = BData || '' |
| | | |
| | | this.loaded = true |
| | | |
| | | this.setState({sync: false, data: _data}, () => { |
| | | if (config.wrap.display === 'modal') { |
| | |
| | | this.setState({ |
| | | data: {$$BID: BID || '', $$BData: BData, $$empty: true} |
| | | }) |
| | | |
| | | this.loaded = true |
| | | return |
| | | } |
| | | |
| | |
| | | if (result.status) { |
| | | let _data = {} |
| | | |
| | | this.loaded = true |
| | | if (config.$cache) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |