From f6626b05f1275cc2f8ca77f773d4f6a6af1b0a89 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 21 十一月 2022 16:11:55 +0800 Subject: [PATCH] 2022-11-21 --- src/tabviews/custom/components/chart/antv-bar-line/index.jsx | 68 ++++++++++++++++++++++----------- 1 files changed, 45 insertions(+), 23 deletions(-) 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 2e6524a..e9e806e 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 } from 'antd' +import { Spin, Empty, notification, Modal } from 'antd' import { DownloadOutlined } from '@ant-design/icons' import moment from 'moment' @@ -108,7 +108,13 @@ }) } - _config.style.height = config.plot.height || 400 + _config.plot.height = Utils.getHeight(_config.plot.height) + _config.style.height = 'auto' + _config.style.minHeight = _config.plot.height + 30 + + if (_config.plot.title) { + _config.style.minHeight = _config.style.minHeight + 45 + } let transfield = {} _config.columns.forEach(col => { @@ -364,7 +370,7 @@ this.setState({sync: false, data: _data}, () => { this.handleData() }) - } else if (config.setting.syncRefresh && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { + } else if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { this.setState({}, () => { this.loadData() }) @@ -534,11 +540,18 @@ loading: false }) this.timer && this.timer.stop() - notification.error({ - top: 92, - message: result.message, - duration: 10 - }) + + if (result.ErrCode === 'N') { + Modal.error({ + title: result.message, + }) + } else { + notification.error({ + top: 92, + message: result.message, + duration: 10 + }) + } } } @@ -550,7 +563,9 @@ if (_element) { _element.innerHTML = '' } - this.viewrender() + setTimeout(() => { + this.viewrender() + }, 100) } /** @@ -896,7 +911,7 @@ const chart = new Chart({ container: this.state.chartId, autoFit: true, - height: this.wrap.offsetHeight - 25 + height: plot.height }) chart.data(_data) @@ -1080,7 +1095,7 @@ const chart = new Chart({ container: this.state.chartId, autoFit: true, - height: this.wrap.offsetHeight - 25 + height: plot.height }) // 鍧愭爣杞存牸寮忓寲 @@ -1490,7 +1505,7 @@ const chart = new Chart({ container: this.state.chartId, autoFit: true, - height: this.wrap.offsetHeight - 25 + height: plot.height }) chart.data(_data) @@ -1710,8 +1725,6 @@ chart.on('element:click', (ev) => { let data = ev.data.data - MKEmitter.emit('resetSelectLine', config.uuid, (data ? data.$$uuid : ''), data) - if (plot.click === 'menus') { let menu = null @@ -1740,16 +1753,23 @@ } else { MKEmitter.emit('modifyTabs', newtab, 'plus', true) } - } else if (plot.click === 'menu' && plot.MenuID) { - let menu = { - MenuID: plot.MenuID, - MenuName: plot.MenuName, - MenuNo: plot.MenuNo, - type: plot.tabType + } else if (plot.click === 'menu') { + let menuId = plot.menu.slice(-1)[0] + let newtab = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0] + + if (!newtab && plot.MenuID) { + newtab = { + MenuID: plot.MenuID, + MenuName: plot.MenuName, + MenuNo: plot.MenuNo, + type: plot.tabType + } + } else if (!newtab) { + return } - let newtab = { - ...menu, + newtab = { + ...newtab, param: {} } @@ -1762,6 +1782,8 @@ } else { MKEmitter.emit('modifyTabs', newtab, 'plus', true) } + } else { + MKEmitter.emit('resetSelectLine', config.uuid, (data ? data.$$uuid : ''), data) } }) @@ -1839,7 +1861,7 @@ </div> : null } <NormalHeader config={config} BID={BID} refresh={this.refreshSearch} /> - <div className="canvas-wrap" ref={ref => this.wrap = ref}> + <div className="canvas-wrap"> {config.plot.download === 'enable' && this.state.chart && !empty ? <DownloadOutlined onClick={this.downloadImage} className="system-color download"/> : null} <div className={'chart-action' + (config.plot.download === 'enable' ? ' downable' : '')}> {config.action.map(item => { -- Gitblit v1.8.0