From aa41be24e83653077d85860cb70882551912af24 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 28 十月 2022 12:53:25 +0800 Subject: [PATCH] 2022-10-28 --- src/tabviews/custom/components/timeline/normal-timeline/index.jsx | 56 +++++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 39 insertions(+), 17 deletions(-) diff --git a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx index 2cd51ef..8e6e58e 100644 --- a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx +++ b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx @@ -1,13 +1,14 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Spin, notification, Timeline, Empty } from 'antd' +import { Spin, notification, Timeline, Empty, Modal } from 'antd' import Api from '@/api' import MkIcon from '@/components/mk-icon' 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() } /** @@ -202,7 +214,7 @@ /** * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁� */ - queryModuleParam = (menuId, btnId) => { + queryModuleParam = (menuId, callback) => { const { mainSearch } = this.props const { arr_field, config } = this.state @@ -218,7 +230,7 @@ }) } - MKEmitter.emit('returnModuleParam', config.uuid, btnId, { + callback({ arr_field: arr_field, orderBy: config.setting.order || '', search: searches, @@ -226,14 +238,19 @@ }) } - async loadData () { + async loadData (hastimer) { const { mainSearch } = this.props const { config, arr_field, BID, BData } = this.state - + if (config.setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� this.setState({ data: [], }) + return + } + + if (config.setting.interType === 'inner' && config.setting.innerFunc === 'z_mk_express') { + this.getExpress() return } @@ -252,14 +269,11 @@ return } - if (config.setting.interType === 'inner' && config.setting.innerFunc === 'z_mk_express') { - this.getExpress() - return + if (!hastimer) { + this.setState({ + loading: true + }) } - - 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,11 +295,19 @@ this.setState({ loading: false }) - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) + this.timer && this.timer.stop() + + if (result.ErrCode === 'N') { + Modal.error({ + title: result.message, + }) + } else { + notification.error({ + top: 92, + message: result.message, + duration: 10 + }) + } } } -- Gitblit v1.8.0