| | |
| | | selected: false // 选中首行 |
| | | } |
| | | |
| | | loaded = false |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { config, data, initdata } = this.props |
| | | let _config = fromJS(config).toJS() |
| | |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | if (config.setting.sync === 'true' && data) { |
| | | if (_sync && data) { |
| | | _data = data[config.dataName] || [] |
| | | _sync = false |
| | | } else if (config.setting.sync === 'true' && initdata) { |
| | | } else if (_sync && initdata) { |
| | | _data = initdata || [] |
| | | _sync = false |
| | | } |
| | | |
| | | _config.wrap.contentHeight = config.wrap.title || config.wrap.searchable === 'true' ? 'calc(100% - 45px)' : '100%' |
| | | |
| | | this.loaded = _data !== null |
| | | |
| | | this.setState({ |
| | | selected: _config.wrap.selected === 'true', |
| | |
| | | _data = nextProps.data[config.dataName] || [] |
| | | } |
| | | |
| | | this.loaded = true |
| | | |
| | | this.setState({sync: false, data: _data}, () => { |
| | | this.handleData() |
| | | }) |
| | |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { |
| | | this.loadData(true) |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | |
| | | this.setState({data: res}, () => { |
| | | this.handleData() |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | |
| | | }, () => { |
| | | this.handleData() |
| | | }) |
| | | this.loaded = true |
| | | return |
| | | } |
| | | |
| | |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | this.loaded = true |
| | | if (config.$cache) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | this.setState({ |
| | | data: result.data, |
| | | loading: false |