From 17924fac6b08fb267a2d3622e5743fd0002775a6 Mon Sep 17 00:00:00 2001
From: vincentlu <t1341870251@gmail.com>
Date: 星期二, 16 十二月 2025 08:37:56 +0800
Subject: [PATCH] #
---
zy-acs-flow/src/map/areaSettings/index.jsx | 42 +++++++++++++++++++++++++++++++-----------
1 files changed, 31 insertions(+), 11 deletions(-)
diff --git a/zy-acs-flow/src/map/areaSettings/index.jsx b/zy-acs-flow/src/map/areaSettings/index.jsx
index 103ac33..1c340fd 100644
--- a/zy-acs-flow/src/map/areaSettings/index.jsx
+++ b/zy-acs-flow/src/map/areaSettings/index.jsx
@@ -1,4 +1,4 @@
-import React, { useState, useEffect, useMemo } from 'react';
+import React, { useState, useEffect } from 'react';
import { useTranslate } from "react-admin";
import {
Drawer,
@@ -17,7 +17,7 @@
import { PAGE_DRAWER_WIDTH } from '@/config/setting';
import AreaBasicTab from './AreaBasicTab';
import AreaAdvancedTab from './AreaAdvancedTab';
-import { getAreaInfo, fetchAgvListAll } from '../http';
+import { getAreaInfo, fetchAgvListAll, updateAreaData, removeArea } from '../http';
const getAgvOptionId = (option) => {
if (typeof option === 'string') {
@@ -120,16 +120,35 @@
setActiveTab(newValue);
};
- const handleSaveBasic = () => {
- // console.log({
- // name,
- // agvIds: agvList.map(getAgvOptionId),
- // });
- // placeholder for save logic
- setInitialBasic({
+ const handleSaveBasic = async () => {
+ const areaId = sprite?.data?.id;
+ if (!areaId) {
+ return;
+ }
+ const payload = {
+ areaId,
name,
agvIds: agvList.map(getAgvOptionId),
- });
+ };
+ const success = await updateAreaData(payload);
+ if (success) {
+ setInitialBasic({
+ name,
+ agvIds: payload.agvIds,
+ });
+ fetchAreaInfo(areaId);
+ }
+ };
+
+ const handleDeleteArea = async () => {
+ const areaId = sprite?.data?.id;
+ if (!areaId) {
+ return;
+ }
+ const success = await removeArea(areaId);
+ if (success) {
+ onCancel?.();
+ }
};
const handleSaveAdvanced = () => {
@@ -141,7 +160,6 @@
agvList.map(getAgvOptionId),
initialBasic.agvIds
);
-
return (
<>
<Drawer
@@ -204,6 +222,8 @@
codeList={codeList}
onSave={handleSaveBasic}
disableSave={!basicDirty}
+ onDelete={handleDeleteArea}
+ canDelete={Boolean(sprite?.data?.id)}
/>
)}
{activeTab === 1 && (
--
Gitblit v1.9.1