From d6270296f0f5c816fdc36557043e9d7c8d15d2f7 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 20 十月 2021 16:58:44 +0800 Subject: [PATCH] 2021-10-20 --- src/tabviews/zshare/automatic/index.jsx | 35 ++++++++++++++--- src/tabviews/custom/components/chart/antv-scatter/index.jsx | 7 +++ src/mob/components/topbar/normal-navbar/index.scss | 1 src/tabviews/custom/components/chart/antv-bar-line/index.jsx | 7 +++ src/tabviews/custom/components/chart/antv-dashboard/index.jsx | 6 +++ src/templates/zshare/unattended/settingform/index.jsx | 4 +- src/tabviews/custom/components/chart/antv-pie/index.jsx | 7 +++ src/tabviews/custom/components/chart/custom-chart/index.jsx | 7 +++ 8 files changed, 66 insertions(+), 8 deletions(-) diff --git a/src/mob/components/topbar/normal-navbar/index.scss b/src/mob/components/topbar/normal-navbar/index.scss index c75f268..fe4a5c8 100644 --- a/src/mob/components/topbar/normal-navbar/index.scss +++ b/src/mob/components/topbar/normal-navbar/index.scss @@ -67,6 +67,7 @@ min-width: 10px; font-size: 20px; line-height: 50px; + margin-right: 10px; .anticon-search { margin-right: 5px; padding: 5px; diff --git a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx index d63f801..38d7af4 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx @@ -529,10 +529,17 @@ let result = await Api.genericInterface(param) if (result.status) { + let reset = true + + if (hastimer && is(fromJS(result.data), fromJS(this.state.data))) { + reset = false + } + this.setState({ data: result.data, loading: false }, () => { + if (!reset) return this.handleData() }) } else { diff --git a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx index fb6dbb2..5f64a9e 100644 --- a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx +++ b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx @@ -289,11 +289,17 @@ data.value = result.data[0][config.plot.valueField] } } + let reset = true + + if (hastimer && is(fromJS(data), fromJS(this.state.data))) { + reset = false + } this.setState({ data, loading: false }, () => { + if (!reset) return this.handleData() }) } else { diff --git a/src/tabviews/custom/components/chart/antv-pie/index.jsx b/src/tabviews/custom/components/chart/antv-pie/index.jsx index ade94bc..a660890 100644 --- a/src/tabviews/custom/components/chart/antv-pie/index.jsx +++ b/src/tabviews/custom/components/chart/antv-pie/index.jsx @@ -248,10 +248,17 @@ let result = await Api.genericInterface(param) if (result.status) { + let reset = true + + if (hastimer && is(fromJS(result.data), fromJS(this.state.data))) { + reset = false + } + this.setState({ data: result.data, loading: false }, () => { + if (!reset) return this.handleData() }) } else { diff --git a/src/tabviews/custom/components/chart/antv-scatter/index.jsx b/src/tabviews/custom/components/chart/antv-scatter/index.jsx index c436f6c..54a3ed8 100644 --- a/src/tabviews/custom/components/chart/antv-scatter/index.jsx +++ b/src/tabviews/custom/components/chart/antv-scatter/index.jsx @@ -282,11 +282,18 @@ let result = await Api.genericInterface(param) if (result.status) { + let reset = true + + if (hastimer && is(fromJS(result.data), fromJS(this.state.data))) { + reset = false + } + this.setState({ data: result.data, empty: false, loading: false }, () => { + if (!reset) return this.handleData() }) } else { diff --git a/src/tabviews/custom/components/chart/custom-chart/index.jsx b/src/tabviews/custom/components/chart/custom-chart/index.jsx index d72aae8..9ae9cd1 100644 --- a/src/tabviews/custom/components/chart/custom-chart/index.jsx +++ b/src/tabviews/custom/components/chart/custom-chart/index.jsx @@ -279,11 +279,18 @@ let result = await Api.genericInterface(param) if (result.status) { + let reset = true + + if (hastimer && is(fromJS(result.data), fromJS(this.state.data))) { + reset = false + } + this.setState({ data: result.data, loading: false, empty: result.data.length === 0 }, () => { + if (!reset) return this.handleData() }) } else { diff --git a/src/tabviews/zshare/automatic/index.jsx b/src/tabviews/zshare/automatic/index.jsx index 067bd17..8145aa3 100644 --- a/src/tabviews/zshare/automatic/index.jsx +++ b/src/tabviews/zshare/automatic/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Button } from 'antd' +import { Button, message } from 'antd' import MKEmitter from '@/utils/events.js' import './index.scss' @@ -21,7 +21,9 @@ timer = null componentDidMount () { + MKEmitter.addListener('modifyTabs', this.breakOff) MKEmitter.addListener('autoGetData', this.autoGetData) + MKEmitter.addListener('resetActiveMenu', this.breakOff) MKEmitter.addListener('autoExecOver', this.autoExecOver) MKEmitter.addListener('autoMaticOver', this.autoMaticOver) MKEmitter.addListener('autoMaticError', this.autoMaticError) @@ -40,11 +42,20 @@ return } clearTimeout(this.timer) + MKEmitter.removeListener('modifyTabs', this.breakOff) MKEmitter.removeListener('autoGetData', this.autoGetData) + MKEmitter.removeListener('resetActiveMenu', this.breakOff) MKEmitter.removeListener('autoExecOver', this.autoExecOver) MKEmitter.removeListener('autoMaticOver', this.autoMaticOver) MKEmitter.removeListener('autoMaticError', this.autoMaticError) MKEmitter.removeListener('autoTransSelectData', this.autoTransSelectData) + } + + breakOff = () => { + if (this.state.running) { + this.setState({running: false}) + clearTimeout(this.timer) + } } autoExecOver = (btnId, type) => { @@ -52,17 +63,19 @@ if (!this.state.running || btnId !== autoMatic.action) return - if (type === 'error') { + if (this.state.line >= 1000) { + this.breakOff() + } else if (type === 'error') { if (autoMatic.onFail === 'next') { this.setState({line: this.state.line + 1}, () => { setTimeout(() => { MKEmitter.emit('autoQueryData', config.MenuID, this.state.line) - }, 1000) + }, 2000) }) } else if (autoMatic.onFail === 'stay') { setTimeout(() => { MKEmitter.emit('autoQueryData', config.MenuID, this.state.line) - }, 1000) + }, 2000) } else { this.setState({running: false}) } @@ -71,12 +84,12 @@ this.setState({line: this.state.line + 1}, () => { setTimeout(() => { MKEmitter.emit('autoQueryData', config.MenuID, this.state.line) - }, 1000) + }, 2000) }) } else if (autoMatic.onSuccess === 'stay') { setTimeout(() => { MKEmitter.emit('autoQueryData', config.MenuID, this.state.line) - }, 1000) + }, 2000) } else { this.setState({running: false}) } @@ -130,6 +143,16 @@ this.setState({running: running, line: 1}) clearTimeout(this.timer) + + message.info('鎸塃sc閿粓姝㈣繍琛屻��') + + document.onkeydown = (event) => { + let e = event || window.event + + if (e.key === 'Escape') { + this.breakOff() + } + } } autoMaticOver = (MenuID) => { diff --git a/src/templates/zshare/unattended/settingform/index.jsx b/src/templates/zshare/unattended/settingform/index.jsx index 6549c4a..017efa0 100644 --- a/src/templates/zshare/unattended/settingform/index.jsx +++ b/src/templates/zshare/unattended/settingform/index.jsx @@ -92,8 +92,8 @@ initialValue: autoMatic.onSuccess || 'stay', })( <Radio.Group> - <Radio value="stay">褰撳墠琛�</Radio> <Radio value="next">涓嬩竴琛�</Radio> + <Radio value="stay">褰撳墠琛�</Radio> </Radio.Group> )} </Form.Item> @@ -109,9 +109,9 @@ initialValue: autoMatic.onFail || 'stop', })( <Radio.Group> - <Radio value="stop">鍋滄</Radio> <Radio value="next">涓嬩竴琛�</Radio> <Radio value="stay">褰撳墠琛�</Radio> + <Radio value="stop">鍋滄</Radio> </Radio.Group> )} </Form.Item> -- Gitblit v1.8.0