From cc3a8f6647edc1ddb2e9fecdee0e089a5696cde8 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 15 五月 2024 16:47:25 +0800
Subject: [PATCH] #
---
src/pages/right/components/inout-charts.jsx | 63 +++++++++++++++++++++----------
1 files changed, 42 insertions(+), 21 deletions(-)
diff --git a/src/pages/right/components/inout-charts.jsx b/src/pages/right/components/inout-charts.jsx
index 94f6a1b..617f7af 100644
--- a/src/pages/right/components/inout-charts.jsx
+++ b/src/pages/right/components/inout-charts.jsx
@@ -1,29 +1,50 @@
+import { useEffect, useState } from 'react';
import { ScrollBoard } from '@jiaminghi/data-view-react';
+import { getAgvCharts, getInout } from '@/api/report';
const InOutCharts = () => {
- const config = {
- header: ['缂栧彿', '鏃堕棿', '绫诲瀷', '鍖哄煙', '鍗曞彿'],
- data: [
- ['1', '2023-06-01 12:00:00', '鍏ュ簱', 'A1', 'b12c3'],
- ['2', '2023-06-01 12:00:00', '鍑哄簱', 'A2', 'b12c3'],
- ['3', '2023-06-01 12:00:00', '鍏ュ簱', 'A3', 'b12c3'],
- ['4', '2023-06-01 12:00:00', '鍑哄簱', 'A4', 'b12c3'],
- ['5', '2023-06-01 12:00:00', '鍏ュ簱', 'A5', 'b12c3'],
- ['6', '2023-06-01 12:00:00', '鍑哄簱', 'A6', 'b12c3'],
- ['7', '2023-06-01 12:00:00', '鍏ュ簱', 'A7', 'b12c3'],
- ['8', '2023-06-01 12:00:00', '鍑哄簱', 'A8', 'b12c3'],
- ],
- headerBGC: '#00fff138',
- oddRowBGC: '#00000017',
- evenRowBGC: '#ededed13',
- headerHeight: 28,
- rowNum: 8,
- columnWidth: [80, 70, 60, 100],
- };
+
+ const [apiData, setApiData] = useState([
+ ['AGV1', '100%', 'A1', '1m/s'],
+ ['AGV2', '100%', 'A2', '1m/s'],
+ ['AGV3', '100%', 'A3', '1m/s'],
+ ['AGV4', '100%', 'A4', '1m/s'],
+ ['AGV5', '100%', 'A5', '1m/s'],
+ ['AGV6', '100%', 'A6', '1m/s'],
+ ['AGV7', '100%', 'A7', '1m/s'],
+ ['AGV8', '100%', 'A8', '1m/s'],
+ ['AGV9', '100%', 'A9', '1m/s'],
+ ['AGV10', '100%', 'A10', '1m/s'],
+ ['AGV11', '100%', 'A11', '1m/s'],
+ ]);
+
+ useEffect(() => {
+ const timer = setInterval(() => {
+ getInout().then(res => {
+ setApiData(res.reverse().map(item => {
+ return ["AGV" + item.agvNo, item.name]
+ }))
+ })
+ }, 3000);
+
+ return () => {
+ clearInterval(timer);
+ }
+ }, []);
+
return (
<ScrollBoard
- config={config}
- style={{ width: '100%', height: '220px', fontSize: '12px', marginBottom: '8px' }}
+ config={{
+ header: ['缂栧彿', '浣滀笟'],
+ data: apiData,
+ headerBGC: '#00fff138',
+ oddRowBGC: '#00000017',
+ evenRowBGC: '#ededed13',
+ headerHeight: 28,
+ rowNum: 10,
+ columnWidth: [80, 120, 100, 130],
+ }}
+ style={{ width: '100%', height: '400px', fontSize: '12px', marginBottom: '8px' }}
/>
);
};
--
Gitblit v1.9.1