#
vincentlu
2026-03-21 5df3c4f3b8a1ca3f81f91dcb904d17b7bfc40017
zy-acs-flow/src/map/insight/code/CodeMain.jsx
@@ -55,16 +55,14 @@
        () => extractRelationItems(info, ['routeList', 'routes', 'routeRefs']),
        [info]
    );
    const funcStaBool = detectBoolean(
        info?.funcStaBool ?? info?.isFuncSta ?? info?.funcStation ?? info?.funcStaFlag
    const funcStaRelations = useMemo(
        () => extractRelationItems(info, ['funcStaList', 'funcStas']),
        [info]
    );
    const funcStaText = info?.funcSta$ || info?.funcStaName || info?.funcStaType || info?.funcStaCode || info?.funcStaUuid || info?.funcSta;
    const ruleList = useMemo(() => normalizeDirRule(info?.dirRule), [info?.dirRule]);
    const spatialItems = [
        { label: translate('table.field.code.x'), value: formatNumber(info?.x, 0), hideWhenEmpty: true },
        { label: translate('table.field.code.y'), value: formatNumber(info?.y, 0), hideWhenEmpty: true },
        {
            label: translate('page.map.insight.code.fields.mapPosition', { _: '地图坐标' }),
            render: () => (
@@ -102,10 +100,6 @@
            redirect('edit', 'code', info.id);
        }
    };
    const funcStaLabel = funcStaBool == null
        ? translate('common.enums.na')
        : translate(funcStaBool ? 'common.enums.true' : 'common.enums.false');
    return (
        <Box sx={{ pr: 1, pb: 3 }}>
@@ -147,7 +141,7 @@
                                    disabled={!info?.id}
                                    sx={{ alignSelf: 'flex-start', textTransform: 'none', px: 3 }}
                                >
                                    {translate('page.map.insight.code.actions.openDetail', { _: '进入 Code 页面' })}
                                    {translate('page.map.insight.code.actions.openDetail', { _: '编辑' })}
                                </Button>
                            </Stack>
                        </Paper>
@@ -174,23 +168,16 @@
                                />
                            </InfoPanel>
                            <InfoPanel title={translate('page.map.insight.code.relations.routes', { _: '关联路线' })}>
                                <RelationsChips
                                <RelationsList
                                    items={routeRelations}
                                    emptyLabel={translate('page.map.insight.code.relations.empty', { _: '暂无关联信息' })}
                                />
                            </InfoPanel>
                            <InfoPanel title={translate('menu.funcSta', { _: '功能站' })}>
                                <Stack spacing={1}>
                                    <BooleanDisplay
                                        value={funcStaBool}
                                        label={funcStaLabel}
                                    />
                                    {funcStaText && funcStaText !== funcStaLabel && (
                                        <Typography variant="body2" color="text.secondary">
                                            {funcStaText}
                                        </Typography>
                                    )}
                                </Stack>
                                <RelationsChips
                                    items={funcStaRelations}
                                    emptyLabel={translate('page.map.insight.code.relations.empty', { _: '暂无关联信息' })}
                                />
                            </InfoPanel>
                        </Stack>
                    </Paper>
@@ -240,6 +227,43 @@
                    label={`+${items.length - MAX_RELATION_ITEMS}`}
                    size="small"
                />
            )}
        </Stack>
    );
};
const RelationsList = ({ items, emptyLabel }) => {
    if (!items?.length) {
        return (
            <Typography variant="body2" color="text.disabled">
                {emptyLabel}
            </Typography>
        );
    }
    return (
        <Stack spacing={1}>
            {items.slice(0, MAX_RELATION_ITEMS).map((item, index) => (
                <Box
                    key={`${getRelationKey(item)}-${index}`}
                    sx={{
                        px: 1.25,
                        py: 0.75,
                        borderRadius: 999,
                        border: '1px solid',
                        borderColor: 'divider',
                        backgroundColor: 'background.default',
                    }}
                >
                    <Typography variant="body2" sx={{ lineHeight: 1.2 }}>
                        {getRelationLabel(item)}
                    </Typography>
                </Box>
            ))}
            {items.length > MAX_RELATION_ITEMS && (
                <Typography variant="caption" color="text.secondary">
                    +{items.length - MAX_RELATION_ITEMS}
                </Typography>
            )}
        </Stack>
    );
@@ -592,6 +616,12 @@
        return item;
    }
    if (typeof item === 'object') {
        if (item.startCode$ && item.endCode$) {
            return `${item.startCode$} -> ${item.endCode$}`;
        }
        if (item.name || item.type || item.state) {
            return [item.name, item.type, item.state].filter(Boolean).join(' / ');
        }
        return item.name || item.code || item.data || item.no || item.uuid || item.locNo || item.staNo || JSON.stringify(item);
    }
    return String(item);