From 53b9fb93d0376eb02bb996935f1720b4e95cd897 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 12 十月 2022 14:41:06 +0800 Subject: [PATCH] 2022-10-12 --- src/tabviews/custom/components/table/normal-table/index.jsx | 32 ++++++++++++++++++++++++++------ 1 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx index cf98e01..8f7ea2a 100644 --- a/src/tabviews/custom/components/table/normal-table/index.jsx +++ b/src/tabviews/custom/components/table/normal-table/index.jsx @@ -8,6 +8,7 @@ import UtilsDM from '@/utils/utils-datamanage.js' import asyncComponent from '@/utils/asyncComponent' import MKEmitter from '@/utils/events.js' +import TimerTask from '@/utils/timer-task.js' import './index.scss' // 閫氱敤缁勪欢 @@ -180,7 +181,7 @@ * @param { Boolean } reset 琛ㄦ牸鏄惁閲嶇疆 * @param { String } repage 琛ㄦ牸鏄惁閲嶇疆椤电爜 */ - async loadmaindata (reset, repage, id) { + async loadmaindata (reset, repage, id, type) { const { mainSearch } = this.props const { setting, config, arr_field, search, orderBy, BID, pageIndex, pageSize, BData } = this.state @@ -214,9 +215,11 @@ return } - this.setState({ - loading: true - }) + if (type !== 'timer') { + this.setState({ + loading: true + }) + } let _orderBy = orderBy || setting.order let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID) @@ -269,6 +272,7 @@ this.setState({ loading: false }) + this.timer && this.timer.stop() notification.error({ top: 92, message: result.message, @@ -485,7 +489,7 @@ /** * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ - queryModuleParam = (menuId, btnId) => { + queryModuleParam = (menuId, callback) => { const { mainSearch } = this.props const { arr_field, config, orderBy, search, setting} = this.state @@ -501,7 +505,7 @@ }) } - MKEmitter.emit('returnModuleParam', config.uuid, btnId, { + callback({ arr_field: arr_field, orderBy: orderBy || setting.order, search: searches, @@ -612,10 +616,24 @@ } 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.setState({ + pageIndex: 1 + }, () => { + this.loadmaindata(true, 'true', '', 'timer') + this.getStatFieldsValue() + }) + }) + } } /** @@ -629,6 +647,8 @@ MKEmitter.removeListener('resetSelectLine', this.resetParentParam) MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) + + this.timer && this.timer.stop() } render() { -- Gitblit v1.8.0