From 7046b2568593b72f3640df6796a2b81980134030 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 18 九月 2022 23:45:57 +0800 Subject: [PATCH] 2022-09-18 --- src/tabviews/custom/components/timeline/normal-timeline/index.jsx | 23 +++++++++++++++++++---- 1 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx index 1dbcafe..99f4cda 100644 --- a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx +++ b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx @@ -8,6 +8,7 @@ import asyncComponent from '@/utils/asyncComponent' import UtilsDM from '@/utils/utils-datamanage.js' import MKEmitter from '@/utils/events.js' +import TimerTask from '@/utils/timer-task.js' import './index.scss' const CardCellComponent = asyncComponent(() => import('@/tabviews/custom/components/card/cardcellList')) @@ -109,10 +110,19 @@ } componentDidMount () { + const { config } = this.state + MKEmitter.addListener('reloadData', this.reloadData) 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(true) + }) + } } shouldComponentUpdate (nextProps, nextState) { @@ -127,6 +137,8 @@ MKEmitter.removeListener('resetSelectLine', this.resetParentParam) MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) + + this.timer && this.timer.stop() } /** @@ -226,7 +238,7 @@ }) } - async loadData () { + async loadData (hastimer) { const { mainSearch } = this.props const { config, arr_field, BID, BData } = this.state @@ -257,9 +269,11 @@ return } - this.setState({ - loading: true - }) + if (!hastimer) { + this.setState({ + loading: true + }) + } let _orderBy = config.setting.order || '' let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, 1, config.setting.pageSize, BID) @@ -281,6 +295,7 @@ this.setState({ loading: false }) + this.timer && this.timer.stop() notification.error({ top: 92, message: result.message, -- Gitblit v1.8.0