From d835d1b51f832889929cdf69010034a30ef44d02 Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期四, 17 十月 2024 13:57:29 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/pages/map/drawer/shelf/index.jsx |   75 +++++++++++++++++++++++++++++++------
 1 files changed, 62 insertions(+), 13 deletions(-)

diff --git a/zy-asrs-flow/src/pages/map/drawer/shelf/index.jsx b/zy-asrs-flow/src/pages/map/drawer/shelf/index.jsx
index d81d971..89b43b6 100644
--- a/zy-asrs-flow/src/pages/map/drawer/shelf/index.jsx
+++ b/zy-asrs-flow/src/pages/map/drawer/shelf/index.jsx
@@ -1,28 +1,77 @@
 import React, { useState, useRef, useEffect } from 'react';
-import { Drawer, Space, Button } from 'antd';
+import { Card, Form, Button } from 'antd';
 import { FormattedMessage, useIntl, useModel } from '@umijs/max';
 import { createStyles } from 'antd-style';
 import * as Utils from '../../utils'
-import Http from '@/utils/http';
-
-const useStyles = createStyles(({ token, css }) => {
-
-})
+import ShowJson from '../showJson';
+import ShelfView from './view'
 
 const ShelfDrawer = (props) => {
     const intl = useIntl();
-    const { styles } = useStyles();
+    const { curSprite, curFloor } = props;
 
-    const handleCancel = () => {
-        props.onCancel();
+    const [activeTabKey, setActiveTabKey] = useState('view');
+    const [curLocNo, setCurLocNo] = React.useState(''); // just used to modify the drawer title
+
+    props.setDrawerWidth(window.innerWidth * 0.35);
+
+    useEffect(() => {
+        if (!curSprite) {
+            return
+        }
+        props.setDrawerTitle(intl.formatMessage({ id: 'map.loc.no', defaultMessage: '搴撲綅鍙�' }) + ': ' + curLocNo);
+    }, [curLocNo]);
+
+    const contentList = {
+        view: (
+            <ShelfView
+                curLocNo={curLocNo}
+                setCurLocNo={setCurLocNo}
+                data={curSprite.data}
+                curFloor={curFloor}
+            />
+        ),
+        json: (
+            <ShowJson
+                data={curSprite.data}
+            />
+        ),
     };
-
-    const handleOk = () => {
-    }
 
     return (
         <>
-        <h1>Shelf</h1>
+            <Card
+                className='drawer-card'
+                hoverable
+                bordered={false}
+                type='inner'
+                tabList={[
+                    {
+                        key: 'view',
+                        tab: intl.formatMessage({ id: 'map.drawer.shelf.view.title', defaultMessage: '搴撲綅淇℃伅' }),
+                    },
+                    {
+                        key: 'json',
+                        tab: intl.formatMessage({ id: 'map.drawer.json', defaultMessage: 'JSON' }),
+                    },
+                ]}
+                activeTabKey={activeTabKey}
+                onTabChange={(key) => {
+                    setActiveTabKey(key)
+                }}
+                tabProps={{
+                    centered: true,
+                    size: 'large',
+                    type: "card",
+                    style: {
+                    }
+                }}
+                style={{
+                    height: '100%'
+                }}
+            >
+                {contentList[activeTabKey]}
+            </Card>
         </>
     )
 }

--
Gitblit v1.9.1