From a975aa770d1f5d0ae133f0e87a28b5d6b94734ef Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 09 五月 2024 11:16:42 +0800 Subject: [PATCH] 2024-05-09 --- src/tabviews/custom/components/table/base-table/index.jsx | 77 ++++++++++++++++++++------------------ 1 files changed, 41 insertions(+), 36 deletions(-) diff --git a/src/tabviews/custom/components/table/base-table/index.jsx b/src/tabviews/custom/components/table/base-table/index.jsx index 0693483..bc2b635 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' @@ -104,6 +104,7 @@ this.setState({ data: [], selectedData: [], + loading: false, total: 0 }) @@ -112,6 +113,8 @@ if (setting.$hasSyncModule) { MKEmitter.emit('syncBalconyData', config.uuid, [], false) } + + this.requestId = '' return } @@ -137,8 +140,13 @@ let _orderBy = orderBy || setting.order let param = UtilsDM.getQueryDataParams(setting, searches, _orderBy, pageIndex, pageSize, BID) - let result = await Api.genericInterface(param) + 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 + if (repage === 'false' && result.data && result.data.length === 0 && result.total > 0 && pageIndex > 1) { let _pageIndex = Math.ceil(result.total / pageSize) @@ -221,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 @@ -243,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) } } @@ -376,11 +361,8 @@ this.setState({ loading: false }) - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) + + UtilsDM.queryFail(result) } } @@ -566,8 +548,10 @@ BID: id, BData: data }, () => { - this.loadmaindata(true, 'true') - this.getStatFieldsValue() + if (!setting.checkBid) { + this.loadmaindata(true, 'true') + this.getStatFieldsValue() + } }) } } @@ -589,8 +573,8 @@ } else { this.reloadtable(btn, id) } - } else if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) { // 鍒锋柊婧愮粍浠舵椂锛岄檮甯﹀埛鏂颁笂绾ц涓庡綋鍓嶇粍浠� - MKEmitter.emit('reloadData', config.setting.supModule, BID) + } else if (['mainline', 'maingrid', 'popclose'].includes(position) && config.setting.supModule) { + MKEmitter.emit('reloadData', config.setting.supModule, position === 'maingrid' ? '' : BID) } else { this.reloadtable(btn, id) } @@ -604,6 +588,25 @@ this.setState({pageIndex: 1}, () => { this.reloadtable() }) + } + + autoExec = (times) => { + const { config } = this.state + + if (!config.wrap.autoExec) return + + let btn = document.getElementById('button' + config.wrap.autoExec) + + this.autoTimer && clearTimeout(this.autoTimer) + + if (btn) { + MKEmitter.emit('triggerBtnId', config.wrap.autoExec, []) + } else if (!times || times < 20) { + times = times ? times + 1 : 1 + this.autoTimer = setTimeout(() => { + this.autoExec(times) + }, 1000) + } } shouldComponentUpdate (nextProps, nextState) { @@ -621,6 +624,8 @@ if (config.setting.useMSearch) { MKEmitter.addListener('searchRefresh', this.searchRefresh) } + + this.autoExec() } /** -- Gitblit v1.8.0