- 4 FieldBuilder: Carousel/ColorPicker/Rate/Slider (jnpfKey 与 JNPF componentMap.ts 0 误差) - 4 Test 文件: 各 4 个 @Test, 验证 jnpfKey/tag/label/__config__/__vModel__ + 业务字段 - 累计 28 控件 × 4 @Test = 112 测试 PASS (0 失败, 0 错误) - 字段对齐权威源: componentMap.ts (carousel 887-942, colorPicker 604-628, rate 631-658, slider 661-690) - baseline 0 sample (P2 装饰低频), 字段完全依赖前端代码反推
29 lines
1.0 KiB
Python
29 lines
1.0 KiB
Python
#!/usr/bin/env python3
|
|
"""从 35 form baseline 提取所有 rate 控件的 formData 真实样本.
|
|
rate 控件判定: __config__.jnpfKey == 'rate'."""
|
|
import json, glob, os
|
|
|
|
OUT = "scripts/rate-baseline-samples.jsonl"
|
|
samples = []
|
|
for path in glob.glob("/home/ubuntu/ccWorkDir/baseline/*/form/*.json"):
|
|
try:
|
|
d = json.load(open(path))['data']
|
|
fd = json.loads(d['formData']) if isinstance(d.get('formData'), str) else {}
|
|
for f in fd.get('fields', []):
|
|
if isinstance(f, dict):
|
|
cfg = f.get('__config__', {})
|
|
if isinstance(cfg, dict) and cfg.get('jnpfKey') == 'rate':
|
|
samples.append({
|
|
"source": os.path.basename(path),
|
|
"label": f.get('label') or cfg.get('label'),
|
|
"formData": f
|
|
})
|
|
except Exception as e:
|
|
pass
|
|
|
|
with open(OUT, 'w') as out:
|
|
for s in samples:
|
|
out.write(json.dumps(s, ensure_ascii=False) + "\n")
|
|
|
|
print(f"Extracted {len(samples)} rate 控件 samples to {OUT}")
|