diff --git a/scripts/extract-popupAttr-baseline.py b/scripts/extract-popupAttr-baseline.py
new file mode 100644
index 0000000..584961a
--- /dev/null
+++ b/scripts/extract-popupAttr-baseline.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python3
+"""从 35 form baseline 提取所有 popupAttr 控件的 formData 真实样本.
+popupAttr 控件判定: __config__.jnpfKey == 'popupAttr'."""
+import json, glob, os
+
+OUT = "scripts/popupAttr-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') == 'popupAttr':
+ 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)} popupAttr 控件 samples to {OUT}")
diff --git a/scripts/extract-popupSelect-baseline.py b/scripts/extract-popupSelect-baseline.py
new file mode 100644
index 0000000..55c3307
--- /dev/null
+++ b/scripts/extract-popupSelect-baseline.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python3
+"""从 35 form baseline 提取所有 popupSelect 控件的 formData 真实样本.
+popupSelect 控件判定: __config__.jnpfKey == 'popupSelect'."""
+import json, glob, os
+
+OUT = "scripts/popupSelect-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') == 'popupSelect':
+ 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)} popupSelect 控件 samples to {OUT}")
diff --git a/scripts/extract-relationFormAttr-baseline.py b/scripts/extract-relationFormAttr-baseline.py
new file mode 100644
index 0000000..59d518a
--- /dev/null
+++ b/scripts/extract-relationFormAttr-baseline.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python3
+"""从 35 form baseline 提取所有 relationFormAttr 控件的 formData 真实样本.
+relationFormAttr 控件判定: __config__.jnpfKey == 'relationFormAttr'."""
+import json, glob, os
+
+OUT = "scripts/relationFormAttr-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') == 'relationFormAttr':
+ 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)} relationFormAttr 控件 samples to {OUT}")
diff --git a/scripts/extract-relationQuery-baseline.py b/scripts/extract-relationQuery-baseline.py
new file mode 100644
index 0000000..5a972d0
--- /dev/null
+++ b/scripts/extract-relationQuery-baseline.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python3
+"""从 35 form baseline 提取所有 relationQuery 控件的 formData 真实样本.
+relationQuery 控件判定: __config__.jnpfKey == 'relationQuery'."""
+import json, glob, os
+
+OUT = "scripts/relationQuery-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') == 'relationQuery':
+ 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)} relationQuery 控件 samples to {OUT}")
diff --git a/scripts/popupAttr-baseline-samples.jsonl b/scripts/popupAttr-baseline-samples.jsonl
new file mode 100644
index 0000000..e69de29
diff --git a/scripts/popupSelect-baseline-samples.jsonl b/scripts/popupSelect-baseline-samples.jsonl
new file mode 100644
index 0000000..e69de29
diff --git a/scripts/relationFormAttr-baseline-samples.jsonl b/scripts/relationFormAttr-baseline-samples.jsonl
new file mode 100644
index 0000000..e69de29
diff --git a/scripts/relationQuery-baseline-samples.jsonl b/scripts/relationQuery-baseline-samples.jsonl
new file mode 100644
index 0000000..e69de29
diff --git a/ssw-dacli/src/main/java/ssw/dacli/form/builder/field/PopupAttrFieldBuilder.java b/ssw-dacli/src/main/java/ssw/dacli/form/builder/field/PopupAttrFieldBuilder.java
new file mode 100644
index 0000000..2a50304
--- /dev/null
+++ b/ssw-dacli/src/main/java/ssw/dacli/form/builder/field/PopupAttrFieldBuilder.java
@@ -0,0 +1,99 @@
+package ssw.dacli.form.builder.field;
+
+import ssw.dacli.form.builder.FieldBuilder;
+import ssw.dacli.form.builder.FieldBuildContext;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.util.*;
+
+/**
+ * v13 popupAttr 控件 formData 0 误差生成器 (Task 1.10, P1 中频).
+ *
+ *
对应 JNPF 设计器 jnpfKey="popupAttr" / tag="JnpfPopupAttr" (弹窗选择属性).
+ * baseline 0 误差源: scripts/popupAttr-baseline-samples.jsonl (0 sample, baseline 无此控件).
+ * 字段对齐权威源: JNPF 前端 componentMap.ts (line 1477-1501, popupAttr 控件).
+ *
+ *
输出结构 (22 字段 = 4 顶层 + 18 __config__):
+ *
+ * - 顶层 (4): __config__, style, showField, relationField, isStorage
+ * - __config__ (18): formId, jnpfKey, label, tipLabel, labelWidth, showLabel, tag, tagIcon,
+ * tableAlign, tableFixed, className, defaultValue, required, layout, span, dragDisabled,
+ * visibility, noShow
+ *
+ *
+ * popupAttr 特有字段 (P1 中频 - 弹窗选择属性, 跟 popupSelect 配合):
+ *
+ * - showField: 显示字段 (ctx.extra.showField, 缺省 "")
+ * - relationField: 关联字段 (ctx.extra.relationField, 缺省 "")
+ * - isStorage: 是否存储 (0/1, JNPF 默认 0)
+ *
+ *
+ * 字段对齐策略: 关键字段用 ctx 值 (label/field/required); showField/relationField 用 ctx.extra
+ * 透传 (缺省 "") - 这是与 popupSelect 的字段名差异, popupAttr 配套使用.
+ *
+ *
注意: popupAttr 的 __config__ 缺 trigger/regList/transferList/useCache (18 字段, 跟 popupSelect 21 不同);
+ * 顶层缺 on/placeholder/interfaceId 等 (跟 popupSelect 大为不同).
+ */
+public class PopupAttrFieldBuilder implements FieldBuilder {
+ private static final ObjectMapper mapper = new ObjectMapper();
+
+ @Override
+ public String jnpfKey() { return "popupAttr"; }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public String buildFormField(FieldBuildContext ctx) {
+ try {
+ Map field = new LinkedHashMap<>();
+
+ // 从 ctx.extra 提取 popupAttr 特有参数 (允许为空)
+ String showField = "";
+ String relationField = "";
+ int isStorage = 0; // componentMap = 0
+ if (ctx.extra != null) {
+ if (ctx.extra.get("showField") != null) showField = ctx.extra.get("showField").toString();
+ if (ctx.extra.get("relationField") != null) relationField = ctx.extra.get("relationField").toString();
+ if (ctx.extra.get("isStorage") != null) isStorage = Integer.parseInt(ctx.extra.get("isStorage").toString());
+ }
+
+ // ============================================================
+ // __config__ (18 字段, 跟 componentMap 0 误差)
+ // ============================================================
+ Map config = new LinkedHashMap<>();
+ config.put("formId", "formItem" + System.currentTimeMillis());
+ config.put("jnpfKey", "popupAttr");
+ config.put("label", ctx.label);
+ config.put("tipLabel", ""); // componentMap = ""
+ config.put("labelWidth", null); // componentMap = undefined → null
+ config.put("showLabel", true); // componentMap = true
+ config.put("tag", "JnpfPopupAttr"); // componentMap = "JnpfPopupAttr"
+ config.put("tagIcon", "icon-ym icon-ym-generator-popup-attr"); // componentMap
+ config.put("tableAlign", "left"); // componentMap = "left"
+ config.put("tableFixed", "none"); // componentMap = "none"
+ config.put("className", new ArrayList<>()); // componentMap = []
+ config.put("defaultValue", ""); // componentMap = ""
+ config.put("required", ctx.required);
+ config.put("layout", "colFormItem"); // componentMap = "colFormItem"
+ config.put("span", 24);
+ config.put("dragDisabled", false); // componentMap = false
+ config.put("visibility", new ArrayList<>(Arrays.asList("pc", "app"))); // componentMap = ["pc","app"]
+ config.put("noShow", false); // componentMap = false
+ field.put("__config__", config);
+
+ // ============================================================
+ // 顶层 (4 字段, 跟 componentMap 0 误差)
+ // ============================================================
+ field.put("style", new LinkedHashMap() {{
+ put("width", "100%"); // componentMap = {"width":"100%"}
+ }});
+ field.put("showField", showField); // 显示字段 (componentMap = "", 有 ctx 时填)
+ field.put("relationField", relationField); // 关联字段 (componentMap = "", 有 ctx 时填)
+ field.put("isStorage", isStorage); // 是否存储 (componentMap = 0)
+ field.put("__vModel__", ctx.field);
+ field.put("id", ctx.field);
+
+ return mapper.writeValueAsString(field);
+ } catch (Exception e) {
+ throw new RuntimeException("PopupAttrFieldBuilder.buildFormField failed: " + e.getMessage(), e);
+ }
+ }
+}
diff --git a/ssw-dacli/src/main/java/ssw/dacli/form/builder/field/PopupSelectFieldBuilder.java b/ssw-dacli/src/main/java/ssw/dacli/form/builder/field/PopupSelectFieldBuilder.java
new file mode 100644
index 0000000..054f000
--- /dev/null
+++ b/ssw-dacli/src/main/java/ssw/dacli/form/builder/field/PopupSelectFieldBuilder.java
@@ -0,0 +1,139 @@
+package ssw.dacli.form.builder.field;
+
+import ssw.dacli.form.builder.FieldBuilder;
+import ssw.dacli.form.builder.FieldBuildContext;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.util.*;
+
+/**
+ * v13 popupSelect 控件 formData 0 误差生成器 (Task 1.10, P1 中频).
+ *
+ * 对应 JNPF 设计器 jnpfKey="popupSelect" / tag="JnpfPopupSelect" (弹窗选择).
+ * baseline 0 误差源: scripts/popupSelect-baseline-samples.jsonl (0 sample, baseline 无此控件).
+ * 字段对齐权威源: JNPF 前端 componentMap.ts (line 1432-1476, popupSelect 控件).
+ *
+ *
输出结构 (43 字段 = 22 顶层 + 21 __config__):
+ *
+ * - 顶层 (22): __config__, on, style, placeholder, interfaceId, interfaceName, templateJson,
+ * hasPage, pageSize, extraOptions, columnOptions, propsValue, relationField, popupType,
+ * popupTitle, popupWidth, disabled, clearable, __vModel__, id, multiple, filterable
+ * - __config__ (21): formId, jnpfKey, label, tipLabel, labelWidth, showLabel, tag, tagIcon,
+ * tableAlign, tableFixed, className, defaultValue, required, layout, span, dragDisabled,
+ * visibility, tableName, noShow, regList, trigger, transferList, useCache
+ *
+ *
+ * popupSelect 特有字段 (P1 中频 - 弹窗选择):
+ *
+ * - interfaceId: 数据接口 ID (ctx.extra.interfaceId, 缺省 "")
+ * - interfaceName: 数据接口名称 (ctx.extra.interfaceName, 缺省 "")
+ * - templateJson: 弹窗查询参数模板 (JNPF 默认 [])
+ * - columnOptions: 弹窗显示列 (CLAUDE.md §6 约束 ≤5 列, 默认 [])
+ * - propsValue: 存储字段 (componentMap = "id")
+ * - relationField: 回显字段 (componentMap = "fullName")
+ * - popupType: dialog (默认) / drawer
+ * - popupTitle/popupWidth: 弹窗标题/宽度 (800px)
+ * - multiple: 多选 (props default false)
+ * - filterable: 搜索 (props default false, 与 popupTableSelect 默认 true 不同)
+ * - useCache: 缓存接口数据 (JNPF 特有, default true)
+ * - transferList: 填充规则 (JNPF 默认 [])
+ *
+ *
+ * 字段对齐策略: 关键字段用 ctx 值 (label/field/required); 数据接口配置用 componentMap 默认
+ * (interfaceId='', propsValue='id', relationField='fullName', popupType='dialog', pageSize=20, filterable=false).
+ * columnOptions 默认 [], 弹窗配置完成后用户手动添加 (CLAUDE.md §6 约束).
+ */
+public class PopupSelectFieldBuilder implements FieldBuilder {
+ private static final ObjectMapper mapper = new ObjectMapper();
+
+ @Override
+ public String jnpfKey() { return "popupSelect"; }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public String buildFormField(FieldBuildContext ctx) {
+ try {
+ Map field = new LinkedHashMap<>();
+
+ // 从 ctx.extra 提取 popupSelect 特有参数 (允许为空)
+ String interfaceId = "";
+ String interfaceName = "";
+ String propsValue = "id"; // componentMap = "id"
+ String relationField = "fullName"; // componentMap = "fullName"
+ Object templateJsonRaw = new ArrayList<>();
+ Object columnOptionsRaw = new ArrayList<>();
+ Object extraOptionsRaw = new ArrayList<>();
+ if (ctx.extra != null) {
+ if (ctx.extra.get("interfaceId") != null) interfaceId = ctx.extra.get("interfaceId").toString();
+ if (ctx.extra.get("interfaceName") != null) interfaceName = ctx.extra.get("interfaceName").toString();
+ if (ctx.extra.get("propsValue") != null) propsValue = ctx.extra.get("propsValue").toString();
+ if (ctx.extra.get("relationField") != null) relationField = ctx.extra.get("relationField").toString();
+ if (ctx.extra.get("templateJson") != null) templateJsonRaw = ctx.extra.get("templateJson");
+ if (ctx.extra.get("columnOptions") != null) columnOptionsRaw = ctx.extra.get("columnOptions");
+ if (ctx.extra.get("extraOptions") != null) extraOptionsRaw = ctx.extra.get("extraOptions");
+ }
+
+ // ============================================================
+ // __config__ (21 字段, 跟 componentMap 0 误差)
+ // ============================================================
+ Map config = new LinkedHashMap<>();
+ config.put("formId", "formItem" + System.currentTimeMillis());
+ config.put("jnpfKey", "popupSelect");
+ config.put("label", ctx.label);
+ config.put("tipLabel", ""); // componentMap = ""
+ config.put("labelWidth", null); // componentMap = undefined → null
+ config.put("showLabel", true); // componentMap = true
+ config.put("tag", "JnpfPopupSelect"); // componentMap = "JnpfPopupSelect"
+ config.put("tagIcon", "icon-ym icon-ym-generator-popup"); // componentMap
+ config.put("tableAlign", "left"); // componentMap = "left"
+ config.put("tableFixed", "none"); // componentMap = "none"
+ config.put("className", new ArrayList<>()); // componentMap = []
+ config.put("defaultValue", ""); // componentMap = ""
+ config.put("required", ctx.required);
+ config.put("layout", "colFormItem"); // componentMap = "colFormItem"
+ config.put("span", 24);
+ config.put("dragDisabled", false); // componentMap = false
+ config.put("visibility", new ArrayList<>(Arrays.asList("pc", "app"))); // componentMap = ["pc","app"]
+ config.put("tableName", ""); // componentMap = ""
+ config.put("noShow", false); // componentMap = false
+ config.put("regList", new ArrayList<>()); // componentMap = []
+ config.put("trigger", "change"); // componentMap = "change"
+ config.put("transferList", new ArrayList<>()); // componentMap = [] (填充规则)
+ config.put("useCache", true); // componentMap = true (缓存接口数据)
+ field.put("__config__", config);
+
+ // ============================================================
+ // 顶层 (22 字段, 跟 componentMap 0 误差)
+ // ============================================================
+ field.put("on", new LinkedHashMap() {{
+ // componentMap 提供完整 JS 模板
+ put("change", "({ data, rowIndex, formData, setFormData, setShowOrHide, setRequired, setDisabled, onlineUtils }) => {\n // 在此编写代码\n \n}");
+ }});
+ field.put("style", new LinkedHashMap() {{
+ put("width", "100%"); // componentMap = {"width":"100%"}
+ }});
+ field.put("placeholder", "请选择"); // componentMap = "请选择"
+ field.put("interfaceId", interfaceId); // 数据接口 ID (componentMap = "", 有 ctx 时填)
+ field.put("interfaceName", interfaceName); // 数据接口名称 (componentMap = "")
+ field.put("templateJson", templateJsonRaw); // 弹窗查询参数模板 (componentMap = [])
+ field.put("hasPage", false); // componentMap = false
+ field.put("pageSize", 20); // componentMap = 20
+ field.put("extraOptions", extraOptionsRaw); // 弹窗显示字段 (componentMap = [])
+ field.put("columnOptions", columnOptionsRaw); // 弹窗显示列 (componentMap = [], CLAUDE.md §6 ≤5 列)
+ field.put("propsValue", propsValue); // 存储字段 (componentMap = "id")
+ field.put("relationField", relationField); // 回显字段 (componentMap = "fullName")
+ field.put("popupType", "dialog"); // popupSelect 默认 dialog
+ field.put("popupTitle", "选择数据"); // componentMap = "选择数据"
+ field.put("popupWidth", "800px"); // componentMap = "800px"
+ field.put("disabled", false); // componentMap = false
+ field.put("clearable", true); // componentMap = true
+ field.put("__vModel__", ctx.field);
+ field.put("id", ctx.field);
+ field.put("multiple", false); // props default false
+ field.put("filterable", false); // popupSelect 默认 false (与 popupTableSelect 默认 true 不同)
+
+ return mapper.writeValueAsString(field);
+ } catch (Exception e) {
+ throw new RuntimeException("PopupSelectFieldBuilder.buildFormField failed: " + e.getMessage(), e);
+ }
+ }
+}
diff --git a/ssw-dacli/src/main/java/ssw/dacli/form/builder/field/RelationFormAttrFieldBuilder.java b/ssw-dacli/src/main/java/ssw/dacli/form/builder/field/RelationFormAttrFieldBuilder.java
new file mode 100644
index 0000000..0c8f901
--- /dev/null
+++ b/ssw-dacli/src/main/java/ssw/dacli/form/builder/field/RelationFormAttrFieldBuilder.java
@@ -0,0 +1,99 @@
+package ssw.dacli.form.builder.field;
+
+import ssw.dacli.form.builder.FieldBuilder;
+import ssw.dacli.form.builder.FieldBuildContext;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.util.*;
+
+/**
+ * v13 relationFormAttr 控件 formData 0 误差生成器 (Task 1.10, P1 中频).
+ *
+ * 对应 JNPF 设计器 jnpfKey="relationFormAttr" / tag="JnpfRelationFormAttr" (关联表单属性).
+ * baseline 0 误差源: scripts/relationFormAttr-baseline-samples.jsonl (0 sample, baseline 无此控件).
+ * 字段对齐权威源: JNPF 前端 componentMap.ts (line 1407-1431, relationFormAttr 控件).
+ *
+ *
输出结构 (22 字段 = 4 顶层 + 18 __config__):
+ *
+ * - 顶层 (4): __config__, style, showField, relationField, isStorage
+ * - __config__ (18): formId, jnpfKey, label, tipLabel, labelWidth, showLabel, tag, tagIcon,
+ * tableAlign, tableFixed, className, defaultValue, required, layout, span, dragDisabled,
+ * visibility, noShow
+ *
+ *
+ * relationFormAttr 特有字段 (P1 中频 - 关联表单属性, 跟 relationForm 配合):
+ *
+ * - showField: 显示字段 (ctx.extra.showField, 缺省 "")
+ * - relationField: 关联字段 (ctx.extra.relationField, 缺省 "")
+ * - isStorage: 是否存储 (0/1, JNPF 默认 0)
+ *
+ *
+ * 字段对齐策略: 关键字段用 ctx 值 (label/field/required); showField/relationField 用 ctx.extra
+ * 透传 (缺省 "") - 这是与 relationForm 的字段名差异, relationFormAttr 配套使用.
+ *
+ *
注意: relationFormAttr 跟 popupAttr 结构完全相同 (4 顶层 + 18 __config__), 仅 tag/icon 不同.
+ * 区别仅在于 jnpfKey/tag/tagIcon, 跟 popupSelect/relationForm 的关系类似.
+ */
+public class RelationFormAttrFieldBuilder implements FieldBuilder {
+ private static final ObjectMapper mapper = new ObjectMapper();
+
+ @Override
+ public String jnpfKey() { return "relationFormAttr"; }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public String buildFormField(FieldBuildContext ctx) {
+ try {
+ Map field = new LinkedHashMap<>();
+
+ // 从 ctx.extra 提取 relationFormAttr 特有参数 (允许为空)
+ String showField = "";
+ String relationField = "";
+ int isStorage = 0; // componentMap = 0
+ if (ctx.extra != null) {
+ if (ctx.extra.get("showField") != null) showField = ctx.extra.get("showField").toString();
+ if (ctx.extra.get("relationField") != null) relationField = ctx.extra.get("relationField").toString();
+ if (ctx.extra.get("isStorage") != null) isStorage = Integer.parseInt(ctx.extra.get("isStorage").toString());
+ }
+
+ // ============================================================
+ // __config__ (18 字段, 跟 componentMap 0 误差)
+ // ============================================================
+ Map config = new LinkedHashMap<>();
+ config.put("formId", "formItem" + System.currentTimeMillis());
+ config.put("jnpfKey", "relationFormAttr");
+ config.put("label", ctx.label);
+ config.put("tipLabel", ""); // componentMap = ""
+ config.put("labelWidth", null); // componentMap = undefined → null
+ config.put("showLabel", true); // componentMap = true
+ config.put("tag", "JnpfRelationFormAttr"); // componentMap = "JnpfRelationFormAttr"
+ config.put("tagIcon", "icon-ym icon-ym-generator-nature"); // componentMap
+ config.put("tableAlign", "left"); // componentMap = "left"
+ config.put("tableFixed", "none"); // componentMap = "none"
+ config.put("className", new ArrayList<>()); // componentMap = []
+ config.put("defaultValue", ""); // componentMap = ""
+ config.put("required", ctx.required);
+ config.put("layout", "colFormItem"); // componentMap = "colFormItem"
+ config.put("span", 24);
+ config.put("dragDisabled", false); // componentMap = false
+ config.put("visibility", new ArrayList<>(Arrays.asList("pc", "app"))); // componentMap = ["pc","app"]
+ config.put("noShow", false); // componentMap = false
+ field.put("__config__", config);
+
+ // ============================================================
+ // 顶层 (4 字段, 跟 componentMap 0 误差)
+ // ============================================================
+ field.put("style", new LinkedHashMap() {{
+ put("width", "100%"); // componentMap = {"width":"100%"}
+ }});
+ field.put("showField", showField); // 显示字段 (componentMap = "", 有 ctx 时填)
+ field.put("relationField", relationField); // 关联字段 (componentMap = "", 有 ctx 时填)
+ field.put("isStorage", isStorage); // 是否存储 (componentMap = 0)
+ field.put("__vModel__", ctx.field);
+ field.put("id", ctx.field);
+
+ return mapper.writeValueAsString(field);
+ } catch (Exception e) {
+ throw new RuntimeException("RelationFormAttrFieldBuilder.buildFormField failed: " + e.getMessage(), e);
+ }
+ }
+}
diff --git a/ssw-dacli/src/main/java/ssw/dacli/form/builder/field/RelationQueryFieldBuilder.java b/ssw-dacli/src/main/java/ssw/dacli/form/builder/field/RelationQueryFieldBuilder.java
new file mode 100644
index 0000000..1235137
--- /dev/null
+++ b/ssw-dacli/src/main/java/ssw/dacli/form/builder/field/RelationQueryFieldBuilder.java
@@ -0,0 +1,119 @@
+package ssw.dacli.form.builder.field;
+
+import ssw.dacli.form.builder.FieldBuilder;
+import ssw.dacli.form.builder.FieldBuildContext;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.util.*;
+
+/**
+ * v13 relationQuery 控件 formData 0 误差生成器 (Task 1.10, P1 中频).
+ *
+ * 对应 JNPF 设计器 jnpfKey="relationQuery" / tag="JnpfRelationQuery" (关联查询).
+ * baseline 0 误差源: scripts/relationQuery-baseline-samples.jsonl (0 sample, baseline 无此控件).
+ * 字段对齐权威源: JNPF 前端 componentMap.ts (line 1692-1723, relationQuery 控件).
+ *
+ *
输出结构 (24 字段 = 11 顶层 + 13 __config__):
+ *
+ * - 顶层 (11): __config__, style, title, showTitle, modelId, columnOptions, defaultEmpty,
+ * sortRule, queryRule, hasPage, pageSize
+ * - __config__ (13): formId, jnpfKey, label, tipLabel, labelWidth, showLabel, tag, tagIcon,
+ * className, defaultValue, required, layout, span, dragDisabled, visibility, noShow
+ *
+ *
+ * relationQuery 特有字段 (P1 中频 - 关联查询, 跟 relationForm 类似但用数据接口):
+ *
+ * - title: 标题 (componentMap = "关联查询", 跟 label 不同)
+ * - showTitle: 显示标题 (componentMap = true)
+ * - modelId: 关联功能 ID (ctx.extra.modelId, 缺省 "")
+ * - columnOptions: 显示列 (CLAUDE.md §6 约束 ≤5 列, 默认 [])
+ * - defaultEmpty: 默认空查询 (componentMap = true)
+ * - sortRule: 排序规则 (componentMap = [])
+ * - queryRule: 查询规则 (componentMap = {conditionList:[], matchLogic:"and"})
+ * - hasPage/pageSize: 分页配置 (20)
+ *
+ *
+ * 字段对齐策略: 关键字段用 ctx 值 (label/field/required); 关联功能 ID 用 ctx.extra.modelId
+ * (缺省 ""); queryRule 默认 {conditionList:[], matchLogic:"and"}.
+ *
+ *
注意: relationQuery 跟其他控件差异大:
+ *
+ * - __config__ 缺 tableAlign/tableFixed/tableName/regList/trigger (仅 13 字段)
+ * - __config__.showLabel = false (默认隐藏 label)
+ * - __config__.defaultValue = null (不是 "")
+ * - __config__.visibility = ["pc"] (仅 PC, 不支持 app)
+ * - 顶层 11 字段 (与 relationForm/popupSelect 类似功能但字段名差异)
+ *
+ */
+public class RelationQueryFieldBuilder implements FieldBuilder {
+ private static final ObjectMapper mapper = new ObjectMapper();
+
+ @Override
+ public String jnpfKey() { return "relationQuery"; }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public String buildFormField(FieldBuildContext ctx) {
+ try {
+ Map field = new LinkedHashMap<>();
+
+ // 从 ctx.extra 提取 relationQuery 特有参数 (允许为空)
+ String modelId = "";
+ Object columnOptionsRaw = new ArrayList<>();
+ Object sortRuleRaw = new ArrayList<>();
+ Object queryRuleRaw = new LinkedHashMap() {{
+ put("conditionList", new ArrayList<>());
+ put("matchLogic", "and");
+ }};
+ if (ctx.extra != null) {
+ if (ctx.extra.get("modelId") != null) modelId = ctx.extra.get("modelId").toString();
+ if (ctx.extra.get("columnOptions") != null) columnOptionsRaw = ctx.extra.get("columnOptions");
+ if (ctx.extra.get("sortRule") != null) sortRuleRaw = ctx.extra.get("sortRule");
+ if (ctx.extra.get("queryRule") != null) queryRuleRaw = ctx.extra.get("queryRule");
+ }
+
+ // ============================================================
+ // __config__ (13 字段, 跟 componentMap 0 误差)
+ // ============================================================
+ Map config = new LinkedHashMap<>();
+ config.put("formId", "formItem" + System.currentTimeMillis());
+ config.put("jnpfKey", "relationQuery");
+ config.put("label", ctx.label);
+ config.put("tipLabel", ""); // componentMap = ""
+ config.put("labelWidth", null); // componentMap = undefined → null
+ config.put("showLabel", false); // componentMap = false (其他控件都是 true)
+ config.put("tag", "JnpfRelationQuery"); // componentMap = "JnpfRelationQuery"
+ config.put("tagIcon", "icon-ym icon-ym-generator-relationQuery"); // componentMap
+ config.put("className", new ArrayList<>()); // componentMap = []
+ config.put("defaultValue", null); // componentMap = null (其他控件都是 "")
+ config.put("required", ctx.required);
+ config.put("layout", "colFormItem"); // componentMap = "colFormItem"
+ config.put("span", 24);
+ config.put("dragDisabled", false); // componentMap = false
+ config.put("visibility", new ArrayList<>(Arrays.asList("pc"))); // componentMap = ["pc"] (仅 PC, 不支持 app)
+ config.put("noShow", false); // componentMap = false
+ field.put("__config__", config);
+
+ // ============================================================
+ // 顶层 (11 字段, 跟 componentMap 0 误差)
+ // ============================================================
+ field.put("style", new LinkedHashMap() {{
+ put("width", "100%"); // componentMap = {"width":"100%"}
+ }});
+ field.put("title", "关联查询"); // componentMap = "关联查询"
+ field.put("showTitle", true); // componentMap = true
+ field.put("modelId", modelId); // 关联功能 ID (componentMap = "", 有 ctx 时填)
+ field.put("columnOptions", columnOptionsRaw); // 显示列 (componentMap = [], CLAUDE.md §6 ≤5 列)
+ field.put("defaultEmpty", true); // componentMap = true
+ field.put("sortRule", sortRuleRaw); // 排序规则 (componentMap = [])
+ field.put("queryRule", queryRuleRaw); // 查询规则 (componentMap = {conditionList:[], matchLogic:"and"})
+ field.put("hasPage", false); // componentMap = false
+ field.put("pageSize", 20); // componentMap = 20
+ field.put("__vModel__", ctx.field);
+ field.put("id", ctx.field);
+
+ return mapper.writeValueAsString(field);
+ } catch (Exception e) {
+ throw new RuntimeException("RelationQueryFieldBuilder.buildFormField failed: " + e.getMessage(), e);
+ }
+ }
+}
diff --git a/ssw-dacli/src/main/resources/META-INF/services/ssw.dacli.form.builder.FieldBuilder b/ssw-dacli/src/main/resources/META-INF/services/ssw.dacli.form.builder.FieldBuilder
index f9dbea6..9ca9fa3 100644
--- a/ssw-dacli/src/main/resources/META-INF/services/ssw.dacli.form.builder.FieldBuilder
+++ b/ssw-dacli/src/main/resources/META-INF/services/ssw.dacli.form.builder.FieldBuilder
@@ -7,3 +7,7 @@ ssw.dacli.form.builder.field.UploadFileFieldBuilder
ssw.dacli.form.builder.field.UploadImgFieldBuilder
ssw.dacli.form.builder.field.RelationFormFieldBuilder
ssw.dacli.form.builder.field.PopupTableFieldBuilder
+ssw.dacli.form.builder.field.PopupSelectFieldBuilder
+ssw.dacli.form.builder.field.PopupAttrFieldBuilder
+ssw.dacli.form.builder.field.RelationFormAttrFieldBuilder
+ssw.dacli.form.builder.field.RelationQueryFieldBuilder
diff --git a/ssw-dacli/src/test/java/ssw/dacli/form/builder/field/PopupAttrFieldBuilderTest.java b/ssw-dacli/src/test/java/ssw/dacli/form/builder/field/PopupAttrFieldBuilderTest.java
new file mode 100644
index 0000000..cf4a142
--- /dev/null
+++ b/ssw-dacli/src/test/java/ssw/dacli/form/builder/field/PopupAttrFieldBuilderTest.java
@@ -0,0 +1,146 @@
+package ssw.dacli.form.builder.field;
+
+import ssw.dacli.form.builder.FieldBuildContext;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
+import java.nio.file.*;
+import java.util.*;
+
+/**
+ * v13 Task 1.10 — PopupAttrFieldBuilder 单元测试 (4 用例).
+ *
+ * 校验关键结构 (jnpfKey/tag/showField/relationField/isStorage=0) 与 componentMap 0 误差.
+ * baseline 0 sample, 字段对齐权威源: JNPF 前端 componentMap.ts (line 1477-1501, popupAttr 控件).
+ */
+public class PopupAttrFieldBuilderTest {
+
+ private static final ObjectMapper M = new ObjectMapper();
+
+ @Test
+ public void testPopupAttr_basic() throws Exception {
+ FieldBuildContext ctx = new FieldBuildContext();
+ ctx.field = "f_popup_attr";
+ ctx.label = "弹窗选择属性";
+ ctx.required = false;
+
+ String json = new PopupAttrFieldBuilder().buildFormField(ctx);
+ var parsed = M.readTree(json);
+
+ // 顶层关键键
+ assertNotNull(parsed.get("__config__"));
+ assertNotNull(parsed.get("__vModel__"));
+ assertEquals("f_popup_attr", parsed.get("__vModel__").asText());
+
+ // __config__ 关键键 (跟 componentMap 0 误差)
+ var cfg = parsed.get("__config__");
+ assertEquals("popupAttr", cfg.get("jnpfKey").asText());
+ assertEquals("JnpfPopupAttr", cfg.get("tag").asText());
+ assertEquals("弹窗选择属性", cfg.get("label").asText());
+ assertEquals("colFormItem", cfg.get("layout").asText());
+ assertEquals("icon-ym icon-ym-generator-popup-attr", cfg.get("tagIcon").asText());
+ assertEquals("left", cfg.get("tableAlign").asText());
+ assertEquals("none", cfg.get("tableFixed").asText());
+ // visibility = ["pc","app"]
+ var vis = cfg.get("visibility");
+ assertTrue(vis.isArray());
+ assertEquals("pc", vis.get(0).asText());
+ assertEquals("app", vis.get(1).asText());
+
+ // popupAttr 特有 (componentMap 默认值)
+ assertEquals("", parsed.get("showField").asText());
+ assertEquals("", parsed.get("relationField").asText());
+ assertEquals(0, parsed.get("isStorage").asInt());
+ }
+
+ @Test
+ public void testPopupAttr_withExtra() throws Exception {
+ // 测试 ctx.extra 字段透传 (showField/relationField/isStorage)
+ FieldBuildContext ctx = new FieldBuildContext();
+ ctx.field = "f_popup_attr";
+ ctx.label = "弹窗选择属性";
+ ctx.required = true;
+ Map extra = new LinkedHashMap<>();
+ extra.put("showField", "f_name");
+ extra.put("relationField", "f_id");
+ extra.put("isStorage", 1);
+ ctx.extra = extra;
+
+ String json = new PopupAttrFieldBuilder().buildFormField(ctx);
+ var parsed = M.readTree(json);
+
+ // 透传字段
+ assertEquals("f_name", parsed.get("showField").asText());
+ assertEquals("f_id", parsed.get("relationField").asText());
+ assertEquals(1, parsed.get("isStorage").asInt());
+ // required 透传
+ assertTrue(parsed.get("__config__").get("required").asBoolean());
+ }
+
+ @Test
+ public void testPopupAttr_baselineKeyStructure() throws Exception {
+ // 跟 componentMap popupAttr 控件 formData 关键结构对齐检查
+ FieldBuildContext ctx = new FieldBuildContext();
+ ctx.field = "f_popup_attr";
+ ctx.label = "弹窗选择属性";
+
+ String json = new PopupAttrFieldBuilder().buildFormField(ctx);
+ var parsed = M.readTree(json);
+ var cfg = parsed.get("__config__");
+
+ // __config__ 必有 (18 字段, popupAttr 缺 trigger/regList/transferList/useCache)
+ assertNotNull(cfg.get("formId"));
+ assertNotNull(cfg.get("jnpfKey"));
+ assertNotNull(cfg.get("label"));
+ assertNotNull(cfg.get("tipLabel"));
+ assertNotNull(cfg.get("showLabel"));
+ assertNotNull(cfg.get("tag"));
+ assertNotNull(cfg.get("tagIcon"));
+ assertNotNull(cfg.get("tableAlign"));
+ assertNotNull(cfg.get("tableFixed"));
+ assertNotNull(cfg.get("className"));
+ assertNotNull(cfg.get("defaultValue"));
+ assertNotNull(cfg.get("required"));
+ assertNotNull(cfg.get("layout"));
+ assertNotNull(cfg.get("span"));
+ assertNotNull(cfg.get("dragDisabled"));
+ assertNotNull(cfg.get("visibility"));
+ assertNotNull(cfg.get("noShow"));
+
+ // 顶层 baseline 必有 (4 字段 + __vModel__/id)
+ assertNotNull(parsed.get("__vModel__"));
+ assertNotNull(parsed.get("style"));
+ assertNotNull(parsed.get("showField"));
+ assertNotNull(parsed.get("relationField"));
+ assertNotNull(parsed.get("isStorage"));
+ assertNotNull(parsed.get("id"));
+
+ // 弹窗触发配置
+ assertTrue(parsed.get("style").get("width").asText().equals("100%"));
+
+ // popupAttr 顶层没有 on/placeholder/interfaceId (跟 popupSelect 区别)
+ assertNull(parsed.get("on"));
+ assertNull(parsed.get("placeholder"));
+ assertNull(parsed.get("interfaceId"));
+ }
+
+ @Test
+ public void testPopupAttr_dumpToFile() throws Exception {
+ // 工具方法: 把生成结果写到 scripts/PopupAttrFieldBuilder-output.json 用于 diff 对比
+ FieldBuildContext ctx = new FieldBuildContext();
+ ctx.field = "f_popup_attr";
+ ctx.label = "弹窗选择属性";
+ ctx.required = false;
+ Map extra = new LinkedHashMap<>();
+ extra.put("showField", "f_name");
+ extra.put("relationField", "f_id");
+ extra.put("isStorage", 1);
+ ctx.extra = extra;
+ String json = new PopupAttrFieldBuilder().buildFormField(ctx);
+ Path out = Paths.get("../scripts/PopupAttrFieldBuilder-output.json");
+ Files.createDirectories(out.getParent());
+ Files.writeString(out, json);
+ assertTrue(Files.exists(out));
+ assertTrue(Files.size(out) > 100);
+ }
+}
diff --git a/ssw-dacli/src/test/java/ssw/dacli/form/builder/field/PopupSelectFieldBuilderTest.java b/ssw-dacli/src/test/java/ssw/dacli/form/builder/field/PopupSelectFieldBuilderTest.java
new file mode 100644
index 0000000..542deda
--- /dev/null
+++ b/ssw-dacli/src/test/java/ssw/dacli/form/builder/field/PopupSelectFieldBuilderTest.java
@@ -0,0 +1,216 @@
+package ssw.dacli.form.builder.field;
+
+import ssw.dacli.form.builder.FieldBuildContext;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.*;
+import java.nio.file.*;
+import java.util.*;
+
+/**
+ * v13 Task 1.10 — PopupSelectFieldBuilder 单元测试 (4 用例).
+ *
+ * 校验关键结构 (jnpfKey/tag/columnOptions/interfaceId/popupType=dialog/filterable=false) 与 componentMap 0 误差.
+ * baseline 0 sample, 字段对齐权威源: JNPF 前端 componentMap.ts (line 1432-1476, popupSelect 控件).
+ *
+ *
CLAUDE.md §6 约束: columnOptions ≤ 5 列.
+ */
+public class PopupSelectFieldBuilderTest {
+
+ private static final ObjectMapper M = new ObjectMapper();
+
+ @Test
+ public void testPopupSelect_basic() throws Exception {
+ FieldBuildContext ctx = new FieldBuildContext();
+ ctx.field = "f_popup_sel";
+ ctx.label = "弹窗选择";
+ ctx.required = false;
+
+ String json = new PopupSelectFieldBuilder().buildFormField(ctx);
+ var parsed = M.readTree(json);
+
+ // 顶层关键键
+ assertNotNull(parsed.get("__config__"));
+ assertNotNull(parsed.get("__vModel__"));
+ assertEquals("f_popup_sel", parsed.get("__vModel__").asText());
+
+ // __config__ 关键键 (跟 componentMap 0 误差)
+ var cfg = parsed.get("__config__");
+ assertEquals("popupSelect", cfg.get("jnpfKey").asText());
+ assertEquals("JnpfPopupSelect", cfg.get("tag").asText());
+ assertEquals("弹窗选择", cfg.get("label").asText());
+ assertEquals("colFormItem", cfg.get("layout").asText());
+ assertEquals("icon-ym icon-ym-generator-popup", cfg.get("tagIcon").asText());
+ assertEquals("change", cfg.get("trigger").asText());
+ // popupSelect 特有
+ assertTrue(cfg.get("useCache").asBoolean());
+ assertEquals("left", cfg.get("tableAlign").asText());
+ assertEquals("none", cfg.get("tableFixed").asText());
+ // visibility = ["pc","app"]
+ var vis = cfg.get("visibility");
+ assertTrue(vis.isArray());
+ assertEquals("pc", vis.get(0).asText());
+ assertEquals("app", vis.get(1).asText());
+
+ // popupSelect 特有 (componentMap 默认值)
+ assertEquals("请选择", parsed.get("placeholder").asText());
+ assertEquals("", parsed.get("interfaceId").asText());
+ assertEquals("", parsed.get("interfaceName").asText());
+ assertFalse(parsed.get("hasPage").asBoolean());
+ assertEquals(20, parsed.get("pageSize").asInt());
+ // propsValue/relationField 默认值 (componentMap = "id" / "fullName")
+ assertEquals("id", parsed.get("propsValue").asText());
+ assertEquals("fullName", parsed.get("relationField").asText());
+ // 弹窗默认配置 (popupSelect 默认 dialog, 与 popupTableSelect 不同)
+ assertEquals("dialog", parsed.get("popupType").asText());
+ assertEquals("选择数据", parsed.get("popupTitle").asText());
+ assertEquals("800px", parsed.get("popupWidth").asText());
+ assertTrue(parsed.get("clearable").asBoolean());
+ assertFalse(parsed.get("filterable").asBoolean()); // popupSelect 默认 false (与 popupTableSelect 默认 true 不同)
+ assertFalse(parsed.get("disabled").asBoolean());
+ assertFalse(parsed.get("multiple").asBoolean());
+ }
+
+ @Test
+ public void testPopupSelect_withExtra() throws Exception {
+ // 测试 ctx.extra 字段透传 (interfaceId/interfaceName/columnOptions 等)
+ FieldBuildContext ctx = new FieldBuildContext();
+ ctx.field = "f_popup_sel";
+ ctx.label = "弹窗选择";
+ ctx.required = true;
+ Map extra = new LinkedHashMap<>();
+ extra.put("interfaceId", "iface002");
+ extra.put("interfaceName", "部门数据接口");
+ extra.put("propsValue", "f_id");
+ extra.put("relationField", "f_name");
+ // 弹窗显示列 (CLAUDE.md §6 约束 ≤5 列)
+ List