From 4fdff772838dab41c8b2b08c37135fd6227bfcbb Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 19 九月 2022 01:09:52 +0800 Subject: [PATCH] Merge branch 'develop' --- src/tabviews/custom/components/carousel/data-card/index.jsx | 23 +++++++++++++++++++---- 1 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/tabviews/custom/components/carousel/data-card/index.jsx b/src/tabviews/custom/components/carousel/data-card/index.jsx index 5c3334b..788da3d 100644 --- a/src/tabviews/custom/components/carousel/data-card/index.jsx +++ b/src/tabviews/custom/components/carousel/data-card/index.jsx @@ -7,6 +7,7 @@ import UtilsDM from '@/utils/utils-datamanage.js' import MKEmitter from '@/utils/events.js' import asyncComponent from '@/utils/asyncComponent' +import TimerTask from '@/utils/timer-task.js' import './index.scss' const CardItem = asyncComponent(() => import('../cardItem')) @@ -106,9 +107,18 @@ } componentDidMount () { + const { config } = this.state + MKEmitter.addListener('resetSelectLine', this.resetParentParam) MKEmitter.addListener('queryModuleParam', this.queryModuleParam) MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) + + if (config.timer) { + this.timer = new TimerTask() + this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { + this.loadData('timer') + }) + } } shouldComponentUpdate (nextProps, nextState) { @@ -148,6 +158,8 @@ MKEmitter.removeListener('resetSelectLine', this.resetParentParam) MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) + + this.timer && this.timer.stop() } /** @@ -202,7 +214,7 @@ }) } - async loadData () { + async loadData (type) { const { mainSearch } = this.props const { config, arr_field, BID, BData } = this.state @@ -220,9 +232,11 @@ return } - this.setState({ - loading: true - }) + if (type !== 'timer') { + this.setState({ + loading: true + }) + } let _orderBy = config.setting.order || '' let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, '', '', BID) @@ -244,6 +258,7 @@ this.setState({ loading: false }) + this.timer && this.timer.stop() notification.error({ top: 92, message: result.message, -- Gitblit v1.8.0