|
@@ -14,9 +14,9 @@ function DataCenter(props) {
|
|
|
const iframeRef = useRef();
|
|
|
const signalRef = useRef();
|
|
|
const [loading, setLoading] = useState(false);
|
|
|
- const { chartConfigList, dispatch } = props;
|
|
|
+ const { chartConfigList, dispatch ,location:{query:{projectId}}} = props;
|
|
|
// const { projectId } = props.location; //?
|
|
|
- const projectId = 92;
|
|
|
+ // const projectId = 92;
|
|
|
|
|
|
const handleClickTabs = id => {
|
|
|
let item = chartConfigList.find(c => c.id == id);
|
|
@@ -37,15 +37,9 @@ function DataCenter(props) {
|
|
|
|
|
|
useEffect(() => {
|
|
|
const chartWindow = iframeRef.current?.contentWindow;
|
|
|
- if (!chartWindow) return;
|
|
|
- if (chartWindow.render) {
|
|
|
- console.log(chartWindow.render)
|
|
|
- renderChart();
|
|
|
- } else {
|
|
|
- chartWindow.onload = () => {
|
|
|
- renderChart();
|
|
|
- };
|
|
|
- }
|
|
|
+ console.log(chartOptions);
|
|
|
+ if (!chartWindow || !chartOptions) return;
|
|
|
+ renderChart();
|
|
|
}, [chartOptions]);
|
|
|
|
|
|
useEffect(() => {
|
|
@@ -96,15 +90,14 @@ function DataCenter(props) {
|
|
|
</div>
|
|
|
</div>
|
|
|
<div className={style.title}>图表</div>
|
|
|
- <div className={style.chartWrapper}>
|
|
|
- <div style={{ paddingTop: '0.1rem', overflow: 'hidden' }}>
|
|
|
- {chartOptions && chartOptions.template && (
|
|
|
- <iframe
|
|
|
- ref={iframeRef}
|
|
|
- style={{ width: '100%', height: '30vh', border: 'none' }}
|
|
|
- srcDoc={chartOptions.template.Content}
|
|
|
- ></iframe>
|
|
|
- )}
|
|
|
+ <div className={style.chartWrapper} style={{ height: '43vh' }}>
|
|
|
+ <div style={{ paddingTop: '0.3rem', paddingRight: '0.6rem', overflow: 'hidden' }}>
|
|
|
+ <iframe
|
|
|
+ ref={iframeRef}
|
|
|
+ style={{ width: '100%', height: '43vh', border: 'none' }}
|
|
|
+ onLoad={renderChart}
|
|
|
+ srcDoc={chartOptions?.template?.Content}
|
|
|
+ ></iframe>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|