|
@@ -2,7 +2,7 @@ import React, { useState, useEffect, useRef } from 'react';
|
|
|
import { connect } from 'dva';
|
|
|
import moment from 'moment';
|
|
|
import style from './Chart.less';
|
|
|
-import { Card, Empty } from 'antd';
|
|
|
+import { Card, Empty, Spin } from 'antd';
|
|
|
import { getOptions } from '@/components/ChartUtils/utils';
|
|
|
const dataCache = {};
|
|
|
|
|
@@ -41,12 +41,12 @@ function DataCenter(props) {
|
|
|
}
|
|
|
}, [projectId]);
|
|
|
|
|
|
- useEffect(() => {
|
|
|
- const chartWindow = iframeRef.current?.contentWindow;
|
|
|
- console.log(chartOptions);
|
|
|
- if (!chartWindow || !chartOptions) return;
|
|
|
- renderChart();
|
|
|
- }, [chartOptions]);
|
|
|
+ // useEffect(() => {
|
|
|
+ // const chartWindow = iframeRef.current?.contentWindow;
|
|
|
+ // console.log(chartOptions);
|
|
|
+ // if (!chartWindow || !chartOptions) return;
|
|
|
+ // renderChart();
|
|
|
+ // }, [chartOptions]);
|
|
|
|
|
|
useEffect(() => {
|
|
|
if (chartConfigList && chartConfigList.length > 0) {
|
|
@@ -99,12 +99,14 @@ function DataCenter(props) {
|
|
|
)}
|
|
|
</Card>
|
|
|
<Card title="图表" bodyStyle={{ paddingBottom: 0 }}>
|
|
|
- <iframe
|
|
|
- ref={iframeRef}
|
|
|
- style={{ width: '100%', height: 'calc(50vh - 80px)', border: 'none' }}
|
|
|
- onLoad={renderChart}
|
|
|
- srcDoc={chartOptions?.template?.Content}
|
|
|
- ></iframe>
|
|
|
+ <Spin spinning={loading}>
|
|
|
+ <iframe
|
|
|
+ ref={iframeRef}
|
|
|
+ style={{ width: '100%', height: 'calc(50vh - 80px)', border: 'none' }}
|
|
|
+ onLoad={renderChart}
|
|
|
+ srcDoc={chartOptions?.template?.Content}
|
|
|
+ ></iframe>
|
|
|
+ </Spin>
|
|
|
</Card>
|
|
|
</div>
|
|
|
);
|