目前平台还只支持formdesigner设计的表单,不支持jeecgboot自带的online表单功能,接下来需要实现这个功能。
1、建一个表flow_deploy_online 作为流程关联online表单,如下
-- ---------------------------- -- Table structure for flow_deploy_online -- ---------------------------- DROP TABLE IF EXISTS `flow_deploy_online`; CREATE TABLE `flow_deploy_online` ( `id` varchar(36) NOT NULL COMMENT '主键', `online_id` varchar(50) DEFAULT NULL COMMENT 'online表单主键', `deploy_id` varchar(50) DEFAULT NULL COMMENT '流程实例主键', `node_key` varchar(50) DEFAULT NULL COMMENT '节点key', `node_name` varchar(255) DEFAULT NULL COMMENT '节点名称', `form_flag` varchar(1) DEFAULT NULL, `create_by` varchar(50) DEFAULT NULL COMMENT '创建人', `create_time` datetime DEFAULT NULL COMMENT '创建时间', `update_by` varchar(50) DEFAULT NULL COMMENT '更新人', `update_time` datetime DEFAULT NULL COMMENT '更新时间', `sys_org_code` varchar(64) DEFAULT NULL COMMENT '所属部门', PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='流程实例关联online表单';
2、上面的表生成代码,主要增加下面一个接口
/** * @Description: flow_deploy_online * @Author: nbacheng * @Date: 2022-10-21 * @Version: V1.0 */ public interface IFlowDeployOnlineService extends IService<FlowDeployOnline> { /** * 查询流程挂着的online表单 * @param deployId * @return */ FlowDeployOnline selectFlowDeployOnlineByDeployId(String deployId); }
3、FlowDeployOnlineMapper.xml实现
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.nbcio.modules.flowable.mapper.FlowDeployOnlineMapper"> <select id="selectFlowDeployOnlineByDeployId" resultType="com.nbcio.modules.flowable.entity.FlowDeployOnline"> select t2.online_id as id, t1.table_name as table_name from onl_cgform_head t1 left join flow_deploy_online t2 on t1.id= t2.online_id where deploy_id = #{deployId} limit 1 <!-- oracle 用and rownum = 1 mysql用limit 1--> </select> </mapper>
4、在流程定义接口flowDefinitionService.list(pageNum, pageSize,flowProcDefDto)增加下面内容
FlowDeployOnline flowDeployOnline = iFlowDeployOnlineService.selectFlowDeployOnlineByDeployId(reProcDef.getDeploymentId()); if (Objects.nonNull(flowDeployOnline)) { reProcDef.setFormName(flowDeployOnline.getTableName()); reProcDef.setFormId(flowDeployOnline.getId()); }
5、在前端对online类型流程配置表单如下:
/** 挂载Online表单 */ submitOnlineForm(row) { this.formDeployParam.onlineId = row.id; this.formDeployParam.tableName = row.tableName; this.formDeployParam.formFlag = '1';//人工设置表单都给予开始表单标志 addDeployOnline(this.formDeployParam).then(res => { this.$message.success(res.message); this.formOnlineOpen = false; this.getList(); }) },
效果图如下: