From e6a599b9aaf8d0ade3f8679c2cf32e0638744be4 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期五, 15 三月 2024 16:39:50 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/pages/map/utils.js |   32 +++++++++++++++++++++++++++++---
 1 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/zy-asrs-flow/src/pages/map/utils.js b/zy-asrs-flow/src/pages/map/utils.js
index cbd8847..bce144c 100644
--- a/zy-asrs-flow/src/pages/map/utils.js
+++ b/zy-asrs-flow/src/pages/map/utils.js
@@ -285,7 +285,7 @@
 }
 
 export const rotationParseNum = (num) => {
-
+    return num * Math.PI / 180;
 }
 
 export const findSpriteByUuid = (uuid) => {
@@ -318,7 +318,34 @@
 
 export const fetchMapData = async () => {
     await Http.doPostPromise('api/map/list', {}, (res) => {
-        console.log(res);
+        const mapItemList = res.data.itemList;
+        mapItemList.forEach(item => {
+            let sprite;
+            switch (item.type) {
+                case SENSOR_TYPE.SHELF:
+                    sprite = PIXI.Sprite.from(shelf);
+                    break;
+                case SENSOR_TYPE.AGV:
+                    sprite = PIXI.Sprite.from(agv);
+                    break;
+                default:
+                    break;
+            }
+            if (sprite) {
+                console.log(item);
+                initSprite(sprite, item.type);
+                // data
+                sprite.data.uuid = item.uuid;
+                sprite.data.no = item.no;
+
+                // graph
+                sprite.position.set(item.positionX, item.positionY);
+                sprite.scale.set(item.scaleX, item.scaleY);
+                sprite.rotation = rotationParseNum(item.rotation);
+                mapContainer.addChild(sprite);
+            }
+        })
+
     }).catch((error) => {
         console.error(error);
     })
@@ -333,7 +360,6 @@
     let mapItemList = [];
     mapContainer?.children.forEach(child => {
         if (child.data?.uuid) {
-            console.log(child.scale, child.rotation);
             mapItemList.push({
                 // data
                 type: child.data.type,

--
Gitblit v1.9.1