#
vincentlu
2025-12-16 01e6aae8ac9ceea44a4a36199d27d24f5cf565df
zy-acs-flow/src/map/areaSettings/index.jsx
@@ -20,12 +20,13 @@
import { getAreaInfo, fetchAgvListAll, updateAreaData, removeArea } from '../http';
const getAgvOptionId = (option) => {
    // console.log(option);
    if (typeof option === 'string') {
        return option;
    if (option == null) {
        return '';
    }
    return option?.value ?? option?.id ?? option?.agvNo ?? option?.code ?? option?.name ?? '';
    if (typeof option === 'string' || typeof option === 'number') {
        return String(option);
    }
    return option?.id ?? '';
};
const areAgvSelectionsEqual = (aIds = [], bIds = []) => {
@@ -34,6 +35,14 @@
    }
    const setA = new Set(aIds);
    return bIds.every(id => setA.has(id));
};
const mapSelectionToOptions = (selection = [], options = []) => {
    const optionMap = new Map(options.map(option => [getAgvOptionId(option), option]));
    return selection
        .map(item => optionMap.get(item) || null)
        .filter(Boolean);
};
const AreaSettings = (props) => {
@@ -101,10 +110,11 @@
            setPriority(curAreaInfo.priority ?? '');
            const selected = curAreaInfo.agvList || [];
            setAgvList(selected);
            const normalizedSelection = mapSelectionToOptions(selected, agvOptions);
            setAgvList(normalizedSelection);
            setInitialBasic({
                name: curAreaInfo.name || '',
                agvIds: selected
                agvIds: normalizedSelection.map(getAgvOptionId)
            });
            const codes = curAreaInfo.codeList || [];