QA 巡检修复:YEAR/MONTH ComboBox 内建生成选项(27 字段空下拉)

全量 schema 静态扫描(qa_schema_scan)发现「空选项控件」一类:32 个 select 无 source/options。
其中 27 个是 YEAR/MONTH 整数列 ComboBox(itemisenumerate=true 但无枚举字典、无 comboboxid)——
老引擎对这类年/月下拉是约定式内建选项,转换器此前漏生成 → 空下拉。

修:UiTypeMapper 在 ComboBox 字典解析全空时,按列名后缀生成静态选项:
*MONTH → 1..12(值 Integer,标签「N月」,永久稳定);*YEAR → 2010–2035(近年在前)。
新增测「comboBox年月列内建生成选项」。重扫后空 select 32→5(余 5 个 itemisenumerate=false
的 PROOFRESULT/DAYOFWEEK 等老系统本就无源,诚实降级)。

验证:converter 59 测过;重转+重导入 sys_page_schema(更新 445);服务层 0f00e2e5 的 YEAR
下拉返 26 项、MONTH 返 12 项。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-13 19:28:57 +08:00
parent ea0b68d2e2
commit 012ab211a1
3 changed files with 76 additions and 11 deletions

View File

@@ -122,8 +122,17 @@ final class UiTypeMapper {
result.note(origin + "@field " + name + " uitype=ComboBox(dict=" + dict
+ ") → select + source 字典接口 /api/poc/dict");
} else {
result.degrade(origin + "@field " + name
+ " uitype=ComboBox(无 comboboxid 且非枚举/列元数据缺失) → 空 select(选项源无法解析)");
// 年/月查询下拉:老引擎对 YEAR/MONTH 整数列(itemisenumerate 但无枚举字典)按约定
// 内建年/月选项。转换器据列名语义生成静态选项(月 1-12 永久稳定;年取覆盖系统生命期的范围)。
List<Map<String, Object>> ymOpts = yearMonthOptions(name);
if (ymOpts != null) {
item.put("options", ymOpts);
result.note(origin + "@field " + name
+ " uitype=ComboBox(年/月语义,无字典源) → 内建生成选项(" + ymOpts.size() + "项)");
} else {
result.degrade(origin + "@field " + name
+ " uitype=ComboBox(无 comboboxid 且非枚举/列元数据缺失) → 空 select(选项源无法解析)");
}
}
}
case "PopupDateField" -> {
@@ -298,6 +307,39 @@ final class UiTypeMapper {
item.put("source", "/api/picker/" + dialogId + "/list?q=${term}&page=${page}&perPage=${perPage}");
}
/**
* 年/月查询下拉的内建静态选项(老引擎对 YEAR/MONTH 整数列的约定式下拉,无枚举字典)。
* 按列名后缀判定:{@code *MONTH → 1..12(值 Integer,标签「N月」)};
* {@code *YEAR → 覆盖系统生命期的年份范围(值 Integer,标签年份字符串,近年在前)}。
* 其余名称返回 null(不误生成)。月份永久稳定;年份范围保守取 2010–2035,超期重批即可。
*/
private static List<Map<String, Object>> yearMonthOptions(String name) {
if (name == null) {
return null;
}
String upper = name.toUpperCase();
List<Map<String, Object>> opts = new ArrayList<>();
if (upper.endsWith("MONTH")) {
for (int m = 1; m <= 12; m++) {
Map<String, Object> o = new LinkedHashMap<>();
o.put("label", m + "月");
o.put("value", m);
opts.add(o);
}
return opts;
}
if (upper.endsWith("YEAR")) {
for (int y = 2035; y >= 2010; y--) {
Map<String, Object> o = new LinkedHashMap<>();
o.put("label", String.valueOf(y));
o.put("value", y);
opts.add(o);
}
return opts;
}
return null;
}
/** 解析 EditGrid 的 {@code <editgridtemplate>} CDATA,把内嵌 editgrid 字段转成 input-table 列。 */
private static List<Map<String, Object>> buildEditGridColumns(Element f, ConversionResult result, String name) {
List<Map<String, Object>> columns = new ArrayList<>();