From f91a0304449e0222df0af793afbbf41f0fd63909 Mon Sep 17 00:00:00 2001
From: vincentlu <t1341870251@gmail.com>
Date: 星期二, 18 二月 2025 16:32:20 +0800
Subject: [PATCH] #
---
zy-acs-flow/src/map/insight/shelf/index.jsx | 43 +++++++++++++++++++++++++++++++++++++++----
1 files changed, 39 insertions(+), 4 deletions(-)
diff --git a/zy-acs-flow/src/map/insight/shelf/index.jsx b/zy-acs-flow/src/map/insight/shelf/index.jsx
index b4e05b5..c5d6076 100644
--- a/zy-acs-flow/src/map/insight/shelf/index.jsx
+++ b/zy-acs-flow/src/map/insight/shelf/index.jsx
@@ -3,15 +3,48 @@
import { Box, Typography, Tabs, Tab, Stack, useTheme, Divider } from '@mui/material';
import ShelfMain from './ShelfMain';
import JsonShow from '../../JsonShow';
+import { getLocGroup } from '../../http';
const ShelfInsight = (props) => {
- const { sprite } = props;
+ const { sprite, setTitle } = props;
const theme = useTheme();
- const themeMode = theme.palette.mode;
const translate = useTranslate();
const [activeTab, setActiveTab] = useState(0);
+ const [curShelfInfo, setCurShelfInfo] = useState(null);
const [curLocNo, setCurLocNo] = useState(null);
+
+ const fetchShelfInfo = (row, bay) => {
+ getLocGroup(row, bay, (response) => {
+ setCurShelfInfo(response);
+ const defaultLocNo = response[0]?.locNo;
+ setCurLocNo(defaultLocNo);
+ });
+ }
+
+ useEffect(() => {
+ if (sprite) {
+ const { row, bay } = sprite.data;
+ if (row && bay) {
+ fetchShelfInfo(row, bay);
+ }
+ }
+
+ return () => {
+ setCurLocNo(null);
+ setCurShelfInfo(null);
+ }
+ }, [sprite]);
+
+ useEffect(() => {
+ if (curLocNo) {
+ setTitle(translate('page.map.devices.shelf') + ' - ' + curLocNo);
+ }
+
+ return () => {
+ setTitle(null);
+ }
+ }, [curLocNo])
const handleTabChange = (event, newValue) => {
setActiveTab(newValue);
@@ -34,14 +67,16 @@
<Box flex={1} pt={2}>
{activeTab === 0 && (
<ShelfMain
- data={sprite?.data}
+ row={sprite?.data?.row}
+ bay={sprite?.data?.bay}
curLocNo={curLocNo}
+ curShelfInfo={curShelfInfo}
setCurLocNo={setCurLocNo}
/>
)}
{activeTab === 1 && (
<JsonShow
- data={sprite?.data}
+ data={curShelfInfo || sprite?.data}
height={550}
/>
)}
--
Gitblit v1.9.1