| | |
| | | const { data, initdata } = this.props |
| | | let _config = fromJS(this.props.config).toJS() |
| | | let _card = _config.subcards[0] |
| | | let _cols = new Map() |
| | | |
| | | let _data = null |
| | | let _sync = _config.setting.sync === 'true' |
| | |
| | | }) |
| | | } |
| | | |
| | | _config.columns.forEach(item => { |
| | | if (item.type !== 'number') return |
| | | _cols.set(item.field, item) |
| | | }) |
| | | |
| | | if (_card.setting.click) { |
| | | _card.style.cursor = 'pointer' |
| | | } |
| | | |
| | | _card.elements = _card.elements.map(item => { |
| | | if (item.eleType === 'number' && item.field && _cols.has(item.field) && typeof(item.decimal) !== 'number') { |
| | | item.decimal = _cols.get(item.field).decimal || 0 |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | if (!_config.wrap.height) { // 兼容 |
| | | _config.wrap.height = _config.style.height || '300px' |
| | |
| | | this.timer && this.timer.stop() |
| | | } |
| | | |
| | | openModal = () => { |
| | | openModal = (ErrCode) => { |
| | | const { config, data } = this.state |
| | | |
| | | if (config.wrap.display !== 'modal' || !data || data.length === 0) return |
| | |
| | | localStorage.setItem(code, data[0].$$uuid + data.length) |
| | | |
| | | Api.getAppVersion(true) |
| | | |
| | | if (ErrCode === '-1') { |
| | | return |
| | | } |
| | | } |
| | | |
| | | setTimeout(() => { |
| | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | this.loaded = true |
| | | if (config.$cache) { |
| | | if (config.$cache && config.setting.onload !== 'false') { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | |
| | | }), |
| | | loading: false |
| | | }, () => { |
| | | this.openModal() |
| | | this.openModal(result.ErrCode) |
| | | }) |
| | | } else { |
| | | this.setState({ |