From 819ffe3eeac0fc5c80e3e2a0ce662e3143120cd0 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 19 三月 2024 13:18:14 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/pages/map/drawer/index.jsx              |    8 ++
 zy-asrs-flow/src/pages/map/drawer/point/index.jsx        |   60 ++++++++++++++++++++
 zy-asrs-flow/src/locales/en-US/map.ts                    |    6 ++
 zy-asrs-flow/src/pages/map/components/configSettings.jsx |   64 +++++++++++++++++++++
 zy-asrs-flow/src/pages/map/components/device.jsx         |    2 
 zy-asrs-flow/src/pages/map/utils.js                      |   10 +++
 zy-asrs-flow/src/pages/map/header/search.jsx             |   11 +++
 7 files changed, 159 insertions(+), 2 deletions(-)

diff --git a/zy-asrs-flow/src/locales/en-US/map.ts b/zy-asrs-flow/src/locales/en-US/map.ts
index 06852e0..4048b88 100644
--- a/zy-asrs-flow/src/locales/en-US/map.ts
+++ b/zy-asrs-flow/src/locales/en-US/map.ts
@@ -52,6 +52,12 @@
     '': '',
     '': '',
     '': '',
+    'map.settings.point.horizontal': 'Horizontal',
+    'map.settings.point.vertical': 'Vertical',
+    '': '',
+    '': '',
+    '': '',
+    '': '',
     '': '',
     '': '',
     'map.settings.sub.copy.reverse': 'Reverse',
diff --git a/zy-asrs-flow/src/pages/map/components/configSettings.jsx b/zy-asrs-flow/src/pages/map/components/configSettings.jsx
index f1e5220..01697ee 100644
--- a/zy-asrs-flow/src/pages/map/components/configSettings.jsx
+++ b/zy-asrs-flow/src/pages/map/components/configSettings.jsx
@@ -57,6 +57,30 @@
                                 });
                             }
                             break;
+                        case 'vertical':
+                            const horizontal = form.getFieldValue('horizontal')
+                            if (value && horizontal) {
+                                form.setFieldsValue({
+                                    no: Utils.pureNumStr(value) + '-' + Utils.pureNumStr(horizontal)
+                                });
+                            } else {
+                                form.setFieldsValue({
+                                    no: ''
+                                });
+                            }
+                            break;
+                        case 'horizontal':
+                            const vertical = form.getFieldValue('vertical')
+                            if (value && vertical) {
+                                form.setFieldsValue({
+                                    no: Utils.pureNumStr(vertical) + '-' + Utils.pureNumStr(value)
+                                });
+                            } else {
+                                form.setFieldsValue({
+                                    no: ''
+                                });
+                            }
+                            break;
                         default:
                             break;
                     }
@@ -79,6 +103,11 @@
                         curSprite.data.no = values.no; // *
                         curSprite.data.row = values.row;
                         curSprite.data.bay = values.bay;
+                        break;
+                    case Utils.SENSOR_TYPE.POINT:
+                        curSprite.data.no = values.no; // *
+                        curSprite.data.horizontal = values.horizontal;
+                        curSprite.data.vertical = values.vertical;
                         break;
                     case Utils.SENSOR_TYPE.AGV:
                         curSprite.data.no = values.no; // *
@@ -172,6 +201,41 @@
                     </>
                 )}
 
+                {curSprite?.data?.type === Utils.SENSOR_TYPE.POINT && (
+                    <>
+                        <Form.Item
+                            name='vertical'
+                            label={intl.formatMessage({ id: 'map.settings.point.vertical', defaultMessage: '绾靛悜' })}
+                            rules={[
+                                {
+                                    required: false,
+                                },
+                            ]}
+                        >
+                            <InputNumber
+                                style={{
+                                    width: '50%',
+                                }}
+                            />
+                        </Form.Item>
+                        <Form.Item
+                            name='horizontal'
+                            label={intl.formatMessage({ id: 'map.settings.point.horizontal', defaultMessage: '妯悜' })}
+                            rules={[
+                                {
+                                    required: false,
+                                },
+                            ]}
+                        >
+                            <InputNumber
+                                style={{
+                                    width: '50%',
+                                }}
+                            />
+                        </Form.Item>
+                    </>
+                )}
+
                 <Form.Item
                     name='no'
                     label={intl.formatMessage({ id: 'map.settings.no', defaultMessage: '缂栧彿' })}
diff --git a/zy-asrs-flow/src/pages/map/components/device.jsx b/zy-asrs-flow/src/pages/map/components/device.jsx
index 884f89f..18477fd 100644
--- a/zy-asrs-flow/src/pages/map/components/device.jsx
+++ b/zy-asrs-flow/src/pages/map/components/device.jsx
@@ -50,8 +50,6 @@
         setDragging(true);
         setDragSpriteType(type);
         const sprite = PIXI.Sprite.from(e.target);
-        sprite.width = 20;
-        sprite.height = 20;
         setDragSprite(sprite);
     };
 
diff --git a/zy-asrs-flow/src/pages/map/drawer/index.jsx b/zy-asrs-flow/src/pages/map/drawer/index.jsx
index 9940510..0662017 100644
--- a/zy-asrs-flow/src/pages/map/drawer/index.jsx
+++ b/zy-asrs-flow/src/pages/map/drawer/index.jsx
@@ -5,6 +5,7 @@
 import * as Utils from '../utils'
 import ShelfDrawer from './shelf';
 import AgvDrawer from './agv';
+import PointDrawer from './point'
 
 const useStyles = createStyles(({ token, css }) => {
 
@@ -46,6 +47,13 @@
                         />
                     </>
                 )}
+                {props.curSprite?.data?.type === Utils.SENSOR_TYPE.POINT && (
+                    <>
+                        <PointDrawer
+                            curSprite={curSprite}
+                        />
+                    </>
+                )}
                 {props.curSprite?.data?.type === Utils.SENSOR_TYPE.AGV && (
                     <>
                         <AgvDrawer
diff --git a/zy-asrs-flow/src/pages/map/drawer/point/index.jsx b/zy-asrs-flow/src/pages/map/drawer/point/index.jsx
new file mode 100644
index 0000000..5fd6e94
--- /dev/null
+++ b/zy-asrs-flow/src/pages/map/drawer/point/index.jsx
@@ -0,0 +1,60 @@
+import React, { useState, useRef, useEffect } from 'react';
+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';
+import ShowJson from '../showJson';
+
+const useStyles = createStyles(({ token, css }) => {
+
+})
+
+const PointDrawer = (props) => {
+    const intl = useIntl();
+    const { styles } = useStyles();
+    const [activeTabKey, setActiveTabKey] = useState('json');
+
+    const contentList = {
+        json: (
+            <ShowJson
+                curSprite={props.curSprite}
+            />
+        ),
+    };
+
+    return (
+        <>
+            <Card
+                className='drawer-card'
+                hoverable
+                bordered={false}
+                type='inner'
+                tabList={[
+                    {
+                        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>
+        </>
+    )
+}
+
+export default PointDrawer;
\ No newline at end of file
diff --git a/zy-asrs-flow/src/pages/map/header/search.jsx b/zy-asrs-flow/src/pages/map/header/search.jsx
index 7e58a14..5c70fe6 100644
--- a/zy-asrs-flow/src/pages/map/header/search.jsx
+++ b/zy-asrs-flow/src/pages/map/header/search.jsx
@@ -37,6 +37,17 @@
                         )
                 })
                 break;
+            case Utils.SENSOR_TYPE.POINT:
+                options.push({
+                    value: value,
+                    label:
+                        (
+                            <>
+                                <span style={{ fontWeight: 'bold' }} >{intl.formatMessage({ id: 'map.sensor.type.point', defaultMessage: '瀹氫綅鐐�' })}</span>
+                            </>
+                        )
+                })
+                break;
             default:
                 break;
         }
diff --git a/zy-asrs-flow/src/pages/map/utils.js b/zy-asrs-flow/src/pages/map/utils.js
index bf7a16f..d00398a 100644
--- a/zy-asrs-flow/src/pages/map/utils.js
+++ b/zy-asrs-flow/src/pages/map/utils.js
@@ -5,6 +5,7 @@
 import { API_TIMEOUT } from '@/config/setting'
 import agv from '/public/img/map/agv.svg'
 import shelf from '/public/img/map/shelf.png'
+import point from '/public/img/map/point.svg'
 
 let app = null;
 let mapContainer = null;
@@ -308,6 +309,12 @@
                     label: intl.formatMessage({ id: 'map.sensor.type.agv', defaultMessage: '鏃犱汉灏忚溅' })
                 })
                 break;
+            case SENSOR_TYPE.POINT:
+                options.push({
+                    value: value,
+                    label: intl.formatMessage({ id: 'map.sensor.type.point', defaultMessage: '瀹氫綅鐐�' })
+                })
+                break;
             default:
                 break;
         }
@@ -329,6 +336,9 @@
                 case SENSOR_TYPE.AGV:
                     sprite = PIXI.Sprite.from(agv);
                     break;
+                case SENSOR_TYPE.POINT:
+                    sprite = PIXI.Sprite.from(point);
+                    break;
                 default:
                     break;
             }

--
Gitblit v1.9.1