feat(流程独立节点表单): 新增流程独立节点表单,可在用户任务节点配置表单(不兼容旧版本)

This commit is contained in:
konbai
2022-08-07 17:56:35 +08:00
parent 1ff440c235
commit b6c6813498
12 changed files with 443 additions and 86 deletions

View File

@@ -0,0 +1,65 @@
package com.ruoyi.flowable.core;
import lombok.Data;
import java.util.List;
import java.util.Map;
/**
* 表单属性类
*
* @author KonBAI
* @createTime 2022/8/6 18:54
*/
@Data
public class FormConf {
/**
* 标题
*/
private String title;
/**
* 表单名
*/
private String formRef;
/**
* 表单模型
*/
private String formModel;
/**
* 表单尺寸
*/
private String size;
/**
* 标签对齐
*/
private String labelPosition;
/**
* 标签宽度
*/
private Integer labelWidth;
/**
* 校验模型
*/
private String formRules;
/**
* 栅格间隔
*/
private Integer gutter;
/**
* 禁用表单
*/
private Boolean disabled = false;
/**
* 栅格占据的列数
*/
private Integer span;
/**
* 表单按钮
*/
private Boolean formBtns = true;
/**
* 表单项
*/
private List<Map<String, Object>> fields;
}

View File

@@ -0,0 +1,33 @@
package com.ruoyi.flowable.utils;
import cn.hutool.core.convert.Convert;
import com.ruoyi.flowable.core.FormConf;
import java.util.Map;
/**
* 流程表单工具类
*
* @author KonBAI
* @createTime 2022/8/7 17:09
*/
public class ProcessFormUtils {
/**
* 填充表单项内容
*
* @param formConf 表单配置信息
* @param data 表单内容
*/
public static void fillFormData(FormConf formConf, Map<String, Object> data) {
for (Map<String, Object> field : formConf.getFields()) {
String modelKey = Convert.toStr(field.get("__vModel__"));
Object value = data.get(modelKey);
if (value != null) {
@SuppressWarnings("unchecked")
Map<String, Object> configMap = (Map<String, Object>) field.get("__config__");
configMap.put("defaultValue", value);
}
}
}
}