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 | 218 +++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 148 insertions(+), 70 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 db4773d..7d5b0ff 100644
--- a/zy-asrs-flow/src/pages/map/drawer/shuttle/view.jsx
+++ b/zy-asrs-flow/src/pages/map/drawer/shuttle/view.jsx
@@ -1,10 +1,11 @@
import React, { useState, useRef, useEffect } from 'react';
-import { Spin, Descriptions, Button } from 'antd';
+import { Descriptions, Button, Skeleton, Badge, Space } from 'antd';
import { FormattedMessage, useIntl, useModel } from '@umijs/max';
-import { LoadingOutlined } from '@ant-design/icons';
import { createStyles } from 'antd-style';
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 {
@@ -13,21 +14,9 @@
display: 'flex',
gap: '0px',
},
- threeInfo: {
- height: '100%',
- width: '60%',
- },
- spinWrapper: {
- height: '100%',
- },
- threeContainer: {
- zIndex: 99,
- width: '100%',
- height: '100%',
- },
tableInfo: {
height: '100%',
- width: '40%',
+ width: '100%',
padding: '0 10px 0 15px',
overflow: 'auto',
},
@@ -40,76 +29,165 @@
}
})
+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();
const { styles } = useStyles();
const { data } = props;
const [loading, setLoading] = React.useState(false);
+ const [childrenDrawer, setChildrenDrawer] = useState(false);
+ const [info, setInfo] = React.useState(null);
useEffect(() => {
setLoading(true);
-
- setTimeout(() => {
-
+ const fetchShuttleInfo = async (shuttleNo) => {
+ const res = await Http.doGet('/api/map/shuttle/info', { shuttleNo: shuttleNo });
+ if (res?.data) {
+ setInfo(res.data);
+ }
setLoading(false);
- }, 300)
+ }
+ fetchShuttleInfo(data.no);
+
+ const timer = setInterval(() => {
+ fetchShuttleInfo(data.no);
+ }, 1000);
+ return () => {
+ clearInterval(timer);
+ }
}, [data]);
return (
<>
<div className={styles.infoBox}>
- <div className={`${styles.threeInfo} three-spin`}>
- <Spin
- spinning={loading}
- indicator={<LoadingOutlined spin />}
- size={'large'}
- wrapperClassName={styles.spinWrapper}
- >
- </Spin>
- </div>
- <div className={styles.tableInfo}>
- <Descriptions
- bordered
- layout="vertical"
- column={1}
- items={
- [
- {
- key: '1',
- label: intl.formatMessage({ id: 'map.loc.no', defaultMessage: '搴撲綅鍙�' }),
- },
- {
- key: '2',
- label: intl.formatMessage({ id: 'map.pallet.barcode', defaultMessage: '鎵樼洏鏉$爜' }),
- children: '80000010',
- },
- {
- key: '3',
- label: intl.formatMessage({ id: 'map.is.enable', defaultMessage: '鏄惁鍚敤' }),
- children: 'Disabled',
- },
- {
- key: '4',
- label: intl.formatMessage({ id: 'map.loc.operation', defaultMessage: '搴撲綅鎿嶄綔' }),
- children: (
- <>
- <Button className={styles.tableButton} size='large' type="primary" danger>
- <FormattedMessage id='map.loc.lock' defaultMessage='閿佸畾' />
- </Button>
- <Button className={styles.tableButton} size='large' disabled>
- <FormattedMessage id='map.loc.unlock' defaultMessage='瑙i攣' />
- </Button>
- <Button className={styles.tableButton} size='large'>
- <FormattedMessage id='map.loc.reset' defaultMessage='娓呴櫎搴撲綅' />
- </Button>
- </>
- )
- },
- ]
- }
- />
- </div>
+ {loading ? (
+ <Skeleton active />
+ ) : (
+ <div className={styles.tableInfo}>
+ <Descriptions
+ bordered
+ title=''
+ size='middle' // default | middle | small
+ layout="vertical" // horizontal | vertical
+ column={4}
+ items={
+ [
+ {
+ label: intl.formatMessage({ id: 'map.shuttle.no', defaultMessage: '绌挎杞︾紪鍙�' }),
+ children: info?.shuttleNo,
+ },
+ {
+ label: intl.formatMessage({ id: 'map.task.no', defaultMessage: '浠诲姟鍙�' }),
+ children: info?.taskNo,
+ },
+ {
+ label: intl.formatMessage({ id: 'map.device.status', defaultMessage: '璁惧鐘舵��' }),
+ children: <Badge status="processing" text={info?.status} />,
+ },
+ {
+ label: intl.formatMessage({ id: 'map.shuttle.current.code', defaultMessage: '瀹氫綅鏉$爜' }),
+ children: info?.currentCode,
+ },
+ {
+ label: intl.formatMessage({ id: 'map.loc.no', defaultMessage: '搴撲綅鍙�' }),
+ children: info?.currentLocNo,
+ },
+ {
+ label: intl.formatMessage({ id: 'map.pallet.barcode', defaultMessage: '鎵樼洏鏉$爜' }),
+ children: info?.zpallet,
+ },
+ {
+ label: intl.formatMessage({ id: 'map.origin.loc', defaultMessage: '璧峰搴撲綅' }),
+ children: info?.originLocNo,
+ },
+ {
+ label: intl.formatMessage({ id: 'map.dest.loc', defaultMessage: '鐩爣搴撲綅' }),
+ children: info?.destLocNo,
+ },
+
+ {
+ label: intl.formatMessage({ id: 'map.shuttle.batter.power', defaultMessage: '鐢垫睜鐢甸噺' }),
+ children: info?.batteryPower,
+ },
+ {
+ label: intl.formatMessage({ id: 'map.shuttle.batter.voltage', defaultMessage: '鐢垫睜鐢靛帇' }),
+ children: info?.batteryVoltage,
+ },
+ {
+ label: intl.formatMessage({ id: 'map.shuttle.batter.temp', defaultMessage: '鐢垫睜娓╁害' }),
+ children: info?.batteryTemp,
+ },
+ {
+ label: intl.formatMessage({ id: 'map.error', defaultMessage: '寮傚父淇″彿' }),
+ children: info?.errorCode,
+ },
+ {
+ label: intl.formatMessage({ id: 'map.shuttle.has.lift', defaultMessage: '椤跺崌淇″彿' }),
+ children: <BoolValueIcon value={info?.hasLift} />,
+ },
+ {
+ label: intl.formatMessage({ id: 'map.shuttle.has.pallet', defaultMessage: '鎵樼洏淇″彿' }),
+ children: <BoolValueIcon value={info?.hasPallet} />,
+ },
+ {
+ label: intl.formatMessage({ id: 'map.shuttle.has.charge', defaultMessage: '鍏呯數淇″彿' }),
+ children: <BoolValueIcon value={info?.hasCharge} />,
+ },
+ {
+ label: intl.formatMessage({ id: 'map.pakmk', defaultMessage: '浣滀笟鏍囪' }),
+ children: <BoolValueIcon value={info?.pakMk} />,
+ },
+ {
+ label: intl.formatMessage({ id: 'map.is.enable', defaultMessage: '鏄惁鍚敤' }),
+ children: <BoolValueIcon value={info?.enable} />,
+ },
+ {
+ label: intl.formatMessage({ id: 'map.loc.operation', defaultMessage: '搴撲綅鎿嶄綔' }),
+ span: 3,
+ children: (
+ <>
+ <Button className={styles.tableButton} size='default' type="primary" danger>
+ <FormattedMessage id='map.diable' defaultMessage='绂佺敤' />
+ </Button>
+ <Button className={styles.tableButton} size='default' disabled>
+ <FormattedMessage id='map.enable' defaultMessage='鍚敤' />
+ </Button>
+ <Button
+ className={styles.tableButton}
+ size='default'
+ onClick={() => {
+ setChildrenDrawer(true);
+ }}
+ >
+ <FormattedMessage id='map.handle' defaultMessage='鎵嬪姩鎿嶄綔' />
+ </Button>
+ </>
+ )
+ },
+ ]
+ }
+ />
+ <ShuttleHandle
+ open={childrenDrawer}
+ refCurr={props.refCurr}
+ shuttleNo={data.no}
+ onClose={() => {
+ setChildrenDrawer(false)
+ }}
+ />
+ </div>
+ )}
</div>
</>
)
--
Gitblit v1.9.1