From f7543a1cc6c89ea03c0d6a0591526baf10d7934b Mon Sep 17 00:00:00 2001
From: vincentlu <t1341870251@gmail.com>
Date: 星期四, 05 二月 2026 16:37:23 +0800
Subject: [PATCH] #
---
zy-acs-flow/src/map/http.js | 108 ++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 97 insertions(+), 11 deletions(-)
diff --git a/zy-acs-flow/src/map/http.js b/zy-acs-flow/src/map/http.js
index 7fc2322..f1be56e 100644
--- a/zy-acs-flow/src/map/http.js
+++ b/zy-acs-flow/src/map/http.js
@@ -14,6 +14,26 @@
mapContainer = param;
}
+export const fetchMapPreferences = async (zoneId, setMapPreferences) => {
+ try {
+ const res = await request.post('/map/config/preferences', {
+ zoneId: zoneId
+ }, {
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
+ });
+ const { code, msg, data } = res.data;
+ if (code === 200) {
+ setMapPreferences(data);
+ return data || {};
+ }
+ notify?.error(msg);
+ } catch (error) {
+ notify?.error(error.message);
+ console.error(error.message);
+ }
+ return {};
+}
+
export const fetchMapData = (zoneId, setRcsStatus, setCurSprite) => {
Tool.clearMapData();
return request.post('/map/data/fetch', {
@@ -375,9 +395,9 @@
}
-export const fetchZoneList = async (zoneId) => {
+export const fetchAreaList = async (zoneId) => {
try {
- const res = await request.post('/map/zone/list', {
+ const res = await request.post('/map/area/list', {
zoneId: zoneId,
}, {
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
@@ -396,18 +416,84 @@
}
}
-export const saveZoneData = async (zoneId, zoneData) => {
- try {
- const res = await request.post('/map/zone/save', {
- zoneId: zoneId,
- zone: zoneData,
- });
- const { code, msg } = res.data;
- if (code !== 200) {
+export const getAreaInfo = async (param, callback) => {
+ await request.get('/map/area/get', param).then((res) => {
+ const { code, msg, data } = res.data;
+ if (code === 200) {
+ if (callback) {
+ callback(data)
+ }
+ } else {
notify.error(msg);
}
+ }).catch((error) => {
+ notify.error(error.message);
+ console.error(error.message);
+ })
+}
+
+export const saveAreaData = async (zoneId, areaData) => {
+ try {
+ const res = await request.post('/map/area/save', {
+ zoneId: zoneId,
+ ...areaData,
+ });
+ const { code, msg, data } = res.data;
+ if (code !== 200) {
+ notify.error(msg);
+ return null;
+ }
+ return data;
} catch (error) {
notify.error(error.message);
console.error(error.message);
}
-}
\ No newline at end of file
+ return null;
+}
+
+export const updateAreaData = async (payload = {}) => {
+ try {
+ const res = await request.post('/map/area/update', payload);
+ const { code, msg, data } = res.data;
+ if (code === 200) {
+ notify.success(msg);
+ return data;
+ }
+ notify.error(msg);
+ } catch (error) {
+ notify.error(error.message);
+ console.error(error.message);
+ }
+ return null;
+};
+
+export const removeArea = async (id) => {
+ try {
+ const res = await request.post('/map/area/remove', { id });
+ const { code, msg } = res.data;
+ if (code === 200) {
+ notify.success(msg);
+ return true;
+ }
+ notify.error(msg);
+ } catch (error) {
+ notify.error(error.message);
+ console.error(error.message);
+ }
+ return false;
+};
+
+export const fetchAgvListAll = async () => {
+ try {
+ const res = await request.post('/agv/list', {});
+ const { code, msg, data } = res.data;
+ if (code === 200) {
+ return data || [];
+ }
+ notify.error(msg);
+ } catch (error) {
+ notify.error(error.message);
+ console.error(error.message);
+ }
+ return [];
+}
--
Gitblit v1.9.1