| | |
| | | UNSAFE_componentWillMount () { |
| | | const { data, initdata } = this.props |
| | | let _config = fromJS(this.props.config).toJS() |
| | | let _cols = new Map() |
| | | |
| | | let _data = { $$empty: true } |
| | | let _sync = false |
| | |
| | | _data.$$uuid = _data[_config.setting.primaryKey] || '' |
| | | } |
| | | |
| | | _config.columns.forEach(item => { |
| | | if (item.type !== 'number') return |
| | | _cols.set(item.field, item) |
| | | }) |
| | | |
| | | _config.subcards.forEach(card => { |
| | | if (card.setting.click === 'button' && !card.setting.linkbtn) { |
| | | card.elements.forEach(ele => { |
| | |
| | | card.setting.click = '' |
| | | } |
| | | } |
| | | 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 |
| | | }) |
| | | card.backElements = card.backElements.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 |
| | | }) |
| | | }) |
| | | |
| | | let selected = _config.wrap.selected || 'false' |
| | |
| | | }, 200) |
| | | } |
| | | |
| | | if (_config.wrap.datatype === 'dynamic') { |
| | | if (_config.wrap.datatype === 'dynamic' && this.loaded) { |
| | | this.autoExec() |
| | | } |
| | | if (!_config.wrap.cardType && _data.$$uuid) { |
| | |
| | | autoExec = () => { |
| | | const { config, data } = this.state |
| | | |
| | | if (!config.wrap.autoExec || data.$$empty) return |
| | | if (!config.wrap.autoExec) return |
| | | |
| | | setTimeout(() => { |
| | | MKEmitter.emit('triggerBtnId', config.wrap.autoExec, [data]) |
| | | MKEmitter.emit('triggerBtnId', config.wrap.autoExec, data.$$empty ? [] : [data]) |
| | | }, 200) |
| | | } |
| | | |
| | |
| | | let _data = {} |
| | | |
| | | this.loaded = true |
| | | if (config.$cache) { |
| | | if (config.$cache && config.setting.onload !== 'false') { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | |
| | | } |
| | | }) |
| | | |
| | | if (config.timer && config.clearField) { |
| | | if (config.timer && config.clearField && result.data && result.data[0]) { |
| | | let vals = (config.clearValue || '').split(',') |
| | | if (vals.includes(_data[config.clearField])) { |
| | | if (vals.includes(result.data[0][config.clearField])) { |
| | | this.timer && this.timer.stop() |
| | | } |
| | | } |