| | |
| | | config: PropTypes.object, // 配置信息 |
| | | } |
| | | |
| | | loading = false |
| | | |
| | | state = {} |
| | | |
| | | componentDidMount () { |
| | |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, config.setting.delay) |
| | | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { return false } |
| | |
| | | return |
| | | } |
| | | this.timer && this.timer.stop() |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | } |
| | | |
| | | reloadData = (publicId) => { |
| | | if (this.props.config.uuid !== publicId) return |
| | | |
| | | this.loadData() |
| | | } |
| | | |
| | | async loadData () { |
| | | const { config, BID } = this.props |
| | | |
| | | if (this.loading) return |
| | | |
| | | this.loading = true |
| | | |
| | | let param = UtilsDM.getQueryDataParams(config.setting, config.columns.map(col => col.field).join(','), [], config.setting.order, 1, 1, BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | this.loading = false |
| | | let _data = { $$empty: true } |
| | | |
| | | if (result.data && result.data[0]) { |
| | |
| | | |
| | | _data.$$loaded = true |
| | | |
| | | window.GLOB.CacheData.set(config.uuid, _data) |
| | | |
| | | MKEmitter.emit('mkPublicData', config.uuid, _data) |
| | | } else { |
| | | this.loading = false |
| | | this.timer && this.timer.stop() |
| | | notification.error({ |
| | | top: 92, |