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/shuttle/view.jsx |   54 +++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 41 insertions(+), 13 deletions(-)

diff --git a/zy-asrs-flow/src/pages/map/drawer/shuttle/view.jsx b/zy-asrs-flow/src/pages/map/drawer/shuttle/view.jsx
index 11332b5..7d5b0ff 100644
--- a/zy-asrs-flow/src/pages/map/drawer/shuttle/view.jsx
+++ b/zy-asrs-flow/src/pages/map/drawer/shuttle/view.jsx
@@ -5,6 +5,7 @@
 import * as Utils from '../../utils'
 import Http from '@/utils/http';
 import BoolValueIcon from '@/components/BoolValueIcon';
+import ShuttleHandle from './handle';
 
 const useStyles = createStyles(({ token, css }) => {
     return {
@@ -28,7 +29,16 @@
     }
 })
 
-
+const updateEnable = async (deviceNo, enable) => {
+    const resp = await Http.doPost('api/dict/update', { val });
+    if (resp.code === 200) {
+        message.success(intl.formatMessage({ id: 'page.update.success', defaultMessage: '鏇存柊鎴愬姛' }));
+        return true;
+    } else {
+        message.error(resp.msg);
+        return false;
+    }
+}
 
 const ShuttleView = (props) => {
     const intl = useIntl();
@@ -36,6 +46,7 @@
 
     const { data } = props;
     const [loading, setLoading] = React.useState(false);
+    const [childrenDrawer, setChildrenDrawer] = useState(false);
     const [info, setInfo] = React.useState(null);
 
     useEffect(() => {
@@ -48,11 +59,14 @@
             setLoading(false);
         }
         fetchShuttleInfo(data.no);
-    }, [data]);
 
-    useEffect(() => {
-        console.log(info);
-    }, [info])
+        const timer = setInterval(() => {
+            fetchShuttleInfo(data.no);
+        }, 1000);
+        return () => {
+            clearInterval(timer);
+        }
+    }, [data]);
 
     return (
         <>
@@ -87,11 +101,11 @@
                                     },
                                     {
                                         label: intl.formatMessage({ id: 'map.loc.no', defaultMessage: '搴撲綅鍙�' }),
-                                        children: <Badge status="processing" text="Running" />,
+                                        children: info?.currentLocNo,
                                     },
                                     {
                                         label: intl.formatMessage({ id: 'map.pallet.barcode', defaultMessage: '鎵樼洏鏉$爜' }),
-                                        children: '80000010',
+                                        children: info?.zpallet,
                                     },
                                     {
                                         label: intl.formatMessage({ id: 'map.origin.loc', defaultMessage: '璧峰搴撲綅' }),
@@ -101,7 +115,7 @@
                                         label: intl.formatMessage({ id: 'map.dest.loc', defaultMessage: '鐩爣搴撲綅' }),
                                         children: info?.destLocNo,
                                     },
-                                   
+
                                     {
                                         label: intl.formatMessage({ id: 'map.shuttle.batter.power', defaultMessage: '鐢垫睜鐢甸噺' }),
                                         children: info?.batteryPower,
@@ -136,7 +150,7 @@
                                     },
                                     {
                                         label: intl.formatMessage({ id: 'map.is.enable', defaultMessage: '鏄惁鍚敤' }),
-                                        children: 'Disabled',
+                                        children: <BoolValueIcon value={info?.enable} />,
                                     },
                                     {
                                         label: intl.formatMessage({ id: 'map.loc.operation', defaultMessage: '搴撲綅鎿嶄綔' }),
@@ -144,13 +158,19 @@
                                         children: (
                                             <>
                                                 <Button className={styles.tableButton} size='default' type="primary" danger>
-                                                    <FormattedMessage id='map.loc.lock' defaultMessage='閿佸畾' />
+                                                    <FormattedMessage id='map.diable' defaultMessage='绂佺敤' />
                                                 </Button>
                                                 <Button className={styles.tableButton} size='default' disabled>
-                                                    <FormattedMessage id='map.loc.unlock' defaultMessage='瑙i攣' />
+                                                    <FormattedMessage id='map.enable' defaultMessage='鍚敤' />
                                                 </Button>
-                                                <Button className={styles.tableButton} size='default'>
-                                                    <FormattedMessage id='map.loc.reset' defaultMessage='娓呴櫎搴撲綅' />
+                                                <Button
+                                                    className={styles.tableButton}
+                                                    size='default'
+                                                    onClick={() => {
+                                                        setChildrenDrawer(true);
+                                                    }}
+                                                >
+                                                    <FormattedMessage id='map.handle' defaultMessage='鎵嬪姩鎿嶄綔' />
                                                 </Button>
                                             </>
                                         )
@@ -158,6 +178,14 @@
                                 ]
                             }
                         />
+                        <ShuttleHandle
+                            open={childrenDrawer}
+                            refCurr={props.refCurr}
+                            shuttleNo={data.no}
+                            onClose={() => {
+                                setChildrenDrawer(false)
+                            }}
+                        />
                     </div>
                 )}
             </div>

--
Gitblit v1.9.1