|
|
@@ -1,7 +1,7 @@ |
|
|
|
/* |
|
|
|
* @Author: zhp |
|
|
|
* @Date: 2024-08-29 09:46:11 |
|
|
|
* @LastEditTime: 2024-09-14 09:20:36 |
|
|
|
* @LastEditTime: 2024-09-18 09:10:19 |
|
|
|
* @LastEditors: zhp |
|
|
|
* @Description: |
|
|
|
*/ |
|
|
@@ -9,8 +9,9 @@ import cls from "./index.module.css"; |
|
|
|
import React, { useState,useEffect,useRef } from 'react'; |
|
|
|
import Points from "../../Modules/KilnOptimize/components/KilnTopForecast/Points"; |
|
|
|
function generateRandomNearNumber(number) { |
|
|
|
const randomOffset = Math.floor(Math.random() * 11) - 5; |
|
|
|
return number + randomOffset; |
|
|
|
const minRandom = -0.5; |
|
|
|
const maxRandom = 0.5; |
|
|
|
return (number + Math.random() * (maxRandom - minRandom) + minRandom).toFixed(1); |
|
|
|
} |
|
|
|
function BlueRect(props) { |
|
|
|
const title = props.title || "DEFAULT"; |
|
|
@@ -22,6 +23,7 @@ function BlueRect(props) { |
|
|
|
setIsVisible(!newVisibilityState); |
|
|
|
// 在这里可以根据isVisible的变化执行其他逻辑 |
|
|
|
}; |
|
|
|
const [randomValue, setRandomValue] = useState(generateRandomNearNumber(parseInt(value))); |
|
|
|
// const parentRef = useRef(null); |
|
|
|
// const pointsRef = useRef(null); |
|
|
|
const [mousePosition, setMousePosition] = useState({ x: 0, y: 0 }); |
|
|
@@ -70,15 +72,23 @@ function BlueRect(props) { |
|
|
|
}} |
|
|
|
> |
|
|
|
{title} |
|
|
|
</span> |
|
|
|
{props.blue || ( |
|
|
|
<span onClick={handleToggleVisibility} className="value" style={{ userSelect: "none", fontWeight: 600,fontSize: "22px", cursor: 'pointer', }}> |
|
|
|
{randomValue + '℃'} |
|
|
|
</span> |
|
|
|
)} |
|
|
|
{props.blue? ( |
|
|
|
<span className='value' style={{ userSelect: "none", fontSize: "22px" }}> |
|
|
|
{value} |
|
|
|
</span> |
|
|
|
<span className="value" style={{ userSelect: "none", fontSize: "22px" }}> |
|
|
|
): ( |
|
|
|
<span className={`${cls.forecastValue}`} style={{ userSelect: "none", fontSize: "22px" }}> |
|
|
|
{value} |
|
|
|
</span> |
|
|
|
{props.blue || ( |
|
|
|
<span onClick={handleToggleVisibility} className={`${cls.forecastValue}`} style={{ userSelect: "none", fontWeight: 600,fontSize: "22px" }}> |
|
|
|
{generateRandomNearNumber(parseInt(value)) + '℃'} |
|
|
|
</span> |
|
|
|
|
|
|
|
)} |
|
|
|
|
|
|
|
</div> |
|
|
|
{isVisible && !props.blue && <Points dataSource={chartData} |
|
|
|
updateVisibilityState={updateVisibilityState} // 传递方法给子组件 |
|
|
|