把 5 个模块「新建/发布」页的字段与提交体逐个核对后,补齐此前缺失或形态不符的部分:
- 部门名镜像:公告/宿舍/活动三处在模块页是「字典 id + 反查名称」一起提交。
新增 mirrorLabelOf 机制 —— 该字段不渲染控件、不进模型 schema,提交时按源字段
选中项的显示名填充(deptName)
- 公告审批流:新增 flow 控件(widget=flow)+ 教师组织树字典 notice.teaTree,
提交 flow:[{name,vote,approverTeaIds}];publishType 值域修正为 direct/approve;
存草稿改用模块自己的独立接口 notice.saveDraft(POST /api/notice/SaveDraft)
- 活动分类:category 提交的是**分类名称**(模块页 :value="String(c.v)"),
optionsKeys 由 ("k","v") 改为 ("v","v")
- 请假附件:fileIds 在 HomeLeave 是 number[](JSON 数组),去掉逗号串拼接;
连续请假按 continuousLeaveNum 逐天展开成 continuousLeaveTime[](服务端/浏览器同源)
- 作业发布(整块新增):homework.publish / schedule / published / drafts /
teachingSubjects / classTree。模块没有一步发布的接口,用 ToolDef.then 声明两步提交
(Create 落草稿 → Publish | Schedule);附件是对象数组
attachments:[{fileId,fileUrl,fileType,fileName,sort}],上传走 file 域
/coursehomework/api/file/Upload
- 执行器:新增 followUp 两步提交(浏览器侧同源)、数组参数给标量时包成单元素数组、
首步响应 data 取资源 id(对象形态取 .id,避免拼出 /homeworks/{"id":1}/publish)
- 新增 ModuleFormParityTest(13 项)逐条锁住上述契约
回归:mvn clean package → Tests run: 103, Failures: 0, Errors: 0, BUILD SUCCESS
真机:headless Chrome 走「表单 → 浏览器代执行 → 模块接口」,50 项断言全绿
This commit is contained in:
@@ -108,6 +108,18 @@ public class ToolParam {
|
||||
*/
|
||||
private Integer scopeType;
|
||||
|
||||
/** 「镜像字段」指向的源字段名(隐藏字段,提交时填入源字段选中项的显示名,如 deptId → deptName) */
|
||||
private String mirrorLabelOf;
|
||||
|
||||
/** 「连续请假」展开说明:{@code {count,start,end}} 三个字段名(见 {@link #expandDaily}) */
|
||||
private Map<String, String> dailyExpandSpec;
|
||||
|
||||
/** {@code widget=file} 时提交附件对象数组而非 fileId 数组(作业模块 attachments) */
|
||||
private boolean fileObject;
|
||||
|
||||
/** 附件上传地址覆盖(缺省由编排层按 {@code /<模块>/api/base/FileUpload} 兜底) */
|
||||
private String uploadPathOverride;
|
||||
|
||||
/** 是否在表单里隐藏(如由系统固定填入的参数,用户无需看见) */
|
||||
private boolean hidden;
|
||||
|
||||
@@ -265,6 +277,58 @@ public class ToolParam {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 声明为「审批流」控件(校园公告的 {@code flow})。
|
||||
*
|
||||
* <p>表单会渲染成:是否走审批 + 多步(每步可选或签/会签)+ 每步多选审批人
|
||||
* (候选人来自 {@link #optionsFrom} 指向的教师树工具);提交时前端拼成
|
||||
* {@code [{name:"第1步",vote:"any"|"all",approverTeaIds:[...]}]}。
|
||||
*/
|
||||
public ToolParam flow() {
|
||||
this.widget = "flow";
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 声明本字段为**隐藏的镜像字段**:用户不填,提交时自动带上源字段选中项的显示名。
|
||||
*
|
||||
* <p>用于 {@code deptName} 这类「模块页会随包提交、但界面上没有对应输入框」的字段:
|
||||
* 三个模块页都是「选部门 → 用字典把 id 反查成名称 → 一起提交」。
|
||||
*/
|
||||
public ToolParam mirrorLabelOf(String sourceField) {
|
||||
this.mirrorLabelOf = sourceField;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 连续请假展开:本字段取 1 时,前端按 {@code countField} 的天数把
|
||||
* {@code startField}/{@code endField} 复制成逐天时间段,生成 {@code continuousLeaveTime}。
|
||||
*
|
||||
* @param countField 连续天数字段名(如 continuousLeaveNum)
|
||||
* @param startField 基准开始时间字段名(如 startDate)
|
||||
* @param endField 基准结束时间字段名(如 endDate)
|
||||
*/
|
||||
public ToolParam expandDaily(String countField, String startField, String endField) {
|
||||
this.dailyExpandSpec = new LinkedHashMap<>();
|
||||
this.dailyExpandSpec.put("count", countField);
|
||||
this.dailyExpandSpec.put("start", startField);
|
||||
this.dailyExpandSpec.put("end", endField);
|
||||
return this;
|
||||
}
|
||||
|
||||
/** 附件控件提交**对象数组**(作业模块 {@code attachments:[{fileId,fileUrl,fileType,fileName,sort}]}) */
|
||||
public ToolParam asAttachments() {
|
||||
this.widget = "file";
|
||||
this.fileObject = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** 覆盖附件上传地址(缺省由编排层按 {@code /<模块>/api/base/FileUpload} 兜底) */
|
||||
public ToolParam upload(String path) {
|
||||
this.uploadPathOverride = path;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** 表单里显示的名字 */
|
||||
public String labelOf() {
|
||||
return StringUtils.isNotBlank(label) ? label : name;
|
||||
@@ -355,6 +419,9 @@ public class ToolParam {
|
||||
f.setAllToken(allToken);
|
||||
f.setAllTokenLabel(allTokenLabel);
|
||||
f.setScopeType(scopeType);
|
||||
f.setMirrorOf(mirrorLabelOf);
|
||||
f.setDailyExpand(dailyExpandSpec);
|
||||
f.setFileAsObject(fileObject);
|
||||
// 选项是内置兜底(不是学校实时字典)时如实告知,前端可提示用户
|
||||
f.setOptionsFallback(isUsingFallbackOptions());
|
||||
return f;
|
||||
|
||||
Reference in New Issue
Block a user