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-scatter/index.jsx | 64 +++++++++++++++---------------- 1 files changed, 31 insertions(+), 33 deletions(-) diff --git a/src/tabviews/custom/components/chart/antv-scatter/index.jsx b/src/tabviews/custom/components/chart/antv-scatter/index.jsx index ea53270..a085d4e 100644 --- a/src/tabviews/custom/components/chart/antv-scatter/index.jsx +++ b/src/tabviews/custom/components/chart/antv-scatter/index.jsx @@ -7,13 +7,14 @@ import Api from '@/api' import Utils from '@/utils/utils.js' -import asyncComponent from '@/utils/asyncComponent' +// import asyncComponent from '@/utils/asyncComponent' import asyncBtnComponent from './asyncButtonComponent' 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')) const ExcelOutButton = asyncBtnComponent(() => import('@/tabviews/zshare/actionList/exceloutbutton')) const ExcelInButton = asyncBtnComponent(() => import('@/tabviews/zshare/actionList/excelInbutton')) @@ -52,14 +53,7 @@ _sync = false } - let height = config.plot.height || 400 - if (config.plot.title || config.search.length > 0) { - _config.plot.height = height - 70 - } else { - _config.plot.height = height - 25 - } - - _config.style.height = height + _config.style.height = config.plot.height || 400 this.setState({ config: _config, @@ -94,12 +88,10 @@ this.setState({sync: false, data: _data, empty: !_data,}, () => { this.handleData() }) - } else if (nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { - if (config.setting.syncRefresh === 'true') { - this.setState({}, () => { - this.loadData() - }) - } + } else if (config.setting.syncRefresh && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { + this.setState({}, () => { + this.loadData() + }) } } @@ -230,7 +222,7 @@ if (config.uuid !== menuId) return let searches = search ? fromJS(search).toJS() : [] - if (mainSearch && mainSearch.length > 0) { // 涓昏〃鎼滅储鏉′欢 + if (config.setting.useMSearch && mainSearch && mainSearch.length > 0) { // 涓昏〃鎼滅储鏉′欢 let keys = searches.map(item => item.key.toLowerCase()) mainSearch.forEach(item => { if (!keys.includes(item.key.toLowerCase())) { @@ -265,7 +257,7 @@ } let searches = search ? fromJS(search).toJS() : [] - if (mainSearch && mainSearch.length > 0) { // 涓昏〃鎼滅储鏉′欢 + if (config.setting.useMSearch && mainSearch && mainSearch.length > 0) { // 涓昏〃鎼滅储鏉′欢 let keys = searches.map(item => item.key) mainSearch.forEach(item => { if (!keys.includes(item.key)) { @@ -274,11 +266,8 @@ }) } - 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 } @@ -332,7 +321,7 @@ const chart = new Chart({ container: chartId, autoFit: true, - height: plot.height + height: this.wrap.offsetHeight - 25 }) chart.data(data); @@ -348,13 +337,18 @@ itemName: { style: { fill: plot.color } } }) - chart.tooltip({ - showTitle: false, - showCrosshairs: true, - crosshairs: { - type: 'xy', - } - }) + if (plot.tooltip !== 'true') { + chart.tooltip(false) + } else { + chart.tooltip({ + showTitle: false, + showCrosshairs: true, + crosshairs: { + type: 'xy', + } + }) + } + chart .point() .position(`${plot.Xaxis}*${plot.Yaxis}`) @@ -369,7 +363,11 @@ .style({ fillOpacity: 0.85 }) - chart.interaction('legend-highlight'); + if (plot.interaction && plot.interaction.length) { + plot.interaction.forEach(t => { + chart.interaction(t) + }) + } chart.render() } @@ -391,7 +389,7 @@ </div> : null } <NormalHeader config={config} BID={BID} menuType={this.props.menuType} refresh={this.refreshSearch} /> - <div className="canvas-wrap"> + <div className="canvas-wrap" ref={ref => this.wrap = ref}> <div className="chart-action"> {config.action.map(item => { if (item.OpenType === 'excelOut') { @@ -417,7 +415,7 @@ } })} </div> - <div className={'canvas' + (empty ? ' empty' : '')} style={{height: config.plot.height + 25}} id={this.state.chartId}></div> + <div className={'canvas' + (empty ? ' empty' : '')} id={this.state.chartId}></div> </div> {empty ? <Empty description={false}/> : null} </div> -- Gitblit v1.8.0