#
vincentlu
2025-12-16 17924fac6b08fb267a2d3622e5743fd0002775a6
#
2个文件已修改
73 ■■■■ 已修改文件
zy-acs-flow/src/map/areaSettings/AreaBasicTab.jsx 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/src/map/areaSettings/index.jsx 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-acs-flow/src/map/areaSettings/AreaBasicTab.jsx
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useMemo } from 'react';
import {
    Stack,
    TextField,
@@ -23,6 +23,8 @@
    codeList,
    onSave,
    disableSave,
    onDelete,
    canDelete = false,
}) => {
    const translate = useTranslate();
    const icon = <CheckBoxOutlineBlankIcon fontSize="small" />;
@@ -34,6 +36,26 @@
    const getOptionId = (option) => {
        return option?.id;
    };
    const handleSaveClick = () => {
        if (disableSave) {
            return;
        }
        const confirmMsg = translate('page.map.area.saveConfirm', { _: '确认保存当前修改?' });
        if (window.confirm(confirmMsg)) {
            onSave?.();
        }
    };
    const handleDeleteClick = () => {
        if (!canDelete) {
            return;
        }
        const confirmMsg = translate('page.map.area.deleteConfirm', { _: '删除后将无法恢复,确认删除?' });
        if (window.confirm(confirmMsg)) {
            onDelete?.();
        }
    };
    return (
@@ -148,10 +170,13 @@
                </Paper>
            </Box>
            <Box display="flex" justifyContent="flex-start">
                <Button variant="contained" onClick={onSave} disabled={disableSave}>
            <Box display="flex" justifyContent="space-between" alignItems="center">
                <Button variant="contained" onClick={handleSaveClick} disabled={disableSave}>
                    {translate('common.action.save', { _: '保存' })}
                </Button>
                <Button variant="text" color="error" onClick={handleDeleteClick} disabled={!canDelete}>
                    {translate('common.action.delete', { _: '删除' })}
                </Button>
            </Box>
        </Stack>
    );
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 && (