fix(platform): resolve picker load defaults
Some checks failed
ci / build-test-parity (push) Has been cancelled
Some checks failed
ci / build-test-parity (push) Has been cancelled
This commit is contained in:
@@ -877,12 +877,13 @@ public class TemplateToAmisConverter {
|
||||
if (loadService != null && !loadService.isBlank() && primaryKey != null && !primaryKey.isBlank()) {
|
||||
Map<String, Object> api = new LinkedHashMap<>();
|
||||
api.put("method", "post");
|
||||
api.put("url", "/api/flow/" + loadService);
|
||||
api.put("url", "/api/flow/" + loadService + editTemplateQuery(templateId));
|
||||
api.put("data", new LinkedHashMap<>(Map.of(primaryKey, "${" + primaryKey + "}")));
|
||||
api.put("responseData", new LinkedHashMap<>(Map.of("&", "${result}")));
|
||||
service.put("api", api);
|
||||
result.note("dialog[" + title + "] 接 load 服务 " + loadService
|
||||
+ " → service.api POST 按 " + primaryKey + " 加载本体数据(result 拍平,readOnly 保留 static 只读)");
|
||||
+ " → service.api POST 按 " + primaryKey
|
||||
+ " 加载本体数据(result 拍平,readOnly 保留 static 只读,透传编辑模板解析 picker 默认值)");
|
||||
} else if ((primaryKey == null || primaryKey.isBlank())
|
||||
&& tableName != null && !tableName.isBlank()) {
|
||||
// B:新建(添加)dialog——无选中行/无 load 服务。接默认值端点服务端解析 initvalue 宏
|
||||
@@ -930,9 +931,7 @@ public class TemplateToAmisConverter {
|
||||
submitBtn.put("actionType", "submit"); // 下钻内层 form,采集字段值
|
||||
// A1 compute-on-save:带 ?__egtpl=<editFormTemplateId> 透传给 FlowController,落库前补算
|
||||
// editgrid 派生字段(金额/总额)。无 editgrid 的表单后端自然无操作。
|
||||
String egTpl = (templateId != null && !templateId.isBlank() && !templateId.startsWith("MISSING_"))
|
||||
? "?__egtpl=" + templateId : "";
|
||||
submitBtn.put("api", "POST:/api/flow/" + svc + egTpl);
|
||||
submitBtn.put("api", "POST:/api/flow/" + svc + editTemplateQuery(templateId));
|
||||
submitBtn.put("close", true); // 成功后关闭 dialog
|
||||
dlgActions.add(submitBtn);
|
||||
result.note("dialog[" + title + "] method " + mname
|
||||
@@ -952,6 +951,11 @@ public class TemplateToAmisConverter {
|
||||
return dlg;
|
||||
}
|
||||
|
||||
private static String editTemplateQuery(String templateId) {
|
||||
return templateId != null && !templateId.isBlank() && !templateId.startsWith("MISSING_")
|
||||
? "?__egtpl=" + templateId : "";
|
||||
}
|
||||
|
||||
/** 兼容旧调用:read 按钮无 methods,使用默认确认/取消。 */
|
||||
private Map<String, Object> buildFormDialog(String title, String templateId,
|
||||
String primaryKey, boolean readOnly,
|
||||
|
||||
Reference in New Issue
Block a user