Commit 41370d84 authored by 陈龙's avatar 陈龙

fix: 修复重复调用的问题

parent eea073ef
...@@ -2,16 +2,16 @@ import React from 'react'; ...@@ -2,16 +2,16 @@ import React from 'react';
import HistoryView from '../index'; import HistoryView from '../index';
const deviceParams = [ const deviceParams = [
/* { {
"deviceCode": "EGBF00000023", "deviceCode": "EGBF00000023",
"sensors": "出水压力", "sensors": "出水压力",
"deviceType": "二供泵房" "deviceType": "二供泵房"
}, */ },
{ /* {
"deviceCode": "EGBF00000023", "deviceCode": "EGBF00000023",
"sensors": "出水瞬时流量,出水压力", "sensors": "出水瞬时流量,出水压力",
"deviceType": "二供泵房" "deviceType": "二供泵房"
} } */
] ]
const Demo = () => { const Demo = () => {
return ( return (
......
...@@ -345,7 +345,7 @@ const HistoryView = (props) => { ...@@ -345,7 +345,7 @@ const HistoryView = (props) => {
_deviceParams[0].sensors = combineSensors.join(','); _deviceParams[0].sensors = combineSensors.join(',');
} }
return _deviceParams; return _deviceParams;
},[combineSensors]) },[combineSensors,props.deviceParams])
const isBoxPlots = const isBoxPlots =
deviceParams?.length === 1 && deviceParams?.[0]?.sensors?.split(',').length === 1; deviceParams?.length === 1 && deviceParams?.[0]?.sensors?.split(',').length === 1;
const [loading, setLoading] = useState(null); const [loading, setLoading] = useState(null);
...@@ -1556,7 +1556,7 @@ const HistoryView = (props) => { ...@@ -1556,7 +1556,7 @@ const HistoryView = (props) => {
}; };
useEffect(() => { useEffect(() => {
getDefaultOptions(); getDefaultOptions();
}, [deviceParams]); }, [props.deviceParams]);
let percentTimer = useRef({ let percentTimer = useRef({
timer: null, timer: null,
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment