From deb2536eaaa559d6c8ec94f81afb94b6c7806b4d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 29 三月 2024 16:15:14 +0800 Subject: [PATCH] 2024-03-29 --- src/components/tabview/index.jsx | 77 +++ src/tabviews/treepage/index.jsx | 2 src/components/tabview/index.scss | 12 src/tabviews/custom/components/chart/antv-scatter/index.jsx | 30 - src/utils/utils-datamanage.js | 51 ++ src/tabviews/custom/components/chart/antv-bar-line/index.jsx | 30 - src/tabviews/custom/components/code/sand-box/index.jsx | 30 - src/tabviews/custom/components/table/base-table/index.jsx | 37 - src/tabviews/custom/components/chart/antv-dashboard/index.jsx | 30 - src/tabviews/custom/components/editor/braft-editor/index.jsx | 31 - src/tabviews/custom/components/tree/antd-tree/index.jsx | 29 - src/tabviews/custom/components/card/double-data-card/index.jsx | 37 - src/tabviews/custom/components/chart/antv-G6/index.jsx | 30 - src/views/mkiframe/index.jsx | 23 + src/tabviews/custom/components/carousel/data-card/index.jsx | 30 - src/tabviews/custom/components/table/edit-table/index.jsx | 35 - src/api/index.js | 4 src/tabviews/custom/components/calendar/index.jsx | 29 - src/tabviews/custom/components/share/normalTable/index.jsx | 1 src/views/billprint/index.jsx | 32 + src/tabviews/custom/components/form/simple-form/index.jsx | 29 - src/tabviews/subtable/index.jsx | 4 src/tabviews/subtabtable/index.jsx | 4 src/tabviews/commontable/index.jsx | 4 src/components/breadview/index.scss | 12 src/tabviews/custom/components/iframe/index.jsx | 29 - src/tabviews/custom/components/chart/custom-chart/index.jsx | 30 - src/tabviews/custom/components/card/data-card/index.jsx | 37 - src/tabviews/custom/components/form/tab-form/index.jsx | 29 - src/tabviews/custom/components/card/table-card/index.jsx | 30 - src/tabviews/custom/components/card/prop-card/index.jsx | 30 - src/tabviews/custom/components/module/voucher/index.jsx | 14 src/tabviews/debugtable/index.jsx | 2 src/tabviews/custom/components/table/normal-table/index.jsx | 36 - src/tabviews/custom/components/interfaces/interItem/index.jsx | 30 - src/tabviews/custom/components/chart/antv-pie/index.jsx | 30 - src/tabviews/custom/components/timeline/normal-timeline/index.jsx | 29 - src/tabviews/custom/components/table/edit-table/normalTable/index.jsx | 2 src/components/breadview/index.jsx | 112 ++++- src/tabviews/custom/components/module/account/index.scss | 3 src/tabviews/custom/components/carousel/prop-card/index.jsx | 30 - src/tabviews/custom/components/form/step-form/index.jsx | 29 - src/tabviews/custom/components/card/balcony/index.jsx | 29 - 43 files changed, 410 insertions(+), 754 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index 09170ce..42bb5d4 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -401,7 +401,7 @@ this.getSystemConfig(param).then(res => { if (!res.status) { - reject() + reject(res.message) return } @@ -441,7 +441,7 @@ CacheUtils.updateIndexDBversion({version: res.app_version || '1.00', createDate: curTime}) - resolve() + resolve(list) }) }, () => { reject() diff --git a/src/components/breadview/index.jsx b/src/components/breadview/index.jsx index 3a44900..44494c8 100644 --- a/src/components/breadview/index.jsx +++ b/src/components/breadview/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' -import { BackTop, Breadcrumb, notification} from 'antd' -import { HomeOutlined, RightOutlined, RedoOutlined } from '@ant-design/icons' +import { BackTop, Breadcrumb, notification, Modal } from 'antd' +import { HomeOutlined, RightOutlined, RedoOutlined, LoadingOutlined } from '@ant-design/icons' import moment from 'moment' import 'moment/locale/zh-cn' @@ -22,8 +22,38 @@ class BreadView extends Component { state = { - tabview: null, // 鏍囩 - hasNavBar: window.GLOB.navBar === 'linkage_navigation' + tabview: null, + hasNavBar: window.GLOB.navBar === 'linkage_navigation', + visible: false + } + + reloading = false + + UNSAFE_componentWillMount () { + let home = { + MenuID: 'home_page_id', + MenuName: '棣栭〉', + type: 'Home' + } + this.setState({tabview: home}) + } + + componentDidMount () { + MKEmitter.addListener('modifyTabs', this.modifyTabs) + if (window.GLOB.forcedUpdate) { + MKEmitter.addListener('reloadTabs', this.reloadTabs) + } + } + + /** + * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 + */ + componentWillUnmount () { + this.setState = () => { + return + } + MKEmitter.removeListener('reloadTabs', this.reloadTabs) + MKEmitter.removeListener('modifyTabs', this.modifyTabs) } refreshTabview = () => { @@ -105,15 +135,6 @@ } } - UNSAFE_componentWillMount () { - let home = { - MenuID: 'home_page_id', - MenuName: '棣栭〉', - type: 'Home' - } - this.setState({tabview: home}) - } - gotoHome = () => { let home = { MenuID: 'home_page_id', @@ -134,22 +155,48 @@ } } - componentDidMount () { - MKEmitter.addListener('modifyTabs', this.modifyTabs) - } + reloadTabs = () => { + if (this.reloading) return - /** - * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 - */ - componentWillUnmount () { - this.setState = () => { - return - } - MKEmitter.removeListener('modifyTabs', this.modifyTabs) + this.reloading = true + let time = new Date().getTime() + + this.setState({visible: true}) + + Api.getAppVersion(true).then((list) => { + let _time = new Date().getTime() + let delay = _time - time + delay = delay < 3000 ? 3000 - delay : 0 + + setTimeout(() => { + this.setState({visible: false}) + this.reloading = false + + Modal.success({ + title: '鏇存柊鎴愬姛銆�', + }) + + if (list && list.length && list.includes(this.state.tabview.MenuID)) { + MKEmitter.emit('reloadMenuView', this.state.tabview.MenuID) + } + }, delay) + }, (message) => { + let _time = new Date().getTime() + let delay = _time - time + delay = delay < 3000 ? 3000 - delay : 0 + + setTimeout(() => { + this.setState({visible: false}) + this.reloading = false + Modal.error({ + title: message || '绯荤粺閰嶇疆鏇存柊澶辫触锛�', + }) + }, delay) + }) } render () { - const { tabview, hasNavBar } = this.state + const { tabview, hasNavBar, visible } = this.state return ( <section id="mk-tabgroup-wrap" className="mk-breadview-wrap"> @@ -175,6 +222,21 @@ </div> </div> </BackTop> + <Modal + visible={visible} + width={400} + closable={false} + centered={true} + footer={null} + destroyOnClose + > + <div className="mk-menus-update"> + <div className="tip"> + 绯荤粺鏇存柊涓紝璇风◢鍚� + </div> + <LoadingOutlined /> + </div> + </Modal> </section> ) } diff --git a/src/components/breadview/index.scss b/src/components/breadview/index.scss index bf7a267..d178db3 100644 --- a/src/components/breadview/index.scss +++ b/src/components/breadview/index.scss @@ -46,4 +46,16 @@ .ant-message { top: 50px; z-index: 1080; +} + +.mk-menus-update { + text-align: center; + font-size: 20px; + color: #131313; + .tip { + margin-bottom: 10px; + } + .anticon { + color: var(--mk-sys-color); + } } \ No newline at end of file diff --git a/src/components/tabview/index.jsx b/src/components/tabview/index.jsx index 06635eb..51f9743 100644 --- a/src/components/tabview/index.jsx +++ b/src/components/tabview/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import { fromJS } from 'immutable' -import {Tabs, BackTop, notification} from 'antd' -import { RedoOutlined, CloseOutlined } from '@ant-design/icons' +import { Tabs, BackTop, notification, Modal } from 'antd' +import { RedoOutlined, CloseOutlined, LoadingOutlined } from '@ant-design/icons' import moment from 'moment' import 'moment/locale/zh-cn' @@ -25,8 +25,10 @@ state = { activeId: '', tabviews: [], - iFrameHeight: 0, + visible: false } + + reloading = false UNSAFE_componentWillMount () { if (!window.GLOB.mkHS) { @@ -44,6 +46,10 @@ componentDidMount () { MKEmitter.addListener('modifyTabs', this.modifyTabs) MKEmitter.addListener('closeTabView', this.closeTabView) + + if (window.GLOB.forcedUpdate) { + MKEmitter.addListener('reloadTabs', this.reloadTabs) + } } /** @@ -54,6 +60,7 @@ return } MKEmitter.removeListener('modifyTabs', this.modifyTabs) + MKEmitter.removeListener('reloadTabs', this.reloadTabs) MKEmitter.removeListener('closeTabView', this.closeTabView) } @@ -143,6 +150,53 @@ } else { MKEmitter.emit('reloadMenuView', menu.MenuID) } + } + + reloadTabs = () => { + if (this.reloading) return + + this.reloading = true + let time = new Date().getTime() + + this.setState({visible: true}) + + Api.getAppVersion(true).then((list) => { + let _time = new Date().getTime() + let delay = _time - time + delay = delay < 3000 ? 3000 - delay : 0 + + setTimeout(() => { + this.setState({visible: false}) + this.reloading = false + + Modal.success({ + title: '鏇存柊鎴愬姛銆�', + }) + + if (list && list.length) { + let _tabIds = this.state.tabviews.map(item => item.MenuID) + list.forEach((m, i) => { + if (_tabIds.includes(m)) { + setTimeout(() => { + MKEmitter.emit('reloadMenuView', m) + }, i * 20) + } + }) + } + }, delay) + }, (message) => { + let _time = new Date().getTime() + let delay = _time - time + delay = delay < 3000 ? 3000 - delay : 0 + + setTimeout(() => { + this.setState({visible: false}) + this.reloading = false + Modal.error({ + title: message || '绯荤粺閰嶇疆鏇存柊澶辫触锛�', + }) + }, delay) + }) } modifyTabs = (tab, fixed) => { @@ -236,7 +290,7 @@ } render () { - const { tabviews, activeId } = this.state + const { tabviews, activeId, visible } = this.state return ( <section id="mk-tabgroup-wrap" className="mk-tabview-wrap"> @@ -273,6 +327,21 @@ </Tabs> } </div> + <Modal + visible={visible} + width={400} + closable={false} + centered={true} + footer={null} + destroyOnClose + > + <div className="mk-menus-update"> + <div className="tip"> + 绯荤粺鏇存柊涓紝璇风◢鍚� + </div> + <LoadingOutlined /> + </div> + </Modal> </section> ) } diff --git a/src/components/tabview/index.scss b/src/components/tabview/index.scss index 040e6bf..130fc12 100644 --- a/src/components/tabview/index.scss +++ b/src/components/tabview/index.scss @@ -110,4 +110,16 @@ .ant-message { top: 50px; z-index: 1080; +} + +.mk-menus-update { + text-align: center; + font-size: 20px; + color: #131313; + .tip { + margin-bottom: 10px; + } + .anticon { + color: var(--mk-sys-color); + } } \ No newline at end of file diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 2570ec5..41afdfd 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -603,6 +603,8 @@ let _orderBy = orderBy || setting.order let param = UtilsDM.getQueryDataParams(setting, search, _orderBy, pageIndex, pageSize, BID) + delete param.s_version_up + let result = await Api.genericInterface(param) this.getStatFieldsValue() @@ -694,6 +696,8 @@ let _orderBy = orderBy || setting.order let param = UtilsDM.getQueryDataParams(setting, search, _orderBy, pageIndex, pageSize, BID, id) + delete param.s_version_up + let result = await Api.genericInterface(param) if (result.status) { let data = fromJS(this.state.data).toJS() diff --git a/src/tabviews/custom/components/calendar/index.jsx b/src/tabviews/custom/components/calendar/index.jsx index 764dd9b..adda59d 100644 --- a/src/tabviews/custom/components/calendar/index.jsx +++ b/src/tabviews/custom/components/calendar/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Spin, notification, Modal } from 'antd' +import { Spin } from 'antd' import Api from '@/api' import asyncComponent from '@/utils/asyncComponent' @@ -264,36 +264,13 @@ loading: false }) - if (result.message) { - if (result.ErrCode === 'Y') { - Modal.success({ - title: result.message - }) - } else if (result.ErrCode === 'S') { - notification.success({ - top: 92, - message: result.message, - duration: 2 - }) - } - } + UtilsDM.querySuccess(result) } else { this.setState({ loading: false }) - if (!result.message) return - if (result.ErrCode === 'N') { - Modal.error({ - title: result.message, - }) - } else if (result.ErrCode !== '-2') { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } + UtilsDM.queryFail(result) } } diff --git a/src/tabviews/custom/components/card/balcony/index.jsx b/src/tabviews/custom/components/card/balcony/index.jsx index d3b0ce0..717fa6d 100644 --- a/src/tabviews/custom/components/card/balcony/index.jsx +++ b/src/tabviews/custom/components/card/balcony/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Spin, notification, Checkbox, Modal } from 'antd' +import { Spin, Checkbox } from 'antd' import Api from '@/api' import UtilsDM from '@/utils/utils-datamanage.js' @@ -413,37 +413,14 @@ } } - if (result.message) { - if (result.ErrCode === 'Y') { - Modal.success({ - title: result.message - }) - } else if (result.ErrCode === 'S') { - notification.success({ - top: 92, - message: result.message, - duration: 2 - }) - } - } + UtilsDM.querySuccess(result) } else { this.setState({ loading: false }) this.timer && this.timer.stop() - if (!result.message) return - if (result.ErrCode === 'N') { - Modal.error({ - title: result.message, - }) - } else if (result.ErrCode !== '-2') { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } + UtilsDM.queryFail(result) } } diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx index 9bc199c..d6e2c0f 100644 --- a/src/tabviews/custom/components/card/data-card/index.jsx +++ b/src/tabviews/custom/components/card/data-card/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Spin, Empty, notification, message, Row, Col, Pagination, Modal, Switch } from 'antd' +import { Spin, Empty, message, Row, Col, Pagination, Switch } from 'antd' import { DownOutlined } from '@ant-design/icons' import Api from '@/api' @@ -871,37 +871,15 @@ this.timer && this.timer.stop() } } - if (result.message) { - if (result.ErrCode === 'Y') { - Modal.success({ - title: result.message - }) - } else if (result.ErrCode === 'S') { - notification.success({ - top: 92, - message: result.message, - duration: 2 - }) - } - } + + UtilsDM.querySuccess(result) } else { this.setState({ loading: false }) this.timer && this.timer.stop() - if (!result.message) return - if (result.ErrCode === 'N') { - Modal.error({ - title: result.message, - }) - } else if (result.ErrCode !== '-2') { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } + UtilsDM.queryFail(result) } } @@ -1043,11 +1021,8 @@ this.setState({ loading: false }) - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) + + UtilsDM.queryFail(result) } } diff --git a/src/tabviews/custom/components/card/double-data-card/index.jsx b/src/tabviews/custom/components/card/double-data-card/index.jsx index 4903092..e4fef85 100644 --- a/src/tabviews/custom/components/card/double-data-card/index.jsx +++ b/src/tabviews/custom/components/card/double-data-card/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Spin, Empty, notification, Row, Col, Pagination, Modal, Switch } from 'antd' +import { Spin, Empty, Row, Col, Pagination, Switch } from 'antd' import { DownOutlined, UpOutlined, PlusSquareOutlined, MinusSquareOutlined } from '@ant-design/icons' import Api from '@/api' @@ -771,37 +771,15 @@ this.timer && this.timer.stop() } } - if (result.message) { - if (result.ErrCode === 'Y') { - Modal.success({ - title: result.message - }) - } else if (result.ErrCode === 'S') { - notification.success({ - top: 92, - message: result.message, - duration: 2 - }) - } - } + + UtilsDM.querySuccess(result) } else { this.setState({ loading: false }) this.timer && this.timer.stop() - if (!result.message) return - if (result.ErrCode === 'N') { - Modal.error({ - title: result.message, - }) - } else if (result.ErrCode !== '-2') { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } + UtilsDM.queryFail(result) } } @@ -959,11 +937,8 @@ this.setState({ loading: false }) - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) + + UtilsDM.queryFail(result) } } diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx index 1319e6d..0901077 100644 --- a/src/tabviews/custom/components/card/prop-card/index.jsx +++ b/src/tabviews/custom/components/card/prop-card/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Spin, notification, Col, Row, Modal } from 'antd' +import { Spin, Col, Row } from 'antd' import Api from '@/api' import UtilsDM from '@/utils/utils-datamanage.js' @@ -573,37 +573,15 @@ this.timer && this.timer.stop() } } - if (result.message) { - if (result.ErrCode === 'Y') { - Modal.success({ - title: result.message - }) - } else if (result.ErrCode === 'S') { - notification.success({ - top: 92, - message: result.message, - duration: 2 - }) - } - } + + UtilsDM.querySuccess(result) } else { this.setState({ loading: false }) this.timer && this.timer.stop() - if (!result.message) return - if (result.ErrCode === 'N') { - Modal.error({ - title: result.message, - }) - } else if (result.ErrCode !== '-2') { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } + UtilsDM.queryFail(result) } } diff --git a/src/tabviews/custom/components/card/table-card/index.jsx b/src/tabviews/custom/components/card/table-card/index.jsx index ffc4b04..231e066 100644 --- a/src/tabviews/custom/components/card/table-card/index.jsx +++ b/src/tabviews/custom/components/card/table-card/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Spin, notification, Row, Col, Empty, Pagination, Modal } from 'antd' +import { Spin, Row, Col, Empty, Pagination } from 'antd' import { DownOutlined } from '@ant-design/icons' import Api from '@/api' @@ -429,37 +429,15 @@ this.timer && this.timer.stop() } } - if (result.message) { - if (result.ErrCode === 'Y') { - Modal.success({ - title: result.message - }) - } else if (result.ErrCode === 'S') { - notification.success({ - top: 92, - message: result.message, - duration: 2 - }) - } - } + + UtilsDM.querySuccess(result) } else { this.setState({ loading: false }) this.timer && this.timer.stop() - if (!result.message) return - if (result.ErrCode === 'N') { - Modal.error({ - title: result.message, - }) - } else if (result.ErrCode !== '-2') { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } + UtilsDM.queryFail(result) } } diff --git a/src/tabviews/custom/components/carousel/data-card/index.jsx b/src/tabviews/custom/components/carousel/data-card/index.jsx index 45a3656..b2be453 100644 --- a/src/tabviews/custom/components/carousel/data-card/index.jsx +++ b/src/tabviews/custom/components/carousel/data-card/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Spin, Empty, notification, Carousel, Modal, Checkbox, Button } from 'antd' +import { Spin, Empty, Carousel, Modal, Checkbox, Button } from 'antd' import { LeftOutlined, RightOutlined } from '@ant-design/icons' import Api from '@/api' @@ -379,37 +379,15 @@ this.timer && this.timer.stop() } } - if (result.message) { - if (result.ErrCode === 'Y') { - Modal.success({ - title: result.message - }) - } else if (result.ErrCode === 'S') { - notification.success({ - top: 92, - message: result.message, - duration: 2 - }) - } - } + + UtilsDM.querySuccess(result) } else { this.setState({ loading: false }) this.timer && this.timer.stop() - if (!result.message) return - if (result.ErrCode === 'N') { - Modal.error({ - title: result.message, - }) - } else if (result.ErrCode !== '-2') { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } + UtilsDM.queryFail(result) } } diff --git a/src/tabviews/custom/components/carousel/prop-card/index.jsx b/src/tabviews/custom/components/carousel/prop-card/index.jsx index 572b869..d1808aa 100644 --- a/src/tabviews/custom/components/carousel/prop-card/index.jsx +++ b/src/tabviews/custom/components/carousel/prop-card/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Spin, notification, Carousel, Modal, Checkbox, Button } from 'antd' +import { Spin, Carousel, Modal, Checkbox, Button } from 'antd' import { LeftOutlined, RightOutlined } from '@ant-design/icons' import asyncComponent from '@/utils/asyncComponent' @@ -382,37 +382,15 @@ this.timer && this.timer.stop() } } - if (result.message) { - if (result.ErrCode === 'Y') { - Modal.success({ - title: result.message - }) - } else if (result.ErrCode === 'S') { - notification.success({ - top: 92, - message: result.message, - duration: 2 - }) - } - } + + UtilsDM.querySuccess(result) } else { this.setState({ loading: false }) this.timer && this.timer.stop() - if (!result.message) return - if (result.ErrCode === 'N') { - Modal.error({ - title: result.message, - }) - } else if (result.ErrCode !== '-2') { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } + UtilsDM.queryFail(result) } } diff --git a/src/tabviews/custom/components/chart/antv-G6/index.jsx b/src/tabviews/custom/components/chart/antv-G6/index.jsx index 64536d5..c7dd705 100644 --- a/src/tabviews/custom/components/chart/antv-G6/index.jsx +++ b/src/tabviews/custom/components/chart/antv-G6/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Modal, notification, Spin, Empty } from 'antd' +import { Spin, Empty } from 'antd' import G6 from '@antv/g6' import Api from '@/api' @@ -1167,36 +1167,14 @@ this.data = result.data || [] this.handleData() } - if (result.message) { - if (result.ErrCode === 'Y') { - Modal.success({ - title: result.message - }) - } else if (result.ErrCode === 'S') { - notification.success({ - top: 92, - message: result.message, - duration: 2 - }) - } - } + + UtilsDM.querySuccess(result) } else { this.setState({ loading: false }) - if (!result.message) return - if (result.ErrCode === 'N') { - Modal.error({ - title: result.message, - }) - } else if (result.ErrCode !== '-2') { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } + UtilsDM.queryFail(result) } } 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 75a01b7..38923d3 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx @@ -3,7 +3,7 @@ import { is, fromJS } from 'immutable' import { Chart } from '@antv/g2' import DataSet from '@antv/data-set' -import { Spin, Empty, notification, Modal } from 'antd' +import { Spin, Empty } from 'antd' import { DownloadOutlined } from '@ant-design/icons' import moment from 'moment' @@ -662,37 +662,15 @@ this.timer && this.timer.stop() } } - if (result.message) { - if (result.ErrCode === 'Y') { - Modal.success({ - title: result.message - }) - } else if (result.ErrCode === 'S') { - notification.success({ - top: 92, - message: result.message, - duration: 2 - }) - } - } + + UtilsDM.querySuccess(result) } else { this.setState({ loading: false }) this.timer && this.timer.stop() - if (!result.message) return - if (result.ErrCode === 'N') { - Modal.error({ - title: result.message, - }) - } else if (result.ErrCode !== '-2') { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } + UtilsDM.queryFail(result) } } diff --git a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx index 15cf833..a9a530a 100644 --- a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx +++ b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx @@ -2,7 +2,7 @@ import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' import { Chart, registerShape } from '@antv/g2' -import { Spin, notification, Modal } from 'antd' +import { Spin } from 'antd' // import { DownloadOutlined } from '@ant-design/icons' import moment from 'moment' @@ -368,37 +368,15 @@ this.timer && this.timer.stop() } } - if (result.message) { - if (result.ErrCode === 'Y') { - Modal.success({ - title: result.message - }) - } else if (result.ErrCode === 'S') { - notification.success({ - top: 92, - message: result.message, - duration: 2 - }) - } - } + + UtilsDM.querySuccess(result) } else { this.setState({ loading: false }) this.timer && this.timer.stop() - if (!result.message) return - if (result.ErrCode === 'N') { - Modal.error({ - title: result.message, - }) - } else if (result.ErrCode !== '-2') { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } + UtilsDM.queryFail(result) } } diff --git a/src/tabviews/custom/components/chart/antv-pie/index.jsx b/src/tabviews/custom/components/chart/antv-pie/index.jsx index 44ed1cc..bc32406 100644 --- a/src/tabviews/custom/components/chart/antv-pie/index.jsx +++ b/src/tabviews/custom/components/chart/antv-pie/index.jsx @@ -3,7 +3,7 @@ import { is, fromJS } from 'immutable' import { Chart } from '@antv/g2' import DataSet, { DataView } from '@antv/data-set' -import { Spin, Empty, notification, Modal } from 'antd' +import { Spin, Empty } from 'antd' // import { DownloadOutlined } from '@ant-design/icons' import moment from 'moment' @@ -316,37 +316,15 @@ this.timer && this.timer.stop() } } - if (result.message) { - if (result.ErrCode === 'Y') { - Modal.success({ - title: result.message - }) - } else if (result.ErrCode === 'S') { - notification.success({ - top: 92, - message: result.message, - duration: 2 - }) - } - } + + UtilsDM.querySuccess(result) } else { this.setState({ loading: false }) this.timer && this.timer.stop() - if (!result.message) return - if (result.ErrCode === 'N') { - Modal.error({ - title: result.message, - }) - } else if (result.ErrCode !== '-2') { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } + UtilsDM.queryFail(result) } } diff --git a/src/tabviews/custom/components/chart/antv-scatter/index.jsx b/src/tabviews/custom/components/chart/antv-scatter/index.jsx index f4751c8..891181e 100644 --- a/src/tabviews/custom/components/chart/antv-scatter/index.jsx +++ b/src/tabviews/custom/components/chart/antv-scatter/index.jsx @@ -2,7 +2,7 @@ import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' import { Chart } from '@antv/g2' -import { Spin, Empty, notification, Modal } from 'antd' +import { Spin, Empty } from 'antd' import { DownloadOutlined } from '@ant-design/icons' import moment from 'moment' @@ -347,37 +347,15 @@ this.timer && this.timer.stop() } } - if (result.message) { - if (result.ErrCode === 'Y') { - Modal.success({ - title: result.message - }) - } else if (result.ErrCode === 'S') { - notification.success({ - top: 92, - message: result.message, - duration: 2 - }) - } - } + + UtilsDM.querySuccess(result) } else { this.setState({ loading: false }) this.timer && this.timer.stop() - if (!result.message) return - if (result.ErrCode === 'N') { - Modal.error({ - title: result.message, - }) - } else if (result.ErrCode !== '-2') { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } + UtilsDM.queryFail(result) } } diff --git a/src/tabviews/custom/components/chart/custom-chart/index.jsx b/src/tabviews/custom/components/chart/custom-chart/index.jsx index 1fcd7c8..747e2fc 100644 --- a/src/tabviews/custom/components/chart/custom-chart/index.jsx +++ b/src/tabviews/custom/components/chart/custom-chart/index.jsx @@ -4,7 +4,7 @@ import { Chart } from '@antv/g2' import DataSet from '@antv/data-set' import * as echarts from 'echarts' -import { Spin, Empty, notification, Modal } from 'antd' +import { Spin, Empty, notification } from 'antd' import Api from '@/api' import Utils from '@/utils/utils.js' @@ -340,37 +340,15 @@ this.timer && this.timer.stop() } } - if (result.message) { - if (result.ErrCode === 'Y') { - Modal.success({ - title: result.message - }) - } else if (result.ErrCode === 'S') { - notification.success({ - top: 92, - message: result.message, - duration: 2 - }) - } - } + + UtilsDM.querySuccess(result) } else { this.setState({ loading: false }) this.timer && this.timer.stop() - if (!result.message) return - if (result.ErrCode === 'N') { - Modal.error({ - title: result.message, - }) - } else if (result.ErrCode !== '-2') { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } + UtilsDM.queryFail(result) } } diff --git a/src/tabviews/custom/components/code/sand-box/index.jsx b/src/tabviews/custom/components/code/sand-box/index.jsx index bc158d3..c460bcc 100644 --- a/src/tabviews/custom/components/code/sand-box/index.jsx +++ b/src/tabviews/custom/components/code/sand-box/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Spin, notification, Modal } from 'antd' +import { Spin, notification } from 'antd' import Api from '@/api' import UtilsDM from '@/utils/utils-datamanage.js' @@ -261,36 +261,14 @@ loading: false }) - if (result.message) { - if (result.ErrCode === 'Y') { - Modal.success({ - title: result.message - }) - } else if (result.ErrCode === 'S') { - notification.success({ - top: 92, - message: result.message, - duration: 2 - }) - } - } + + UtilsDM.querySuccess(result) } else { this.setState({ loading: false }) - if (!result.message) return - if (result.ErrCode === 'N') { - Modal.error({ - title: result.message - }) - } else if (result.ErrCode !== '-2') { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } + UtilsDM.queryFail(result) } } diff --git a/src/tabviews/custom/components/editor/braft-editor/index.jsx b/src/tabviews/custom/components/editor/braft-editor/index.jsx index ccb80cd..0b6db75 100644 --- a/src/tabviews/custom/components/editor/braft-editor/index.jsx +++ b/src/tabviews/custom/components/editor/braft-editor/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Spin, notification, Modal } from 'antd' +import { Spin } from 'antd' import asyncComponent from '@/utils/asyncComponent' import Api from '@/api' @@ -211,37 +211,14 @@ data: _data, loading: false }) - - if (result.message) { - if (result.ErrCode === 'Y') { - Modal.success({ - title: result.message - }) - } else if (result.ErrCode === 'S') { - notification.success({ - top: 92, - message: result.message, - duration: 2 - }) - } - } + + UtilsDM.querySuccess(result) } else { this.setState({ loading: false }) - if (!result.message) return - if (result.ErrCode === 'N') { - Modal.error({ - title: result.message - }) - } else if (result.ErrCode !== '-2') { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } + UtilsDM.queryFail(result) } } diff --git a/src/tabviews/custom/components/form/simple-form/index.jsx b/src/tabviews/custom/components/form/simple-form/index.jsx index b9928e1..9954a82 100644 --- a/src/tabviews/custom/components/form/simple-form/index.jsx +++ b/src/tabviews/custom/components/form/simple-form/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Spin, notification, Modal, Button } from 'antd' +import { Spin, Button } from 'antd' import Api from '@/api' import UtilsDM from '@/utils/utils-datamanage.js' @@ -387,36 +387,13 @@ MKEmitter.emit('resetSelectLine', config.uuid, _data.$$uuid, _data) - if (result.message) { - if (result.ErrCode === 'Y') { - Modal.success({ - title: result.message - }) - } else if (result.ErrCode === 'S') { - notification.success({ - top: 92, - message: result.message, - duration: 2 - }) - } - } + UtilsDM.querySuccess(result) } else { this.setState({ loading: false, }) - if (!result.message) return - if (result.ErrCode === 'N') { - Modal.error({ - title: result.message, - }) - } else if (result.ErrCode !== '-2') { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } + UtilsDM.queryFail(result) } } diff --git a/src/tabviews/custom/components/form/step-form/index.jsx b/src/tabviews/custom/components/form/step-form/index.jsx index b22dba9..50e227b 100644 --- a/src/tabviews/custom/components/form/step-form/index.jsx +++ b/src/tabviews/custom/components/form/step-form/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Spin, notification, Button, Modal } from 'antd' +import { Spin, Button } from 'antd' import Api from '@/api' import UtilsDM from '@/utils/utils-datamanage.js' @@ -405,36 +405,13 @@ MKEmitter.emit('resetSelectLine', config.uuid, _data.$$uuid, _data) - if (result.message) { - if (result.ErrCode === 'Y') { - Modal.success({ - title: result.message - }) - } else if (result.ErrCode === 'S') { - notification.success({ - top: 92, - message: result.message, - duration: 2 - }) - } - } + UtilsDM.querySuccess(result) } else { this.setState({ loading: false, }) - if (!result.message) return - if (result.ErrCode === 'N') { - Modal.error({ - title: result.message, - }) - } else if (result.ErrCode !== '-2') { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } + UtilsDM.queryFail(result) } } diff --git a/src/tabviews/custom/components/form/tab-form/index.jsx b/src/tabviews/custom/components/form/tab-form/index.jsx index da36b3c..15fe9d4 100644 --- a/src/tabviews/custom/components/form/tab-form/index.jsx +++ b/src/tabviews/custom/components/form/tab-form/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Spin, notification, Modal } from 'antd' +import { Spin } from 'antd' import Api from '@/api' import UtilsDM from '@/utils/utils-datamanage.js' @@ -339,36 +339,13 @@ MKEmitter.emit('resetSelectLine', config.uuid, _data.$$uuid, _data) - if (result.message) { - if (result.ErrCode === 'Y') { - Modal.success({ - title: result.message - }) - } else if (result.ErrCode === 'S') { - notification.success({ - top: 92, - message: result.message, - duration: 2 - }) - } - } + UtilsDM.querySuccess(result) } else { this.setState({ loading: false, }) - if (!result.message) return - if (result.ErrCode === 'N') { - Modal.error({ - title: result.message, - }) - } else if (result.ErrCode !== '-2') { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } + UtilsDM.queryFail(result) } } diff --git a/src/tabviews/custom/components/iframe/index.jsx b/src/tabviews/custom/components/iframe/index.jsx index 3737715..7e544be 100644 --- a/src/tabviews/custom/components/iframe/index.jsx +++ b/src/tabviews/custom/components/iframe/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Input, Modal, notification, Empty, Spin } from 'antd' +import { Input, Empty, Spin } from 'antd' import Api from '@/api' import UtilsDM from '@/utils/utils-datamanage.js' @@ -212,32 +212,9 @@ data: _data }) - if (result.message) { - if (result.ErrCode === 'Y') { - Modal.success({ - title: result.message - }) - } else if (result.ErrCode === 'S') { - notification.success({ - top: 92, - message: result.message, - duration: 2 - }) - } - } + UtilsDM.querySuccess(result) } else { - if (!result.message) return - if (result.ErrCode === 'N') { - Modal.error({ - title: result.message, - }) - } else if (result.ErrCode !== '-2') { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } + UtilsDM.queryFail(result) } } diff --git a/src/tabviews/custom/components/interfaces/interItem/index.jsx b/src/tabviews/custom/components/interfaces/interItem/index.jsx index 185a5a6..87e0bd9 100644 --- a/src/tabviews/custom/components/interfaces/interItem/index.jsx +++ b/src/tabviews/custom/components/interfaces/interItem/index.jsx @@ -1,6 +1,5 @@ import {Component} from 'react' import PropTypes from 'prop-types' -import { notification, Modal } from 'antd' import Api from '@/api' import UtilsDM from '@/utils/utils-datamanage.js' @@ -153,39 +152,16 @@ MKEmitter.emit('interFinish', config.MenuID, config.uuid) } - if (result.message) { - if (result.ErrCode === 'Y') { - Modal.success({ - title: result.message - }) - } else if (result.ErrCode === 'S') { - notification.success({ - top: 92, - message: result.message, - duration: 2 - }) - } - } + UtilsDM.querySuccess(result) } else { this.loading = false this.timer && this.timer.stop() - - if (!result.message) return - if (result.ErrCode === 'N') { - Modal.error({ - title: result.message, - }) - } else if (result.ErrCode !== '-2') { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } if (config.setting.loadlevel === 'init') { MKEmitter.emit('interFinish', config.MenuID, config.uuid) } + + UtilsDM.queryFail(result) } } diff --git a/src/tabviews/custom/components/module/account/index.scss b/src/tabviews/custom/components/module/account/index.scss index 1821b31..68b9ba8 100644 --- a/src/tabviews/custom/components/module/account/index.scss +++ b/src/tabviews/custom/components/module/account/index.scss @@ -8,8 +8,7 @@ color: #000000; .ant-select { - min-width: 250px; - max-width: 300px; + width: 270px; color: #000000; } diff --git a/src/tabviews/custom/components/module/voucher/index.jsx b/src/tabviews/custom/components/module/voucher/index.jsx index 6b70332..ec558e4 100644 --- a/src/tabviews/custom/components/module/voucher/index.jsx +++ b/src/tabviews/custom/components/module/voucher/index.jsx @@ -1189,8 +1189,10 @@ return } - Modal.success({ - title: '宸茬粡閫氳繃瀹℃牳' + notification.success({ + top: 92, + message: '宸茬粡閫氳繃瀹℃牳', + duration: 2 }) that.getVoucher() @@ -1236,9 +1238,11 @@ }) return } - - Modal.success({ - title: '瀹℃牳宸插彇娑�' + + notification.success({ + top: 92, + message: '瀹℃牳宸插彇娑�', + duration: 2 }) that.getVoucher() diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx index be37c21..04f091d 100644 --- a/src/tabviews/custom/components/share/normalTable/index.jsx +++ b/src/tabviews/custom/components/share/normalTable/index.jsx @@ -256,6 +256,7 @@ } if (col.format === 'thdSeparator') { + content = content + '' content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') } diff --git a/src/tabviews/custom/components/table/base-table/index.jsx b/src/tabviews/custom/components/table/base-table/index.jsx index ec29c8f..50dd7bc 100644 --- a/src/tabviews/custom/components/table/base-table/index.jsx +++ b/src/tabviews/custom/components/table/base-table/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { notification, Modal } from 'antd' +import { notification } from 'antd' import Api from '@/api' import UtilsDM from '@/utils/utils-datamanage.js' @@ -143,6 +143,7 @@ this.requestId = config.uuid + new Date().getTime() let result = await Api.genericInterface(param, setting.js_script, '', this.requestId) + if (result.status) { if (result.$requestId && this.requestId !== result.$requestId) return @@ -228,19 +229,7 @@ } } - if (result.message) { - if (result.ErrCode === 'Y') { - Modal.success({ - title: result.message - }) - } else if (result.ErrCode === 'S') { - notification.success({ - top: 92, - message: result.message, - duration: 2 - }) - } - } + UtilsDM.querySuccess(result) } else { this.setState({ loading: false @@ -250,18 +239,7 @@ MKEmitter.emit('autoMaticError', config.MenuID) } - if (!result.message) return - if (result.ErrCode === 'N') { - Modal.error({ - title: result.message, - }) - } else if (result.ErrCode !== '-2') { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } + UtilsDM.queryFail(result) } } @@ -383,11 +361,8 @@ this.setState({ loading: false }) - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) + + UtilsDM.queryFail(result) } } diff --git a/src/tabviews/custom/components/table/edit-table/index.jsx b/src/tabviews/custom/components/table/edit-table/index.jsx index 14776ec..1987005 100644 --- a/src/tabviews/custom/components/table/edit-table/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/index.jsx @@ -1,7 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { notification, Modal } from 'antd' import Api from '@/api' import Utils from '@/utils/utils.js' @@ -355,36 +354,13 @@ MKEmitter.emit('transferData' + setting.tableId, data) - if (result.message) { - if (result.ErrCode === 'Y') { - Modal.success({ - title: result.message - }) - } else if (result.ErrCode === 'S') { - notification.success({ - top: 92, - message: result.message, - duration: 2 - }) - } - } + UtilsDM.querySuccess(result) } else { this.setState({ loading: false }) - if (!result.message) return - if (result.ErrCode === 'N') { - Modal.error({ - title: result.message, - }) - } else if (result.ErrCode !== '-2') { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } + UtilsDM.queryFail(result) } } @@ -487,11 +463,8 @@ this.setState({ loading: false }) - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) + + UtilsDM.queryFail(result) } } diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx index a7571dd..6909089 100644 --- a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx +++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx @@ -866,6 +866,7 @@ } if (col.format === 'thdSeparator') { + content = content + '' content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') } @@ -1190,6 +1191,7 @@ } if (col.format === 'thdSeparator') { + content = content + '' content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,') } diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx index 92c7018..766cfd5 100644 --- a/src/tabviews/custom/components/table/normal-table/index.jsx +++ b/src/tabviews/custom/components/table/normal-table/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { notification, Collapse, Modal } from 'antd' +import { Collapse } from 'antd' import Api from '@/api' import UtilsDM from '@/utils/utils-datamanage.js' @@ -529,37 +529,14 @@ } } - if (result.message) { - if (result.ErrCode === 'Y') { - Modal.success({ - title: result.message - }) - } else if (result.ErrCode === 'S') { - notification.success({ - top: 92, - message: result.message, - duration: 2 - }) - } - } + UtilsDM.querySuccess(result) } else { this.setState({ loading: false }) this.timer && this.timer.stop() - if (!result.message) return - if (result.ErrCode === 'N') { - Modal.error({ - title: result.message, - }) - } else if (result.ErrCode !== '-2') { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } + UtilsDM.queryFail(result) } } @@ -685,11 +662,8 @@ this.setState({ loading: false }) - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) + + UtilsDM.queryFail(result) } } diff --git a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx index 698328e..e2444f1 100644 --- a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx +++ b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Spin, notification, Timeline, Empty, Modal } from 'antd' +import { Spin, notification, Timeline, Empty } from 'antd' import Api from '@/api' import MkIcon from '@/components/mk-icon' @@ -377,37 +377,14 @@ } } - if (result.message) { - if (result.ErrCode === 'Y') { - Modal.success({ - title: result.message - }) - } else if (result.ErrCode === 'S') { - notification.success({ - top: 92, - message: result.message, - duration: 2 - }) - } - } + UtilsDM.querySuccess(result) } else { this.setState({ loading: false }) this.timer && this.timer.stop() - if (!result.message) return - if (result.ErrCode === 'N') { - Modal.error({ - title: result.message, - }) - } else if (result.ErrCode !== '-2') { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } + UtilsDM.queryFail(result) } } diff --git a/src/tabviews/custom/components/tree/antd-tree/index.jsx b/src/tabviews/custom/components/tree/antd-tree/index.jsx index 721d876..6e7f7b1 100644 --- a/src/tabviews/custom/components/tree/antd-tree/index.jsx +++ b/src/tabviews/custom/components/tree/antd-tree/index.jsx @@ -1,7 +1,7 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Spin, Empty, notification, Input, Tree, Modal, Dropdown } from 'antd' +import { Spin, Empty, Input, Tree, Dropdown } from 'antd' import { FolderOpenOutlined, FolderOutlined, FileOutlined, MoreOutlined } from '@ant-design/icons' import Api from '@/api' @@ -321,37 +321,14 @@ } } - if (result.message) { - if (result.ErrCode === 'Y') { - Modal.success({ - title: result.message - }) - } else if (result.ErrCode === 'S') { - notification.success({ - top: 92, - message: result.message, - duration: 2 - }) - } - } + UtilsDM.querySuccess(result) } else { this.setState({ loading: false }) this.timer && this.timer.stop() - if (!result.message) return - if (result.ErrCode === 'N') { - Modal.error({ - title: result.message, - }) - } else if (result.ErrCode !== '-2') { - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) - } + UtilsDM.queryFail(result) } } diff --git a/src/tabviews/debugtable/index.jsx b/src/tabviews/debugtable/index.jsx index 9f52daa..155332e 100644 --- a/src/tabviews/debugtable/index.jsx +++ b/src/tabviews/debugtable/index.jsx @@ -44,6 +44,8 @@ let param = UtilsDM.getQueryDataParams(setting, [], 'sort', 1, 50, '') + delete param.s_version_up + let result = await Api.genericInterface(param) if (result.status) { diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index c6290da..39cbb1d 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -480,6 +480,8 @@ let _orderBy = orderBy || setting.order let param = UtilsDM.getQueryDataParams(setting, searches, _orderBy, pageIndex, pageSize, BID) + delete param.s_version_up + let result = await Api.genericInterface(param) this.getStatFieldsValue(searches) @@ -566,6 +568,8 @@ let _orderBy = orderBy || setting.order let param = UtilsDM.getQueryDataParams(setting, searches, _orderBy, pageIndex, pageSize, BID, id) + delete param.s_version_up + let result = await Api.genericInterface(param) if (result.status) { let data = fromJS(this.state.data).toJS() diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx index 131a044..bc3c2db 100644 --- a/src/tabviews/subtabtable/index.jsx +++ b/src/tabviews/subtabtable/index.jsx @@ -414,6 +414,8 @@ let _orderBy = orderBy || setting.order let param = UtilsDM.getQueryDataParams(setting, searches, _orderBy, pageIndex, pageSize, BID) + delete param.s_version_up + let result = await Api.genericInterface(param) this.getStatFieldsValue(searches) @@ -539,6 +541,8 @@ let _orderBy = orderBy || setting.order let param = UtilsDM.getQueryDataParams(setting, searches, _orderBy, pageIndex, pageSize, BID, id) + delete param.s_version_up + let result = await Api.genericInterface(param) if (result.status) { let data = fromJS(this.state.data).toJS() diff --git a/src/tabviews/treepage/index.jsx b/src/tabviews/treepage/index.jsx index 00b7d2f..6d08b71 100644 --- a/src/tabviews/treepage/index.jsx +++ b/src/tabviews/treepage/index.jsx @@ -265,6 +265,8 @@ let param = UtilsDM.getQueryDataParams(setting, [], setting.order, '', '', BID) + delete param.s_version_up + let result = await Api.genericInterface(param) if (result.status) { let parentNodes = [] diff --git a/src/utils/utils-datamanage.js b/src/utils/utils-datamanage.js index 91dfd4a..1291a36 100644 --- a/src/utils/utils-datamanage.js +++ b/src/utils/utils-datamanage.js @@ -1,16 +1,13 @@ import md5 from 'md5' import moment from 'moment' +import { notification, Modal } from 'antd' + +import MKEmitter from '@/utils/events.js' import Utils from './utils.js' export default class DataUtils { /** - * @description 鏁版嵁婧愬悕绉帮紝鐢ㄤ簬缁熶竴鏌ヨ - * @param {Object} setting 鏁版嵁婧愯缃� - * @param {Array} search 鎼滅储鏉′欢 - * @param {String} orderBy 鎺掑簭鏂瑰紡 - * @param {Number} pageIndex 椤电爜 - * @param {Number} pageSize 姣忛〉鏁伴噺 - * @param {String} BID 涓婄骇ID + * @description 鏁版嵁婧愮粺涓�鏌ヨ */ static getQueryDataParams (setting, search = [], orderBy = '', pageIndex = 1, pageSize = 10, BID, id, year) { let param = null @@ -442,6 +439,46 @@ return param } + + /** + * @description 鏁版嵁鑾峰彇鎴愬姛 + */ + static querySuccess (result) { + if (!result.message) return + + if (result.ErrCode === 'Y') { + Modal.success({ + title: result.message + }) + } else if (result.ErrCode === 'S') { + notification.success({ + top: 92, + message: result.message, + duration: 2 + }) + } + } + + /** + * @description 鏁版嵁鑾峰彇澶辫触 + */ + static queryFail (result) { + if (!result.message && result.ErrCode !== 'version_up') return + + if (result.ErrCode === 'N') { + Modal.error({ + title: result.message, + }) + } else if (result.ErrCode === 'version_up') { + MKEmitter.emit('reloadTabs') + } else if (result.ErrCode !== '-2') { + notification.error({ + top: 92, + message: result.message, + duration: 10 + }) + } + } } /** diff --git a/src/views/billprint/index.jsx b/src/views/billprint/index.jsx index 58d9659..416c51d 100644 --- a/src/views/billprint/index.jsx +++ b/src/views/billprint/index.jsx @@ -1,6 +1,6 @@ import React, { Component } from 'react' import { is, fromJS } from 'immutable' -import { Col, Row, Spin, notification, Button } from 'antd' +import { Col, Row, Spin, notification, Button, Modal } from 'antd' import moment from 'moment' import Api from '@/api' @@ -47,6 +47,8 @@ auto: true, ismob: /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i.test(navigator.userAgent) } + + reloading = false UNSAFE_componentWillMount() { const { params } = this.props.match @@ -917,11 +919,15 @@ if (item.func === 'sPC_Get_structured_data' && /灏嗘埅鏂瓧绗︿覆鎴栦簩杩涘埗鏁版嵁/ig.test(res.message)) { res.message = res.message + '璇锋鏌ュ瓧娈甸泦' } - notification.warning({ - top: 92, - message: res.message, - duration: 5 - }) + if (res.ErrCode === 'version_up') { + this.reloadTabs() + } else { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + } resolve(false) } else { res.componentId = componentId @@ -1081,6 +1087,20 @@ }) } + reloadTabs = () => { + if (this.reloading) return + + this.reloading = true + + Api.getAppVersion(true).then(() => { + window.location.reload() + }, (message) => { + Modal.error({ + title: message || '绯荤粺閰嶇疆鏇存柊澶辫触锛�', + }) + }) + } + canvasToImage(canvas) { let image = new Image() image.src = canvas.toDataURL('image/jpg') diff --git a/src/views/mkiframe/index.jsx b/src/views/mkiframe/index.jsx index 75aa79c..b6e9761 100644 --- a/src/views/mkiframe/index.jsx +++ b/src/views/mkiframe/index.jsx @@ -19,6 +19,8 @@ type: 'CustomPage' } + reloading = false + UNSAFE_componentWillMount() { const { params, path } = this.props.match const { menuId, loginUid, bid } = params @@ -112,6 +114,10 @@ MKEmitter.addListener('modifyTabs', this.modifyTabs) MKEmitter.addListener('closeTabView', this.closeTabView) + if (window.GLOB.forcedUpdate) { + MKEmitter.addListener('reloadTabs', this.reloadTabs) + } + if (window.GLOB.sysType !== 'cloud') { Object.defineProperty(window, 'debugger', { configurable: true, @@ -152,9 +158,26 @@ return } MKEmitter.removeListener('modifyTabs', this.modifyTabs) + MKEmitter.removeListener('reloadTabs', this.reloadTabs) MKEmitter.removeListener('closeTabView', this.closeTabView) } + reloadTabs = () => { + if (this.reloading) return + + this.reloading = true + + Api.getAppVersion(true).then(() => { + window.location.reload() + }, (message) => { + notification.error({ + top: 92, + message: message || '绯荤粺閰嶇疆鏇存柊澶辫触锛�', + duration: 10 + }) + }) + } + modifyTabs = (tab) => { const { MenuId, BID } = this.state -- Gitblit v1.8.0