feat:[FL-202][ATP模型管理改造] 列表显示值格式化为中文

- 新增 formatDimensionValue 函数,将原始数据值映射为用户友好的中文显示格式
- 表格列渲染使用格式化函数:电压等级带单位(35kV)、塔型显示中文(干字塔)、场景显示中文(反击)、避雷器组合显示标签(M1)
- 卡片视图同步使用格式化函数显示
- 匹配新建表单下拉选项中的展示格式

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
chengkai3
2026-06-28 11:16:36 +08:00
parent 5f0b4b0256
commit 069be0968e
+14 -8
View File
@@ -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() {
<Space direction="vertical" size={10} style={{ width: "100%" }}>
<div className="admin-atp-models-model-card-field">
<Typography.Text type="secondary"></Typography.Text>
<Typography.Text>{item.voltage_level || "-"}</Typography.Text>
<Typography.Text>{formatDimensionValue(item.voltage_level, DEFAULT_VOLTAGE_LEVELS)}</Typography.Text>
</div>
<div className="admin-atp-models-model-card-field">
<Typography.Text type="secondary"></Typography.Text>
<Typography.Text>{item.tower_type || "-"}</Typography.Text>
<Typography.Text>{formatDimensionValue(item.tower_type, DEFAULT_TOWER_TYPES)}</Typography.Text>
</div>
<div className="admin-atp-models-model-card-field">
<Typography.Text type="secondary"></Typography.Text>
<Typography.Text>{item.scene_type || "-"}</Typography.Text>
<Typography.Text>{formatDimensionValue(item.scene_type, DEFAULT_SCENE_TYPES)}</Typography.Text>
</div>
<div className="admin-atp-models-model-card-field">
<Typography.Text type="secondary"></Typography.Text>
<Typography.Text>{item.arrester_config || "-"}</Typography.Text>
<Typography.Text>{formatDimensionValue(item.arrester_config, DEFAULT_ARRESTER_CONFIGS)}</Typography.Text>
</div>
<div className="admin-atp-models-model-card-field">
<Typography.Text type="secondary"></Typography.Text>