From 72419e2f826031a158173f46d723a672064e37cd Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 31 八月 2021 22:42:51 +0800 Subject: [PATCH] 2021-08-31 --- src/tabviews/custom/components/chart/antv-dashboard/index.jsx | 36 ++++++++++-------------------------- 1 files changed, 10 insertions(+), 26 deletions(-) diff --git a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx index fce024f..af8a9bf 100644 --- a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx +++ b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx @@ -7,12 +7,13 @@ import Api from '@/api' import Utils from '@/utils/utils.js' -import asyncComponent from '@/utils/asyncComponent' +// import asyncComponent from '@/utils/asyncComponent' import UtilsDM from '@/utils/utils-datamanage.js' import MKEmitter from '@/utils/events.js' +import NormalHeader from '@/tabviews/custom/components/share/normalheader' import './index.scss' -const NormalHeader = asyncComponent(() => import('@/tabviews/custom/components/share/normalheader')) +// const NormalHeader = asyncComponent(() => import('@/tabviews/custom/components/share/normalheader')) registerShape('point', 'pointer', { draw(cfg, container) { @@ -96,13 +97,7 @@ } } - let height = config.plot.height || 400 - if (config.plot.title) { - _config.plot.height = height - 75 - } else { - _config.plot.height = height - 30 - } - _config.style.height = height + _config.style.height = config.plot.height || 400 this.setState({ config: _config, @@ -267,21 +262,10 @@ return } - let searches = [] - if (config.setting.useMSearch && mainSearch && mainSearch.length > 0) { // 涓昏〃鎼滅储鏉′欢 - let keys = [] - mainSearch.forEach(item => { - if (!keys.includes(item.key)) { - searches.push(item) - } - }) - } + let searches = config.setting.useMSearch && mainSearch ? mainSearch : [] - let requireFields = searches.filter(item => item.required && (!item.value || item.value.length === 0)) + let requireFields = searches.filter(item => item.required && item.value === '') if (requireFields.length > 0) { - this.setState({ - loading: false - }) return } @@ -366,7 +350,7 @@ const chart = new Chart({ container: chartId, autoFit: true, - height: plot.height, + height: this.wrap.offsetHeight - 30, }) chart.data(data) @@ -473,7 +457,7 @@ const chart = new Chart({ container: chartId, autoFit: true, - height: plot.height, + height: this.wrap.offsetHeight - 30, padding: [0, 0, 0, 0], }) chart.data([_data]) @@ -618,8 +602,8 @@ </div> : null } <NormalHeader config={config} /> - <div className="canvas-wrap"> - <div className={'canvas' + (empty ? ' empty' : '')} style={{height: config.plot.height + 30}} id={this.state.chartId}></div> + <div className="canvas-wrap" ref={ref => this.wrap = ref}> + <div className={'canvas' + (empty ? ' empty' : '')} id={this.state.chartId}></div> </div> </div> ) -- Gitblit v1.8.0