websocket_reset

This commit is contained in:
gtz 2023-09-12 16:15:01 +08:00
parent 3d42b358d0
commit b5602d4981
4 changed files with 8 additions and 7 deletions

View File

@ -9,10 +9,10 @@ import cls from './leftbox.module.less';
const Chart2 = () => { const Chart2 = () => {
const ctx = useContext(SocketContext); const ctx = useContext(SocketContext);
let [time, setTime] = useState([19, 28]); let [time, setTime] = useState([0, 0]);
useEffect(() => { useEffect(() => {
const restTime = ctx.runState?.lastFireChangeTime || '19分28秒'; const restTime = ctx.runState?.lastFireChangeTime;
if (restTime == null) return; if (restTime == null) return;
console.log('restTime is:', restTime); console.log('restTime is:', restTime);
let timer = null; let timer = null;
@ -77,7 +77,7 @@ const Chart2 = () => {
{ {
icon: icon1, icon: icon1,
label: '换火时间', label: '换火时间',
value: ctx.runState?.fireChangeTime || '19:56', value: ctx.runState?.fireChangeTime || '00:00',
}, },
{ {
icon: icon3, icon: icon3,

View File

@ -8,7 +8,7 @@ import { randomInt } from '../../../../utils';
const GoodRateChart = (props) => { const GoodRateChart = (props) => {
const options = { const options = {
color: ['#FFD160', '#12FFF5', '#2760FF'], color: ['#FFD160', '#12FFF5', '#2760FF'],
grid: { top: 28, right: 12, bottom: 64, left: 48 }, grid: { top: 28, right: 12, bottom: 48, left: 48 },
xAxis: { xAxis: {
type: 'category', type: 'category',
data: Array(7) data: Array(7)
@ -147,7 +147,7 @@ const GoodRateChart = (props) => {
</Radio.Button> </Radio.Button>
</Radio.Group> </Radio.Group>
</div> </div>
<ReactECharts option={options} /> <ReactECharts option={options} style={{ height: '100%' }} />
</div> </div>
); );
}; };

View File

@ -15,7 +15,7 @@ export default function index() {
const v = (value / 100).toFixed(2); const v = (value / 100).toFixed(2);
const styles = { const styles = {
transform: `scale(${v})`, transform: `scale(${(v * 3840) / 4320}, ${v})`,
// transform: `scale(${v * 24 / 33}, ${v})`, // transform: `scale(${v * 24 / 33}, ${v})`,
transformOrigin: 'top left', transformOrigin: 'top left',
}; };

View File

@ -28,6 +28,7 @@ wss.on('connection', function (ws, req) {
const timer = setInterval(() => { const timer = setInterval(() => {
sendMsg(ws, 'kiln-info'); // 窑炉信息 sendMsg(ws, 'kiln-info'); // 窑炉信息
sendMsg(ws, 'energy-cost'); // 运行状态 sendMsg(ws, 'energy-cost'); // 运行状态
sendMsg(ws, 'run-state'); // 运行状态
sendMsg(ws, 'realtime'); sendMsg(ws, 'realtime');
sendMsg(ws, 'his-trend'); sendMsg(ws, 'his-trend');
// sendMsg(ws, 'gas'); // sendMsg(ws, 'gas');
@ -36,7 +37,7 @@ wss.on('connection', function (ws, req) {
}, frequency * 1000); }, frequency * 1000);
const timer1 = setInterval(() => { const timer1 = setInterval(() => {
sendMsg(ws, 'run-state'); // 运行状态 // sendMsg(ws, 'run-state'); // 运行状态
}, frequency1 * 1000); }, frequency1 * 1000);
ws.on('close', function () { ws.on('close', function () {