"""列出配置文件中所有模块和项目"""
import json

with open('abb_mapping_config.json', 'r', encoding='utf-8') as f:
    config = json.load(f)

modules = config.get('modules', {})
total = 0

print("=" * 80)
print("配置文件中的所有检测项目（按模块分类）")
print("=" * 80)

for name, data in modules.items():
    cn_name = data.get('cn_name', '')
    pages = data.get('pages', '')
    items = data.get('items', [])
    
    print(f"\n### {name} ({cn_name}) - 页码: {pages}")
    print("-" * 60)
    print(f"| {'序号':<4} | {'ABB':<20} | {'项目名称':<15} |")
    print("-" * 60)
    
    for i, item in enumerate(items, 1):
        abb = item.get('abb', '')
        project_cn = item.get('project_cn', '')
        print(f"| {i:<4} | {abb:<20} | {project_cn:<15} |")
        total += 1

print("\n" + "=" * 80)
print(f"总计: {len(modules)} 个模块, {total} 个检测项目")
print("=" * 80)
