Quellcode durchsuchen

表单编辑器

chenc vor 3 Jahren
Ursprung
Commit
a2ae24b8d0

+ 7 - 0
jeecg-boot/jeecg-boot-module-activiti/src/main/java/org/jeecg/modules/activiti/entity/TbTableInfo.java

@@ -9,6 +9,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
 import lombok.Data;
 import org.springframework.format.annotation.DateTimeFormat;
 import java.util.Date;
+import java.util.List;
 
 @Data
 public class TbTableInfo {
@@ -50,6 +51,12 @@ public class TbTableInfo {
     private String delFlag;
     //是否初始表单0否1是
     private String isInitial;
+    //是否可以保存
+    @TableField(exist = false)
+    private Boolean isSave;
+    //多条数据集合
+    @TableField(exist = false)
+    private List<TbTableInfo> tbTableInfoList;
 
     public TbTableInfo() {
     }

+ 8 - 0
jeecg-boot/jeecg-boot-module-activiti/src/main/java/org/jeecg/modules/activiti/web/ActivitiProcessController.java

@@ -23,6 +23,8 @@ import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.modules.activiti.entity.ActNode;
 import org.jeecg.modules.activiti.entity.ActZprocess;
 import org.jeecg.modules.activiti.entity.ProcessNodeVo;
+import org.jeecg.modules.activiti.entity.TbTableInfo;
+import org.jeecg.modules.activiti.service.ITbTableInfoService;
 import org.jeecg.modules.activiti.service.Impl.ActBusinessServiceImpl;
 import org.jeecg.modules.activiti.service.Impl.ActNodeServiceImpl;
 import org.jeecg.modules.activiti.service.Impl.ActZprocessServiceImpl;
@@ -56,6 +58,8 @@ public class ActivitiProcessController {
     private ActNodeServiceImpl actNodeService;
     @Autowired
     private ActBusinessServiceImpl actBusinessService;
+    @Autowired
+    private ITbTableInfoService tbTableInfoService;
 
     @RequestMapping("/listData")
     public Result listData( HttpServletRequest request){
@@ -333,6 +337,10 @@ public class ActivitiProcessController {
             actNode.setType(3);
             actNodeService.save(actNode);
         }
+        TbTableInfo tbTableInfo=new TbTableInfo();
+        tbTableInfo.setId(tbTableInfoId);
+        tbTableInfo.setTaskNodeId(nodeId);
+        tbTableInfoService.updateTbTableInfo(tbTableInfo);
         return Result.ok("操作成功");
     }
     @RequestMapping(value = "/getNextNode", method = RequestMethod.GET)

+ 29 - 3
jeecg-boot/jeecg-boot-module-activiti/src/main/java/org/jeecg/modules/activiti/web/TbTableInfoController.java

@@ -7,8 +7,10 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.modules.activiti.entity.ActNode;
 import org.jeecg.modules.activiti.entity.TbTableInfo;
 import org.jeecg.modules.activiti.service.ITbTableInfoService;
+import org.jeecg.modules.activiti.service.Impl.ActNodeServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
@@ -24,6 +26,8 @@ import java.util.Map;
 public class TbTableInfoController {
    @Autowired
    private ITbTableInfoService tbTableInfoService;
+    @Autowired
+    private ActNodeServiceImpl actNodeService;
 
    @ResponseBody
     @RequestMapping("/list")
@@ -89,15 +93,37 @@ public class TbTableInfoController {
      * @desc 条件查询
      */
     @RequestMapping("/query")
-    public Result<Object> query(String businessTable){
-           QueryWrapper<TbTableInfo> queryWrapper = new QueryWrapper<TbTableInfo>().eq("business_table", businessTable);
-
+    public Result<Object> query(String businessTable,String taskNodeId){
+            boolean isSave=false;
+            QueryWrapper<TbTableInfo> queryWrapper = new QueryWrapper<TbTableInfo>().eq("business_table", businessTable);
+            //查询任务节点是否关联表
+            List<ActNode> actNodeList=  actNodeService.list(new QueryWrapper<ActNode>().eq("node_id",taskNodeId));
+            if(actNodeList!=null&&actNodeList.size()>0&&StringUtils.isNotBlank(actNodeList.get(0).getTbTableInfoId())){
+                //如果任务节点id不为空则根据任务节点id查询
+                queryWrapper.eq("task_node_id",taskNodeId);
+                isSave=true;//分流程节点填写不同内容的表单 强制给到前台解除保存按钮禁用状态
+            }else{//没有关联表则不把流程节点id当作查询条件
+                queryWrapper.and(qw->qw.eq("is_initial","1").or().isNull("is_initial"));
+            }
            TbTableInfo tableInfo = tbTableInfoService.getOne(queryWrapper);
            if(tableInfo==null) {
              return Result.error("未找到实体");
             }
             Object obj = JSONObject.parseObject(tableInfo.getContent());
             tableInfo.setJsonContent(obj);
+            if(isSave){
+                tableInfo.setIsSave(isSave);
+            }
+            //获取当前表名称所有的表单数据
+            QueryWrapper<TbTableInfo> queryWrapper2 = new QueryWrapper<TbTableInfo>().eq("business_table", businessTable).eq("del_flag","0").orderByAsc("create_time");
+            List<TbTableInfo> tbTableInfoList=tbTableInfoService.list(queryWrapper2);
+            if(tbTableInfoList!=null){
+                for(TbTableInfo t:tbTableInfoList){
+                    Object obj2 = JSONObject.parseObject(t.getContent());
+                    t.setJsonContent(obj2);
+                }
+            }
+            tableInfo.setTbTableInfoList(tbTableInfoList);
         return Result.ok(tableInfo);
     }