diff --git a/web/src/app/admin/atp-models/page.tsx b/web/src/app/admin/atp-models/page.tsx index f15a279..09c22d6 100644 --- a/web/src/app/admin/atp-models/page.tsx +++ b/web/src/app/admin/atp-models/page.tsx @@ -141,6 +141,12 @@ function buildDimensionOptions(items: AtpAssetSummary[], picker: (item: AtpAsset .map((value) => ({ label: optionsMap.get(value) || value, value })); } +function formatDimensionValue(value: string | null, defaults: Array<{ label: string; value: string }>): string { + if (!value) return "-"; + const option = defaults.find((opt) => opt.value === value); + return option ? option.label : value; +} + const ATP_TABLE_MIN_SCROLL_Y = 180; const ATP_TABLE_VIEWPORT_GAP = 40; const ATP_TABLE_FALLBACK_RESERVE = 220; @@ -457,25 +463,25 @@ export default function AtpModelsPage() { title: "电压等级", dataIndex: "voltage_level", width: 120, - render: (value: string | null) => value || "-", + render: (value: string | null) => formatDimensionValue(value, DEFAULT_VOLTAGE_LEVELS), }, { title: "塔型", dataIndex: "tower_type", width: 120, - render: (value: string | null) => value || "-", + render: (value: string | null) => formatDimensionValue(value, DEFAULT_TOWER_TYPES), }, { title: "场景", dataIndex: "scene_type", width: 120, - render: (value: string | null) => value || "-", + render: (value: string | null) => formatDimensionValue(value, DEFAULT_SCENE_TYPES), }, { title: "避雷器组合", dataIndex: "arrester_config", width: 120, - render: (value: string | null) => value || "-", + render: (value: string | null) => formatDimensionValue(value, DEFAULT_ARRESTER_CONFIGS), }, { title: "更新时间", @@ -550,19 +556,19 @@ export default function AtpModelsPage() {
电压等级 - {item.voltage_level || "-"} + {formatDimensionValue(item.voltage_level, DEFAULT_VOLTAGE_LEVELS)}
塔型 - {item.tower_type || "-"} + {formatDimensionValue(item.tower_type, DEFAULT_TOWER_TYPES)}
场景 - {item.scene_type || "-"} + {formatDimensionValue(item.scene_type, DEFAULT_SCENE_TYPES)}
避雷器组合 - {item.arrester_config || "-"} + {formatDimensionValue(item.arrester_config, DEFAULT_ARRESTER_CONFIGS)}
更新时间