Explorar el Código

增加SWConsts.debug,是否调试模式,调试模式缓存从数据库加载

4.0
郑根木 hace 2 años
padre
commit
01e12107aa
Se han modificado 19 ficheros con 1686 adiciones y 338 borrados
  1. +30
    -87
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/util/CodeGenerator.java
  2. +19
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/define/ProcInfo.java
  3. +1
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormHelper.java
  4. +0
    -23
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/AbstractFlowHandler.java
  5. +0
    -19
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowHandler.java
  6. +32
    -4
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowHelper.java
  7. +792
    -58
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowInstance.java
  8. +63
    -7
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowProvider.java
  9. +0
    -108
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowService.java
  10. +3
    -3
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Candidate.java
  11. +3
    -3
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Care.java
  12. +3
    -3
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Comment.java
  13. +3
    -3
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/ProcInst.java
  14. +3
    -3
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Sign.java
  15. +3
    -3
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Task.java
  16. +3
    -3
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/TaskRel.java
  17. +2
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleService.java
  18. +18
    -0
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/EntityDao.java
  19. +708
    -10
      smtweb-framework/core/src/main/resources/demo.json

+ 30
- 87
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/util/CodeGenerator.java Ver fichero

@@ -17,18 +17,19 @@ import java.util.List;
import java.util.Map;

/**
* Created by Akmm at 2022/6/8 15:36
* 模板生成代码
* Created by Akmm at 2022/6/8 15:36
* 模板生成代码
*/
public class CodeGenerator {
private final static String KEY_MODEL = "model";
private final static String TEMPLATE_JAVA_BEAN = "../java_bean";
private final static String TEMPLATE_JAVA_CACHE = "../java_cache";
private final static String TEMPLATE_JAVA_SERVICE = "../java_service";
private final static String TEMPLATE_JS_EVENT = "../js_event";
private final static String TEMPLATE_JAVA_BEAN = "java_bean";
private final static String TEMPLATE_JAVA_CACHE = "java_cache";
private final static String TEMPLATE_JAVA_SERVICE = "java_service";
private final static String TEMPLATE_JS_EVENT = "js_event";
private static CodeGenerator instance = null;

private Configuration configuration = null;
private Configuration modelConfiguration = null;
private Configuration codeConfiguration = null;

private final String encode = org.apache.commons.codec.CharEncoding.UTF_8;
//模板文件所在目录
@@ -40,32 +41,33 @@ public class CodeGenerator {
protected CodeGenerator() {
// templatesDir = this.getClass().getResource("/static/template").getPath();
mapTemplate = YamlUtil.readValue(this.getClass().getResourceAsStream("/static/template/" + SwConsts.modelPath + "/index.yaml"), SwMap.class);
configuration = new Configuration(Configuration.VERSION_2_3_31);
try {
configuration.setClassForTemplateLoading(this.getClass(), "/static/template/" + SwConsts.modelPath);
modelConfiguration = buildConfig("/static/template/" + SwConsts.modelPath);
codeConfiguration = buildConfig("/static/template/");
}

private Configuration buildConfig(String path) {
Configuration config = new Configuration(Configuration.VERSION_2_3_31);
config.setClassForTemplateLoading(this.getClass(), path);
// configuration.setDirectoryForTemplateLoading(new File(templatesDir));
configuration.setClassicCompatible(true);
configuration.setDefaultEncoding(encode);
configuration.setOutputEncoding(encode);
} catch (Exception e) {
e.printStackTrace();
throw new SwException(e);
}
config.setClassicCompatible(true);
config.setDefaultEncoding(encode);
config.setOutputEncoding(encode);
return config;
}

//页面设计的模板信息
public List<Map<String, Object>> getModelTemplates() {
return (List<Map<String, Object>>)mapTemplate.get(KEY_MODEL);
return (List<Map<String, Object>>) mapTemplate.get(KEY_MODEL);
}

private void initModel(Map<String, Object> model) {
model.put("newId", new PKGenerator());
}

public void generate(Map<String, Object> model, String templateName, Writer writer) {
public void generate(Configuration config, Map<String, Object> model, String templateName, Writer writer) {
try {
initModel(model);
Template template = configuration.getTemplate(templateName, encode);
Template template = config.getTemplate(templateName, encode);
template.setOutputEncoding(encode);
template.process(model, writer);
writer.close();
@@ -76,7 +78,7 @@ public class CodeGenerator {
}


public void generate(Map<String, Object> model, String templateName, String fileName) {
public void generate(Configuration config, Map<String, Object> model, String templateName, String fileName) {
File file = new File(fileName);
if (file.exists()) file.delete();
FileOutputStream out = null;
@@ -85,7 +87,7 @@ public class CodeGenerator {
out = new FileOutputStream(fileName);

initModel(model);
Template template = configuration.getTemplate(templateName + ".ftl", StandardCharsets.UTF_8.toString());
Template template = config.getTemplate(templateName + ".ftl", StandardCharsets.UTF_8.toString());
template.setOutputEncoding(encode);
template.process(model, new OutputStreamWriter(out, encode));
out.flush();
@@ -96,26 +98,26 @@ public class CodeGenerator {
}
}

public String generate(Map<String, Object> model, String templateName) {
public String generatePage(Map<String, Object> model, String templateName) {
StringWriter out = new StringWriter();
generate(model, templateName + ".ftl", out);
generate(modelConfiguration, model, templateName + ".ftl", out);
return out.getBuffer().toString();
}

public void generateBean(Map<String, Object> model, String fileName) {
generate(model, TEMPLATE_JAVA_BEAN, fileName);
generate(codeConfiguration, model, TEMPLATE_JAVA_BEAN, fileName);
}

public void generateCache(Map<String, Object> model, String fileName) {
generate(model, TEMPLATE_JAVA_CACHE, fileName);
generate(codeConfiguration, model, TEMPLATE_JAVA_CACHE, fileName);
}

public void generateService(Map<String, Object> model, String fileName) {
generate(model, TEMPLATE_JAVA_SERVICE, fileName);
generate(codeConfiguration, model, TEMPLATE_JAVA_SERVICE, fileName);
}

public void generateJsEvent(Map<String, Object> model, String fileName) {
generate(model, TEMPLATE_JS_EVENT, fileName);
generate(codeConfiguration, model, TEMPLATE_JS_EVENT, fileName);
}


@@ -140,63 +142,4 @@ public class CodeGenerator {
// return DbEngine.getInstance().nextId();
}
}


/*
{param:{pa:"aaa"},
layout:{
c1:[{type:"list", dataset:"ds123", fields:[{field:"", dataset:""}], cfilters:[{}]}]
}
*/
public static void main(String[] args) {
StringWriter out = new StringWriter();
SwMap map = new SwMap();
SwMap param = new SwMap();
param.put("pa", "aaaaa");
map.put("param", param);

SwMap layout = new SwMap();
map.put("layout", layout);
List<SwMap> groups = new ArrayList<>();
layout.put("c1", groups);

SwMap area = new SwMap();
groups.add(area);
area.put("type", "list");
area.put("dataset", "ds123");

List<SwMap> fields = new ArrayList<>();
area.put("fields", fields);
SwMap field = new SwMap();
field.put("field", "f123");
field.put("dataset", "ds123");
field.put("label", "字段123");
fields.add(field);

field = new SwMap();
field.put("field", "f121");
field.put("label", "字段121");
field.put("dataset", "ds123");
fields.add(field);

field = new SwMap();
field.put("field", "f122");
field.put("label", "字段122");
field.put("dataset", "ds123");
fields.add(field);

List<SwMap> filters = new ArrayList<>();
area.put("cfilters", filters);
field = new SwMap();
field.put("field", "f122");
field.put("dataset", "ds123");
field.put("label", "字段122");
field.put("maxlength", 20);
filters.add(field);

map.put("title", "thisIsATest!");
map.put("newId", new PKGenerator());
CodeGenerator.getInstance().generate(map, "model_card.ftl", out);
System.out.println(out.getBuffer().toString());
}
}

+ 19
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/flow/define/ProcInfo.java Ver fichero

@@ -1,8 +1,10 @@
package cc.smtweb.system.bpm.web.design.flow.define;

import cc.smtweb.system.bpm.web.design.flow.FlowConst;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;

/**
@@ -31,4 +33,21 @@ public class ProcInfo {
}
return null;
}

//获取任务名称
public String getActNameById(String id) {
Activity act = findActivity(id);
return act != null ? act.getLabel() : "";
}

//获取结束节点
public List<Activity> findEndActivity() {
List<Activity> list = new ArrayList<>();
for (Activity act: activities) {
if (act.getType() == FlowConst.ActivityType.END.value) {
list.add(act);
}
}
return list;
}
}

+ 1
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormHelper.java Ver fichero

@@ -462,7 +462,7 @@ public class ModelFormHelper {
}
tmplModel.put("widgetRef", widgetRef);
tmplModel.put("tmplType", tmplId);
final String model = CodeGenerator.getInstance().generate(tmplModel, tmplId);
final String model = CodeGenerator.getInstance().generatePage(tmplModel, tmplId);
form.setContent(model);
// form.setContent(buildSaveModel(form));
}


+ 0
- 23
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/AbstractFlowHandler.java Ver fichero

@@ -1,23 +0,0 @@
package cc.smtweb.system.bpm.web.engine.flow;

import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.system.bpm.web.design.form.ModelForm;
import cc.smtweb.system.bpm.web.design.form.ModelFormHelper;
import cc.smtweb.system.bpm.web.engine.dynPage.AbstractDynPageHandler;

/**
* Created by Akmm at 2022/4/21 17:53
* 保存指定数据集操作
* 入参:{pageId, data:}
*/
public class AbstractFlowHandler extends AbstractDynPageHandler {
@Override
public void init(SwMap params, UserSession us) {
super.init(params, us);
ModelForm form = ModelFormHelper.getFromCache(pageId);
if (form.getBillType() <= 0L) throw new BizException("此页面非单据页面,不能使用流程服务!");
}
}

+ 0
- 19
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowHandler.java Ver fichero

@@ -1,19 +0,0 @@
package cc.smtweb.system.bpm.web.engine.flow;

import cc.smtweb.framework.core.common.R;
import cc.smtweb.system.bpm.web.engine.dynPage.AbstractDynPageHandler;

/**
* Created by Akmm at 2022/4/21 17:53
* 保存指定数据集操作
* 入参:{pageId, data:}
*/
public class FlowHandler extends AbstractDynPageHandler {

/**
* 办理签收
*/
public R handle() {
return R.success();
}
}

+ 32
- 4
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowHelper.java Ver fichero

@@ -1,11 +1,18 @@
package cc.smtweb.system.bpm.web.engine.flow;

import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityHelper;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.system.bpm.web.design.flow.FlowConst;
import cc.smtweb.system.bpm.web.design.flow.ModelProcHelper;
import cc.smtweb.system.bpm.web.design.flow.define.Activity;
import cc.smtweb.system.bpm.web.design.flow.define.ProcInfo;
import cc.smtweb.system.bpm.web.design.flow.define.Trans;
import cc.smtweb.system.bpm.web.design.form.ModelForm;
import cc.smtweb.system.bpm.web.design.form.ModelFormHelper;
import cc.smtweb.system.bpm.web.engine.flow.entity.Candidate;
import cc.smtweb.system.bpm.web.engine.flow.entity.Task;
import cc.smtweb.system.bpm.web.engine.flow.entity.TaskRel;

import java.util.ArrayList;
import java.util.List;
@@ -15,6 +22,27 @@ import java.util.List;
* 单据
*/
public class FlowHelper {

//获取页面单据类型
public static long getBillType(String pageId) {
ModelForm form = ModelFormHelper.getFromCache(pageId);
long billType = form.getBillType();
if (billType <= 0L) throw new BizException("此页面非单据页面,不能使用流程服务!");
return billType;
}

//是否我的待办任务
public static boolean isMyWaitedTask(long task_id, long user_id) {
return DbEngine.getInstance().isExists("select 1 from " + EntityHelper.getSchemaTableName(Candidate.ENTITY_NAME) +
" where task_id=? and user_id=?", task_id, user_id);
}

public static boolean isMySubmitTask(long task_id, long user_id) {
return DbEngine.getInstance().isExists("select 1 from " + EntityHelper.getSchemaTableName(TaskRel.ENTITY_NAME) +
" r inner join " + EntityHelper.getSchemaTableName(Task.ENTITY_NAME) + " t on t.task_id = r.before_task_bid\n" +
" where r.task_id=? and t.handler=?", task_id, user_id);
}

/**
* 得到指定活动的下一任务节点
*
@@ -22,7 +50,7 @@ public class FlowHelper {
* @return
*/
public static List<Activity> getNextActivity(FlowInstance flowInstance) throws Exception {
Activity act = ModelProcHelper.getNextActivity(flowInstance.act_inst.getPrcId(), flowInstance.act_inst.getActId());
Activity act = ModelProcHelper.getNextActivity(flowInstance.getActInst().getPrcId(), flowInstance.getActInst().getActId());
if (act == null) {
throw new BizException("未找到可用的活动节点定义!");
}
@@ -45,9 +73,9 @@ public class FlowHelper {
private static void buildNextActivityRes(Activity act, FlowInstance flowInstance, List<Activity> listRet) throws Exception {
//待返回的结果集
// if (act.getActType() == FlowConst.ActivityType.scriptTask) 自动任务暂不支持
ProcInfo proc = flowInstance.proc_def.getProcInfo();
ProcInfo proc = flowInstance.getProcDef().getProcInfo();
if (act.getType() == FlowConst.ActivityType.CONDITION.value) {//条件分支
List<Trans> list = ModelProcHelper.getNextTrans(flowInstance.proc_inst.getPrcId(), act.getId());
List<Trans> list = ModelProcHelper.getNextTrans(flowInstance.getProcInst().getPrcId(), act.getId());
for (Trans t : list) {
if (flowInstance.execTrans(t.getExpr())) {
Activity a = proc.findActivity(t.getDst());
@@ -59,7 +87,7 @@ public class FlowHelper {
}
}
} else if (act.getType() == FlowConst.ActivityType.PARALLEL.value) {//并发分支
List<Trans> list = ModelProcHelper.getNextTrans(flowInstance.proc_def.getId(), act.getId());
List<Trans> list = ModelProcHelper.getNextTrans(flowInstance.getProcDef().getId(), act.getId());
for (Trans t : list) {
if (flowInstance.execTrans(t.getExpr())) {
Activity a = proc.findActivity(t.getDst());


+ 792
- 58
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowInstance.java Ver fichero

@@ -1,53 +1,55 @@
package cc.smtweb.system.bpm.web.engine.flow;

import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityHelper;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.framework.core.exception.SwException;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.framework.core.util.CommUtil;
import cc.smtweb.framework.core.util.DateUtil;
import cc.smtweb.framework.core.util.NumberUtil;
import cc.smtweb.system.bpm.web.design.flow.FlowConst;
import cc.smtweb.system.bpm.web.design.flow.ModelProc;
import cc.smtweb.system.bpm.web.design.flow.ModelProcHelper;
import cc.smtweb.system.bpm.web.design.flow.define.Activity;
import cc.smtweb.system.bpm.web.engine.flow.define.ProcinstEntity;
import cc.smtweb.system.bpm.web.engine.flow.define.TaskEntity;
import cc.smtweb.system.bpm.web.sys.base.dict.DictCache;
import cc.smtweb.system.bpm.web.engine.flow.entity.*;
import cc.smtweb.system.bpm.web.sys.user.dept.Dept;
import cc.smtweb.system.bpm.web.sys.user.dept.DeptCache;
import cc.smtweb.system.bpm.web.sys.user.party.Party;
import cc.smtweb.system.bpm.web.sys.user.party.PartyCache;
import cc.smtweb.system.bpm.web.sys.user.user.UserCache;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;

/**
* Created by Akmm at 2020/3/4 11:35
* 单据流程实例组件
*/
@Data
public class FlowInstance {
//会话信息
private UserSession us;
//流程定义
public ModelProc proc_def;

private ModelProc procDef;
//流程实例
public ProcinstEntity proc_inst;
private ProcInst procInst;

//活动任务
public TaskEntity act_inst;
private Task actInst;

//操作类型 新增/编辑/查看
public int opt_mode = FlowConst.OperatorType.VIEW;
private int opt_mode = FlowConst.OperatorType.VIEW;

//流程执行变量
// public Map<String, String> variables = new HashMap<>();

//当前任务
public List<Map<String, String>> tasks = new ArrayList<>();
private List<Map<String, String>> tasks = new ArrayList<>();
//数据提供者
private FlowProvider provider = new FlowProvider();

public FlowInstance(UserSession us) {
this.us = us;
@@ -56,11 +58,12 @@ public class FlowInstance {
//能否编辑
public boolean canEdit() {
//新增状态可以编辑
if (opt_mode == FlowConst.OperatorType.NEW || proc_inst.getStatu() == FlowConst.InstanceStatu.BEGIN.value)
if (opt_mode == FlowConst.OperatorType.NEW || procInst.getStatu() == FlowConst.InstanceStatu.BEGIN.value)
return true;
return false;
}


/**
* 流程条件
*
@@ -88,7 +91,7 @@ public class FlowInstance {
* @param bill_type
* @throws Exception
*/
public void create(int bill_type) throws Exception {
public void create(int bill_type) {
Party loginParty = PartyCache.getInstance().get(us.getPartyId());
if (EntityHelper.isEmpty(loginParty)) {
throw new BizException("当前登录人员管理单位信息为空,请检查后保存!");
@@ -99,45 +102,45 @@ public class FlowInstance {
loginDept = new Dept();
}

proc_def = ModelProcHelper.getBillProc(bill_type, us.getUserId()); //根据单据分类获取流程定义
if (EntityHelper.isEmpty(proc_def)) {
procDef = ModelProcHelper.getBillProc(bill_type, us.getUserId()); //根据单据分类获取流程定义
if (EntityHelper.isEmpty(procDef)) {
// throw new BizException("没有找到对应的流程定义,请到【系统设置】-【单据流程分配】为当前单据类型【" + BillTypeCache.getInstance().getName(bill_type) + "】分配工作流程!");
}

Activity start = ModelProcHelper.getFirstActivity(proc_def.getEntityId());
Activity start = ModelProcHelper.getFirstActivity(procDef.getEntityId());
if (start == null) {
throw new BizException("对应的流程没有定义有效的活动步骤!");
}

opt_mode = FlowConst.OperatorType.NEW;

proc_inst = new ProcinstEntity();
proc_inst.init();
proc_inst.setEntityId(DbEngine.getInstance().nextId());
proc_inst.setPartyId(loginParty.getEntityId());
proc_inst.setDeptId(loginDept.getEntityId());
proc_inst.setBillType(bill_type);
proc_inst.setMakeDate(DateUtil.nowDateTimeLong());
proc_inst.setPrcId(proc_def.getEntityId());
proc_inst.setStartTime(DateUtil.nowDateTimeLong());
proc_inst.setUserId(us.getUserId());
proc_inst.setStatu(FlowConst.InstanceStatu.BEGIN.value);
act_inst = new TaskEntity();
act_inst.init();
act_inst.setEntityId(DbEngine.getInstance().nextId());
act_inst.setId(proc_inst.getEntityId());
act_inst.setPrcId(proc_def.getEntityId());
act_inst.setActId(start.getId());
act_inst.setHandler(us.getUserId());
act_inst.setStartTime(DateUtil.nowDateTimeLong());
act_inst.setStatu(FlowConst.ActivityStatu.HANDLE.value);
act_inst.setMake(true);
act_inst.setSign(false);
act_inst.setReject(false);
act_inst.setRetake(false);
proc_inst.setTaskId(act_inst.getEntityId());
procInst = new ProcInst();
procInst.init();
procInst.setEntityId(DbEngine.getInstance().nextId());
procInst.setPartyId(loginParty.getEntityId());
procInst.setDeptId(loginDept.getEntityId());
procInst.setBillType(bill_type);
procInst.setMakeDate(DateUtil.nowDateTimeLong());
procInst.setPrcId(procDef.getEntityId());
procInst.setStartTime(DateUtil.nowDateTimeLong());
procInst.setUserId(us.getUserId());
procInst.setStatu(FlowConst.InstanceStatu.BEGIN.value);
actInst = new Task();
actInst.init();
actInst.setEntityId(DbEngine.getInstance().nextId());
actInst.setId(procInst.getEntityId());
actInst.setPrcId(procDef.getEntityId());
actInst.setActId(start.getId());
actInst.setHandler(us.getUserId());
actInst.setStartTime(DateUtil.nowDateTimeLong());
actInst.setStatu(FlowConst.ActivityStatu.HANDLE.value);
actInst.setMake(true);
actInst.setSign(false);
actInst.setReject(false);
actInst.setRetake(false);
procInst.setTaskId(actInst.getEntityId());
}

/**
@@ -149,28 +152,759 @@ public class FlowInstance {
long user_id = us.getUserId();
//校验权限,当前人员有权限干不,没权限直接抛异常
// checkPermission();
if (act_inst.getStatu() != FlowConst.ActivityStatu.WAIT.value) {
if (actInst.getStatu() != FlowConst.ActivityStatu.WAIT.value) {
throw new BizException("当前任务非待办状态,不能办理失败!");
}

act_inst.setHandler(user_id);
act_inst.setStartTime(DateUtil.nowDateTimeLong());
act_inst.setStatu(FlowConst.ActivityStatu.HANDLE.value);
actInst.setHandler(user_id);
actInst.setStartTime(DateUtil.nowDateTimeLong());
actInst.setStatu(FlowConst.ActivityStatu.HANDLE.value);

procInst.setTaskId(actInst.getEntityId());
procInst.setStatu(FlowConst.InstanceStatu.RUNING.value);

DbEngine.getInstance().findDao(Task.ENTITY_NAME).updateEntity(actInst);
DbEngine.getInstance().findDao(ProcInst.ENTITY_NAME).updateEntity(procInst);

buildBillLog(FlowConst.Button.HANDLE.value, actInst, null);
// comp.transCallback(FlowConst.FlowOptType.RETAKE.value, act_inst, null);
}

//从页面参数加载流程实例
public void readFromPage(SwMap map) {
procInst.readFromMap(map);
actInst.setPriId(procInst.getId());
actInst.setEntityId(procInst.getTaskId());
}

/**
* 从数据库加载已有流程实例
*
* @param bill_id
* @throws Exception
*/
public void load(long bill_id, long task_id) {
procInst = provider.findProcInst(bill_id);
procDef = ModelProcHelper.getFromCache(procInst.getPrcId());
task_id = getTaskId(task_id);
if (task_id > 0L) {
actInst = provider.findTask(task_id);
}
}

/**
* 当前任务处于待办时:
* 上一步办理人进来,看上一个步骤,否则看当前步骤
*
* @param task_id
* @return
*/
private long getTaskId(long task_id) {
if (task_id > 0L) return task_id;
Task curTask = provider.findTask(task_id);
if (EntityHelper.isEmpty(curTask) || curTask.getStatu() != FlowConst.ActivityStatu.WAIT.value) return task_id;
Task preAct = provider.findBeforeTask(task_id);
if (EntityHelper.isEmpty(preAct)) return task_id;
if (preAct.getHandler() == us.getUserId()) {
return preAct.getId();
}
return task_id;
}

/**
* 矫正默认任务及获取可选任务列表,供界面选择
*
* @return
* @throws Exception
*/
public List<Task> adjustTasks() {
List<Task> listTask = new ArrayList<>();
if (opt_mode == FlowConst.OperatorType.NEW || procInst.getStatu() == FlowConst.InstanceStatu.DISUSE.value) {
listTask.add(actInst);
return listTask;
}
//获取当前单据活动任务列表及当前任务
// act_inst = null;
List<Task> list = provider.findCurTask(procInst.getId());
listTask.addAll(list);
//当前登录用户
String sqlIn = "";
for (Task act : list) {
//如果办理人是当前用户,则置此任务为当前任务
// if (act_inst == null) {
//我办理中的任务:非待办,且是我的任务
if (act.getStatu() != FlowConst.ActivityStatu.WAIT.value) {
if (us.getUserId() == act.getHandler()) {
actInst = act;
}
} else if (FlowHelper.isMyWaitedTask(act.getId(), us.getUserId())) {
//我的待办任务
actInst = act;
act.setHandler(us.getUserId());
} else {
Activity ae = procDef.getProcInfo().findActivity(act.getActId());
if (ae != null && ae.getType() == FlowConst.ActivityType.END.value) {
actInst = act;
}
}
// }
//如果当前任务为待办理,那么要找其前置任务,作为活动任务,方便取回
if (act.getStatu() == FlowConst.ActivityStatu.WAIT.value) {
sqlIn += "," + act.getEntityId();
}
}
//找待办任务的前置任务,便于取回
if (StringUtils.isNotEmpty(sqlIn)) {
List<Task> list1 = provider.findBeforeTasks(sqlIn.substring(1));
listTask.addAll(list1);
if (actInst == null) {
for (Task act : list1) {
//如果办理人是当前用户,则置此任务为当前任务
if (us.getUserId() == act.getHandler()) {
actInst = act;
break;
}
}
}
}
//没有我的处理任务,用流程当前任务来
if (actInst == null) {
actInst = provider.findTask(procInst.getTaskId());
}

return listTask;
}

proc_inst.setTaskId(act_inst.getEntityId());
proc_inst.setStatu(FlowConst.InstanceStatu.RUNING.value);
/**
* 设置单据描述及链接地址,待办中展示
*
* @param bill_info
* @param bill_url
*/
public void setBillInfo(String bill_code, String bill_info, String bill_url) {
procInst.setBillInfo(bill_info);
procInst.setBillCode(bill_code);
// procInst.setBillUrl(bill_url); todo
}

//启动流程
public void save() {
if (opt_mode == FlowConst.OperatorType.NEW) {
DbEngine.getInstance().findDao(ProcInst.class).insertEntity(procInst);
DbEngine.getInstance().findDao(Task.class).insertEntity(actInst);
buildBillLog(FlowConst.Button.ADD.value, null, null);
opt_mode = FlowConst.OperatorType.EDIT;
} else {
DbEngine.getInstance().findDao(ProcInst.class).updateEntity(procInst);
if (actInst != null) {
DbEngine.getInstance().findDao(Task.class).updateEntity(actInst);
}
}
}

DbEngine.getInstance().findDao(TaskEntity.ENTITY_NAME).updateEntity(act_inst);
DbEngine.getInstance().findDao(ProcinstEntity.ENTITY_NAME).updateEntity(proc_inst);
/**
* 删除流程
*
* @throws Exception
*/
public void delete() {
DbEngine.getInstance().findDao(ProcInst.class).deleteEntity(procInst);
DbEngine.getInstance().findDao(Task.class).deleteEntity("where bill_id=?", procInst.getId());
DbEngine.getInstance().findDao(Candidate.class).deleteEntity("where bill_id=?", procInst.getId());
DbEngine.getInstance().findDao(Care.class).deleteEntity("where bill_id=?", procInst.getId());
DbEngine.getInstance().findDao(Comment.class).deleteEntity("where bill_id=?", procInst.getId());
DbEngine.getInstance().findDao(Sign.class).deleteEntity("where bill_id=?", procInst.getId());
DbEngine.getInstance().findDao(TaskRel.class).deleteEntity("where bill_id=?", procInst.getId());
}

buildBillLog(FlowConst.Button.HANDLE.value, act_inst, null);
// comp.transCallback(CmEnum.FlowOptType.RETAKE.value, act_inst, null);
/**
* 返回页面前的设置
*/
public void resetPage() {
List<Task> listTask = adjustTasks();
//可选步骤
tasks.clear();
String next_text = procDef.getProcInfo().getActNameById(actInst.getActId());
int index = 0;
for (Task act : listTask) {
Map<String, String> row = new HashMap<>();
tasks.add(row);
row.put("id", String.valueOf(act.getId()));
if (act.getId() == actInst.getId() && listTask.size() > 1 && index != 0) {
next_text = "待" + next_text;
} else {
next_text = procDef.getProcInfo().getActNameById(act.getActId());
}
row.put("text", next_text);
index++;
}
resetButtons();
}

public void resetButtons() {
Map<String, Integer> buttons = new HashMap<>();
//按钮
buttons.clear();
long user_id = us.getUserId();
/*
//菜单权限
Map<String, String> mapPermisson = MenuHelper.getPermission(context);
//新增不要显示历史
boolean isNew = opt_mode == FlowConst.OperatorType.NEW;
boolean isAdmin = UserBaseEntityBuffer.getInstance().isAdmin(user_id);
boolean canEdit = MenuHelper.hasPermisson(mapPermisson, FlowConst.MenuFuncRight.ADD.value) || MenuHelper.hasPermisson(mapPermisson, FlowConst.MenuFuncRight.UPD.value);
//能否新增,菜单有授权+单据有流程分配
boolean canAdd = canEdit && BillFlowWfHelper.getBillProc(procInst.getBillType(), user_id) != null;
boolean canDel = MenuHelper.hasPermisson(mapPermisson, FlowConst.MenuFuncRight.DEL.value);
boolean canDis = MenuHelper.hasPermisson(mapPermisson, FlowConst.MenuFuncRight.DIS.value) && canEdit && !isNew;
//非制单人能否修改单据
boolean othCanEdit = BillFlowWfHelper.getPropBool(procDef.getEntityId(), FlowConst.NULL_STR, FlowConst.ProcProperty.CAN_EDIT_OTHER);

buttons.put(FlowConst.Button.LOG, isNew ? 0 : 1);
buttons.put(FlowConst.Button.WORD, isNew || !MenuHelper.hasPermisson(mapPermisson, FlowConst.MenuFuncRight.EXP.value) ? 0 : 1);
buttons.put(FlowConst.Button.EXCEL, isNew || !MenuHelper.hasPermisson(mapPermisson, FlowConst.MenuFuncRight.EXP.value) ? 0 : 1);
buttons.put(FlowConst.Button.DEL, !isNew ? 1 : 0);
buttons.put(FlowConst.Button.ADD, canAdd ? 1 : 0);
//buttons.put(FlowConst.Button.DISUSE, canDis ? 1 : 0);
buttons.put(FlowConst.Button.DISUSE, 0);

//单据作废
if (procInst.getStatu() == FlowConst.InstanceStatu.DISUSE.value) {
buttons.put(FlowConst.Button.DISUSE, 0);
buttons.put(FlowConst.Button.DEL, 0);
context.getDfpResponse().put("buttons", buttons);
return;
}
if (procInst.getStatu() == FlowConst.InstanceStatu.FINISH.value) {
buttons.put(FlowConst.Button.DEL, 0);
}
ActivityEntity act = ActivityEntityBuffer.getInstance().get(actInst.getActId());
//非制单状态时 编辑权限受 功能权限+流程修改权限+流程节点修改权限
boolean notMakeEdit = act != null && act.getActEdit() && othCanEdit && MenuHelper.hasPermisson(mapPermisson, FlowConst.MenuFuncRight.UPD.value);
boolean handler_make = isHandleMakeEx(act);

//当前任务是我办理的(我的待办任务,前面读取的时候也已经写了办理人为我了):
if (act == null || act.getActType() == FlowConst.ActivityType.endEvent.value) {
if (isAdmin) buttons.put(FlowConst.Button.RETAKE, 1);
buttons.put(FlowConst.Button.DISUSE, 0);
} else if (user_id.equalsIgnoreCase(actInst.getHandler()) || isAdmin) {
if (actInst.getStatu() == FlowConst.ActivityStatu.WAIT.value) {
//待办任务,显示办理按钮
if (notMakeEdit || handler_make) {
buttons.put(FlowConst.Button.HANDLER, 1);
buttons.put(FlowConst.Button.SUBMIT, 0);
} else {
buttons.put(FlowConst.Button.SUBMIT, 1);
buttons.put(FlowConst.Button.REJECT, 1);
buttons.put(FlowConst.Button.REJECT_MAKE, 1);
}
} else if (actInst.getStatu() == FlowConst.ActivityStatu.HANDLE.value) {
buttons.put(FlowConst.Button.SUBMIT, 1);
//办理中任务,提交/驳回
if (actInst.isMake()) {
buttons.put(FlowConst.Button.SAVE, 1);
if (canDel && !isNew) {
buttons.put(FlowConst.Button.DEL, 1);
}
} else {
if (notMakeEdit || handler_make) {
buttons.put(FlowConst.Button.SAVE, 1);
}
buttons.put(FlowConst.Button.REJECT, 1);
buttons.put(FlowConst.Button.REJECT_MAKE, 1);
}
} else if (actInst.getStatu() == FlowConst.ActivityStatu.SUBMIT.value) {
//我已提交的任务,取回(前面已经过滤掉不能取回的任务:下一任务已办理)
buttons.put(FlowConst.Button.RETAKE, 1);
}
} else if (actInst.getStatu() == FlowConst.ActivityStatu.WAIT.value && new ActinstDao().isMyWaitedTask(actInst.getTaskId(), user_id)) {
//待办任务,显示办理按钮
if (notMakeEdit || handler_make) {
buttons.put(FlowConst.Button.HANDLER, 1);
buttons.put(FlowConst.Button.SUBMIT, 0);
} else buttons.put(FlowConst.Button.SUBMIT, 1);
} else if (actInst.isMake() && actInst.getStatu() == FlowConst.ActivityStatu.HANDLE.value && canEdit && BillFlowWfHelper.getPropBool(procDef.getEntityId(), FlowConst.NULL_STR, FlowConst.ProcProperty.CAN_EDIT_OTHER)) {
//不是我的任务,制单任务判断属性,是否可以修改他人单据
ProcdefEntity def = BillFlowWfHelper.getBillProc(procInst.getBillType(), user_id);
if (def != null && def.getEntityId().equals(procDef.getEntityId())) {
buttons.put(FlowConst.Button.SAVE, 1);
buttons.put(FlowConst.Button.SUBMIT, 1);
}
}
context.getDfpResponse().put("buttons", buttons);
*/
}

/**
* 校验权限
*
* @throws Exception
*/
private void checkPermission() {
if (actInst == null) {
throw new SwException("没有找到对应的任务步骤!");
}
long user_id = us.getUserId();
//是我办理的单据,正常,返回
if (actInst.getHandler() <= 0L || user_id == actInst.getHandler()) return;
//不是我办理的单据,非制单状态,不允许他人操作
if (!actInst.isMake()) {
throw new BizException("非制单步骤,必须办理人本人操作!");
}
}
/*
public void submitToEnd() {
long user_id = us.getUserId();
//校验权限,当前人员有权限干不,没权限直接抛异常
checkPermission();
if (actInst.getStatu() == FlowConst.ActivityStatu.SUBMIT.value) {
throw new BizException("当前任务已经提交,不能重复提交");
}

if (actInst.getStatu() == FlowConst.ActivityStatu.WAIT.value && !FlowHelper.isMyWaitedTask(actInst.getEntityId(), user_id)) {
throw new BizException("您不是当前任务的办理人,不允许提交");
}
//校验完毕,接下来干活。
List<Activity> new_acts = procDef.getProcInfo().findEndActivity();
if (CommUtil.isEmpty(new_acts)) {
throw new BizException("结束任务为空,不允许提交到结束!");
}

//待新增任务
List<Task> listInsertTask = new ArrayList<>();
List<TaskRel> listTaskRel = new ArrayList<>();
//待新增任务候选人
List<Candidate> listInsertCand = new ArrayList<>();

for (Activity act : new_acts) {
buildTask(act, listInsertTask, listInsertCand, listTaskRel, user_id);
}

actInst.setHandler(user_id);
actInst.setStartTime(DateUtil.nowDateTimeLong());
actInst.setStatu(FlowConst.ActivityStatu.SUBMIT.value);
actInst.setRetake(true);

if (listInsertTask.size() > 0) {
procInst.setTaskId(listInsertTask.get(0).getEntityId());
} else {
procInst.setTaskId(actInst.getEntityId());
}

if (new_acts.size() == 1 && new_acts.get(0).getType() == FlowConst.ActivityType.endEvent.value) {
procInst.setstatu(FlowConst.InstanceStatu.FINISH.value);
procInst.setEndTime(UtilDateTime.nowDateTimeString());
} else {
procInst.setstatu(FlowConst.InstanceStatu.RUNING.value);
}

//保存入库
if (!listInsertTask.isEmpty()) {
actDao.batchInsert(listInsertTask);
new CandidateDao().batchInsert(listInsertCand);
new ActinstRelDao().batchInsert(listTaskRel);
}
actDao.update(actInst);
new ProcinstDao().update(procInst);

buildBillLog(FlowConst.FlowOptType.SUBMIT.value, actInst, listInsertTask);
comp.transCallback(FlowConst.FlowOptType.SUBMIT.value, actInst, listInsertTask);

}
*/

/**
* 提交
*
* @throws Exception
*/
/*
public void submit(AbsBillWfComponent comp) {
String user_id = context.getLoginInfo().getUserId();
//校验权限,当前人员有权限干不,没权限直接抛异常
checkPermission();
if (actInst.getStatu() == FlowConst.ActivityStatu.SUBMIT.value) {
throw new DfpException("当前任务已经提交,不能重复提交");
}

ActinstDao actDao = new ActinstDao();
if (actInst.getStatu() == FlowConst.ActivityStatu.WAIT.value && !actDao.isMyWaitedTask(actInst.getEntityId(), user_id) && !UserBaseEntityBuffer.getInstance().isAdmin(user_id)) {
throw new DfpException("您不是当前任务的办理人,不允许提交");
}
//校验完毕,接下来干活。todo:流程定义需要控制一下,非判断/并发分支不允许多个出口
List<ActivityEntity> new_acts = BillHelper.getNextActivity(comp);

//待新增任务
List<Task> listInsertTask = new ArrayList<>();
List<ActinstRelEntity> listTaskRel = new ArrayList<>();
//待新增任务候选人
List<CandidateEntity> listInsertCand = new ArrayList<>();

for (ActivityEntity act : new_acts) {
buildTask(act, listInsertTask, listInsertCand, listTaskRel, user_id);
}

actInst.setHandler(user_id);
actInst.setStartTime(UtilDateTime.nowDateTimeString());
actInst.setstatu(FlowConst.ActivityStatu.SUBMIT.value);
actInst.setRetake(true);

if (listInsertTask.size() > 0) {
procInst.setTaskId(listInsertTask.get(0).getEntityId());
procInst.setTaskName(ActivityEntityBuffer.getInstance().getNameById(listInsertTask.get(0).getActId()));
} else {
procInst.setTaskId(actInst.getEntityId());
procInst.setTaskName(ActivityEntityBuffer.getInstance().getNameById(actInst.getActId()));
}

if (new_acts.size() == 1 && new_acts.get(0).getActType() == FlowConst.ActivityType.endEvent.value) {
procInst.setstatu(FlowConst.InstanceStatu.FINISH.value);
procInst.setEndTime(UtilDateTime.nowDateTimeString());
} else {
procInst.setstatu(FlowConst.InstanceStatu.RUNING.value);
}

//保存入库
if (!listInsertTask.isEmpty()) {
actDao.batchInsert(listInsertTask);
new CandidateDao().batchInsert(listInsertCand);
new ActinstRelDao().batchInsert(listTaskRel);
}
actDao.update(actInst);
new ProcinstDao().update(procInst);

buildBillLog(FlowConst.FlowOptType.SUBMIT.value, actInst, listInsertTask);
comp.transCallback(FlowConst.FlowOptType.SUBMIT.value, actInst, listInsertTask);
}


public void checkSubmit(AbsBillWfComponent comp) {
String user_id = context.getLoginInfo().getUserId();
//校验权限,当前人员有权限干不,没权限直接抛异常
checkPermission();
if (actInst.getStatu() == FlowConst.ActivityStatu.SUBMIT.value) {
throw new DfpException("当前任务已经提交,不能重复提交");
}
ActinstDao actDao = new ActinstDao();
if (actInst.getStatu() == FlowConst.ActivityStatu.WAIT.value && !actDao.isMyWaitedTask(actInst.getEntityId(), user_id) && !UserBaseEntityBuffer.getInstance().isAdmin(user_id)) {
throw new DfpException("您不是当前任务的办理人,不允许提交");
}
comp.checkSubmit(FlowConst.FlowOptType.SUBMIT.value, actInst);
}
*/

/**
* 作废
*
* @throws Exception
*/
/*
public void disuse(AbsBillWfComponent comp) {
String user_id = context.getLoginInfo().getUserId();
//校验权限,当前人员有权限干不,没权限直接抛异常
checkPermission();
if (procInst.getStatu() == FlowConst.InstanceStatu.FINISH.value) {
throw new DfpException("当前单据已审批完成,不能作废单据");
}

ActinstDao actDao = new ActinstDao();
if (actInst.getStatu() == FlowConst.ActivityStatu.WAIT.value && !actDao.isMyWaitedTask(actInst.getEntityId(), user_id) && !UserBaseEntityBuffer.getInstance().isAdmin(user_id)) {
throw new DfpException("您不是当前任务的办理人,不允许作废");
}

actInst.setHandler(user_id);
actInst.setStartTime(UtilDateTime.nowDateTimeString());
actInst.setstatu(FlowConst.ActivityStatu.DISUSE.value);
procInst.setstatu(FlowConst.InstanceStatu.DISUSE.value);
procInst.setEndTime(UtilDateTime.nowDateTimeString());

actDao.update(actInst);
new ProcinstDao().update(procInst);

buildBillLog(FlowConst.FlowOptType.DISUSE.value, actInst, null);
comp.transCallback(FlowConst.FlowOptType.DISUSE.value, actInst, null);
}

*/

/**
* 提交创建任务
*
* @param act
* @param listInsertTask
* @param listInsertCand
* @param listTaskRel
* @throws Exception
*/
/*
private void buildTask(ActivityEntity act, List<Task> listInsertTask, List<CandidateEntity> listInsertCand, List<ActinstRelEntity> listTaskRel, String submit_user) {
Task task = new Task();
listInsertTask.add(task);
task.init();
task.setEntityId(PKGenerator.newId());
task.setBillId(procInst.getEntityId());
task.setProcDefId(procDef.getEntityId());
task.setActId(act.getEntityId());
task.setStartTime(UtilDateTime.nowDateTimeString());
task.setstatu(FlowConst.ActivityStatu.WAIT.value);
task.setMake(false);
task.setSign(false);
task.setReject(false);
task.setRetake(false);
task.setAuto(false);

ActinstRelEntity rel = new ActinstRelEntity();
rel.setEntityId(PKGenerator.newId());
rel.setBillId(task.getBillId());
rel.setTaskId(task.getEntityId());
rel.setBeforeTaskBid(actInst.getEntityId());
listTaskRel.add(rel);

if (act.getActType() != FlowConst.ActivityType.endEvent.value) {
boolean handler_make = isHandleMakeEx(act);
Set<String> listHander = new HashSet<>();
if (handler_make) {
listHander.add(procInst.getUserId());
} else {
String hanlder_group = BillFlowWfHelper.getPropStr(procInst.getProcDefId(), act.getEntityId(), FlowConst.ProcProperty.HANDLER);
int handler_range = BillFlowWfHelper.getPropInt(procInst.getProcDefId(), act.getActId(), FlowConst.ProcProperty.HANDLER_RANGE);
//获取所有候选人
listHander = UserGroupHelper.getUserIdList(hanlder_group, procInst, handler_range, context);
}
if (UserBaseEntityBuffer.getInstance().isAdmin(context.getLoginInfo().getUserId()) && UtilPub.isEmpty(listHander)) {
listHander = new HashSet<>();
listHander.add(context.getLoginInfo().getUserId());
}
if (UtilPub.isEmpty(listHander)) {
throw new DfpException("没有符合条件的主办人!" + act.getActName());
}
for (String user_id : listHander) {
if (act.getActIgnore() && user_id.equals(submit_user)) continue;
CandidateEntity cand = new CandidateEntity();
cand.init();
cand.setEntityId(PKGenerator.newId());
cand.setBillId(task.getBillId());
cand.setTaskId(task.getEntityId());
cand.setUserId(user_id);

listInsertCand.add(cand);
}
if (UtilPub.isEmpty(listInsertCand)) {
throw new DfpException("没有符合条件的主办人!" + act.getActName());
}
}
}

*/

/**
* 取回
*
* @throws Exception
*/
/*
public void retake(AbsBillWfComponent comp) {
String user_id = context.getLoginInfo().getUserId();
//校验权限,当前人员有权限干不,没权限直接抛异常
checkPermission();
if (actInst.getStatu() != FlowConst.ActivityStatu.SUBMIT.value && !UserBaseEntityBuffer.getInstance().isAdmin(user_id)) {
throw new DfpException("当前任务非提交状态,不能取回!");
}
ActinstDao actDao = new ActinstDao();
ActivityEntity activityEntity = ActivityEntityBuffer.getInstance().get(actInst.getActId());
if (activityEntity.getActType() == FlowConst.ActivityType.endEvent.value) {//从结束取回
List<Task> new_acts = actDao.findBeforeTasks(actInst.getEntityId());
Task old_act = (Task) actInst.clone();
old_act.setEntityId(actInst.getEntityId());

actInst = new_acts.get(0);
actInst.setHandler(user_id);
actInst.setStartTime(UtilDateTime.nowDateTimeString());
actInst.setstatu(FlowConst.ActivityStatu.HANDLE.value);
if (actInst.isMake()) {
actInst.setHandler(comp.billEntity.getBillUser());
}

procInst.setTaskId(actInst.getEntityId());
procInst.setTaskName(ActivityEntityBuffer.getInstance().getNameById(actInst.getActId()));
procInst.setstatu(actInst.isMake() ? FlowConst.InstanceStatu.BEGIN.value : FlowConst.InstanceStatu.RUNING.value);

actDao.update(actInst);
actDao.delete(old_act);
new ActinstRelDao().deleteAll("where before_task_bid=?", old_act.getEntityId());
new ProcinstDao().update(procInst);
new_acts.clear();
new_acts.add(old_act);
buildBillLog(FlowConst.FlowOptType.RETAKE.value, actInst, new_acts);
comp.transCallback(FlowConst.FlowOptType.RETAKE.value, actInst, new_acts);
} else {

List<Task> new_acts = actDao.findAfterTasks(actInst.getEntityId());

for (Task act : new_acts) {
if (act.getStatu() != FlowConst.ActivityStatu.WAIT.value) {
throw new DfpException("后续任务[" + ActivityEntityBuffer.getInstance().getNameById(act.getActId()) + "]已经办理,不能取回!");
}
}

actInst.setHandler(user_id);
actInst.setStartTime(UtilDateTime.nowDateTimeString());
actInst.setstatu(FlowConst.ActivityStatu.HANDLE.value);

procInst.setTaskId(actInst.getEntityId());
procInst.setTaskName(ActivityEntityBuffer.getInstance().getNameById(actInst.getActId()));

procInst.setstatu(FlowConst.InstanceStatu.RUNING.value);
if (actInst.isMake()) procInst.setstatu(FlowConst.InstanceStatu.BEGIN.value);
actDao.update(actInst);
actDao.batchDelete(new_acts);
new ActinstRelDao().deleteAll("where before_task_bid=?", actInst.getEntityId());
new ProcinstDao().update(procInst);

buildBillLog(FlowConst.FlowOptType.RETAKE.value, actInst, new_acts);
comp.transCallback(FlowConst.FlowOptType.RETAKE.value, actInst, new_acts);
}
}

*/

/**
* 驳回
*
* @throws Exception
*/
/*
public void reject(AbsBillWfComponent comp) {
String user_id = context.getLoginInfo().getUserId();
//校验权限,当前人员有权限干不,没权限直接抛异常
checkPermission();
if (actInst.getStatu() == FlowConst.ActivityStatu.SUBMIT.value) {
throw new DfpException("当前任务已提交,不能驳回!");
}

ActinstDao actDao = new ActinstDao();
//获取前置任务,前置任务需要置为被驳回的办理状态,同时,前置任务的其他后置任务需要删除
List<Task> new_acts = actDao.findBeforeTasks(actInst.getEntityId());
if (UtilPub.isEmpty(new_acts)) {
throw new DfpException("没有找到前续任务,驳回失败!");
}
//记录需要被删除后续任务的任务id
StringBuilder sqlIn = new StringBuilder(128);
//设为被驳回状态
for (Task act : new_acts) {
act.setstatu(FlowConst.ActivityStatu.HANDLE.value);
act.setReject(true);

sqlIn.append(",").append(act.getEntityId());
}

actInst.setstatu(FlowConst.ActivityStatu.REJECT.value);

procInst.setTaskId(new_acts.get(0).getEntityId());
procInst.setTaskName(ActivityEntityBuffer.getInstance().getNameById(new_acts.get(0).getActId()));
if (new_acts.size() == 1 && new_acts.get(0).isMake()) {
procInst.setstatu(FlowConst.InstanceStatu.BEGIN.value);
} else {
procInst.setstatu(FlowConst.InstanceStatu.RUNING.value);
}
//删除这些任务的后续任务
List<Task> del_acts = actDao.findAfterTasks(sqlIn.substring(1));
actDao.batchDelete(del_acts);
actDao.batchUpdate(new_acts);
new ActinstRelDao().deleteAll("where before_task_bid in (" + sqlIn.substring(1) + ")");
new ProcinstDao().update(procInst);

buildBillLog(FlowConst.FlowOptType.REJECT.value, actInst, new_acts);
comp.transCallback(FlowConst.FlowOptType.REJECT.value, actInst, new_acts);
}

*/

/**
* 驳回到制单
*
* @throws Exception
*/
/*
public void rejectToMake(AbsBillWfComponent comp) {
//校验权限,当前人员有权限干不,没权限直接抛异常
checkPermission();
if (actInst.getStatu() == FlowConst.ActivityStatu.SUBMIT.value) {
throw new DfpException("当前任务已提交,不能驳回!");
}

ActinstDao actDao = new ActinstDao();
//获取前置任务,前置任务需要置为被驳回的办理状态,同时,前置任务的其他后置任务需要删除
Task make_act = actDao.findMakeTask(actInst.getBillId());
if (EntityUtil.isNull(make_act)) {
throw new DfpException("没有找到制单任务,驳回到制单失败!");
}

//设为被驳回状态
make_act.setstatu(FlowConst.ActivityStatu.HANDLE.value);
make_act.setReject(true);

actInst.setstatu(FlowConst.ActivityStatu.REJECT.value);

procInst.setTaskId(make_act.getEntityId());
procInst.setTaskName(ActivityEntityBuffer.getInstance().getNameById(make_act.getActId()));
procInst.setstatu(FlowConst.InstanceStatu.BEGIN.value);

actDao.update(make_act);
//删除非制单步骤
actDao.deleteAll("where bill_id = ? and task_id <> ? ", make_act.getBillId(), make_act.getEntityId());
new ActinstRelDao().deleteAll("where bill_id = ? and task_id <> ?", make_act.getBillId(), make_act.getEntityId());
new ProcinstDao().update(procInst);
//删除候选人
new CandidateDao().deleteAll(" where bill_id = ? and task_id <> ?", make_act.getBillId(), make_act.getEntityId());

List<Task> make_acts = new ArrayList<>();
make_acts.add(make_act);

buildBillLog(FlowConst.FlowOptType.REJECT.value, actInst, make_acts);
comp.transCallback(FlowConst.FlowOptType.REJECT.value, actInst, make_acts);
}

*/

/**
* 办理
*
* @throws Exception
*/
/*
public void handler(AbsBillWfComponent comp) {
String user_id = context.getLoginInfo().getUserId();
//校验权限,当前人员有权限干不,没权限直接抛异常
checkPermission();
if (actInst.getStatu() != FlowConst.ActivityStatu.WAIT.value) {
throw new DfpException("当前任务非待办状态,不能办理失败!");
}

ActinstDao actDao = new ActinstDao();

actInst.setHandler(user_id);
actInst.setStartTime(UtilDateTime.nowDateTimeString());
actInst.setstatu(FlowConst.ActivityStatu.HANDLE.value);

procInst.setTaskId(actInst.getEntityId());
procInst.setTaskName(ActivityEntityBuffer.getInstance().getNameById(actInst.getActId()));

procInst.setstatu(FlowConst.InstanceStatu.RUNING.value);

actDao.update(actInst);
new ProcinstDao().update(procInst);

buildBillLog(FlowConst.FlowOptType.HANDLER.value, actInst, null);
// comp.transCallback(FlowConst.FlowOptType.RETAKE.value, act_inst, null);
}

*/

/**
* 状态变更,构建日志
*/
protected void buildBillLog(final String flow_opt, TaskEntity srcTask, List<TaskEntity> dstTasks) {
protected void buildBillLog(final String flow_opt, Task srcTask, List<Task> dstTasks) {
/*LogEntity logEntity = new LogEntity();
logEntity.setSuggestion(context.getDfpRequest().getParams().getStrIgnoreNull("suggestion"));
logEntity.setFlowOpt(flow_opt);
@@ -193,12 +927,12 @@ public class FlowInstance {
}
if (UtilPub.isNotEmpty(dstTasks)) {
sbDst = new StringBuilder();
for (ActinstEntity a : dstTasks) {
for (Task a : dstTasks) {
sbDst.append("/").append(ActivityEntityBuffer.getInstance().getNameById(a.getActId()));
}
dst = sbDst.substring(1);
}
if (flow_opt == CmEnum.FlowOptType.RETAKE.value) {
if (flow_opt == FlowConst.FlowOptType.RETAKE.value) {
logEntity.setInfo(dst + "->" + src);
logEntity.setStepName(step_name);
} else if (dst != null) {


+ 63
- 7
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowProvider.java Ver fichero

@@ -1,17 +1,20 @@
package cc.smtweb.system.bpm.web.engine.flow;

import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.db.EntityHelper;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.framework.core.mvc.service.AbstractCompProvider;
import cc.smtweb.framework.core.mvc.service.SqlNamedPara;
import cc.smtweb.framework.core.util.CommUtil;
import cc.smtweb.system.bpm.web.design.flow.FlowConst;
import cc.smtweb.system.bpm.web.design.form.ModelForm;
import cc.smtweb.system.bpm.web.design.form.ModelFormHelper;
import cc.smtweb.system.bpm.web.design.form.define.PageDataset;
import cc.smtweb.system.bpm.web.design.form.define.PageDatasets;
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageHelper;
import cc.smtweb.system.bpm.web.engine.flow.entity.ProcInst;
import cc.smtweb.system.bpm.web.engine.flow.entity.Task;
import cc.smtweb.system.bpm.web.engine.flow.entity.TaskRel;

import java.util.ArrayList;
import java.util.List;

/**
* Created by Akmm at 2022/5/26 18:40
@@ -28,5 +31,58 @@ public class FlowProvider extends AbstractCompProvider {
});
}

//根据id,获取流程实例
public ProcInst findProcInst(long billId) {
return doGetData("p_" + billId, () -> {
EntityDao<ProcInst> bdao = DbEngine.getInstance().findDao(ProcInst.class);
ProcInst bean = bdao.queryEntity(billId);
if (bean == null) throw new BizException("没有找到指定流程实例(id=" + billId + ")!");
EntityHelper.loadBeanText(bean.getTableName(), bean.getData(), null);
return bean;
});
}

//根据id,获取流程实例
public Task findTask(long taskId) {
return doGetData("a_" + taskId, () -> {
EntityDao<Task> bdao = DbEngine.getInstance().findDao(Task.class);
Task bean = bdao.queryEntity(taskId);
if (bean == null) throw new BizException("没有找到指定流程任务(id=" + taskId + ")!");
EntityHelper.loadBeanText(bean.getTableName(), bean.getData(), null);
return bean;
});
}

//获取指定任务的前置任务
public Task findBeforeTask(long taskId) {
return doGetData("ab_" + taskId, () -> {
EntityDao<Task> bdao = DbEngine.getInstance().findDao(Task.class);
List<Task> list = bdao.queryEx(" t," + EntityHelper.getSchemaTableName(TaskRel.ENTITY_NAME) + " r " +
"where t.task_id=r.before_task_bid and r.task_id = ?", taskId);
if (CommUtil.isEmpty(list)) throw new BizException("没有找到指定流程前置任务(id=" + taskId + ")!");
Task bean = list.get(0);
EntityHelper.loadBeanText(bean.getTableName(), bean.getData(), null);
return bean;
});
}

//获取指定任务的前置任务
public List<Task> findBeforeTasks(String taskIds) {
EntityDao<Task> bdao = DbEngine.getInstance().findDao(Task.class);
List<Task> list = bdao.queryEx(" t," + EntityHelper.getSchemaTableName(TaskRel.ENTITY_NAME) + " r " +
"where t.task_id=r.before_task_bid and r.task_id in (" + taskIds + ")");
if (CommUtil.isEmpty(list)) return new ArrayList<>();
return list;

}

//根据id,获取流程实例
public List<Task> findCurTask(long billId) {
return doGetData("ac_" + billId, () -> {
EntityDao<Task> bdao = DbEngine.getInstance().findDao(Task.class);
List<Task> list = bdao.queryWhere("bill_id = ? and statu<?", billId, FlowConst.ActivityStatu.SUBMIT.value);
if (list == null) return new ArrayList<>();
return list;
});
}
}

+ 0
- 108
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/FlowService.java Ver fichero

@@ -1,108 +0,0 @@
package cc.smtweb.system.bpm.web.engine.flow;

import cc.smtweb.framework.core.annotation.SwBody;
import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.mvc.service.AbstractCompService;
import cc.smtweb.framework.core.mvc.service.AbstractHandler;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageDelHandler;
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageLoadHandler;
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageSaveHandler;
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageService;

/**
* Created by Akmm at 2022/5/24 14:21
* 工作流
*/
public class FlowService extends DynPageService {
public final static String TYPE_FLOW = "flow";

@Override
protected AbstractHandler createHandler(String type) {
switch (type) {
case TYPE_LOAD:
return new DynPageLoadHandler();
case TYPE_SAVE:
return new DynPageSaveHandler();
case TYPE_DEL:
return new DynPageDelHandler();
}
return null;
}

protected R flowHandler(SwMap params, UserSession us, IFlowWorker worker) {
try {
FlowHandler handler = (FlowHandler)getHandler(params, us, TYPE_FLOW);
return worker.doWork(handler);
} catch (Exception e) {
return R.error("操作失败!", e);
}
}

/**
* 办理,签收
*
* @throws Exception
*/
public void handle(@SwBody SwMap params, UserSession us) {
flowHandler(params, us, FlowHandler::handle);
}

/**
* 提交
*
* @throws Exception
*/
public void submit(@SwBody SwMap params, UserSession us) {
flowHandler(params, us, FlowHandler::handle);
}


/**
* 提交
*
* @throws Exception
*/
public void checkSubmit(@SwBody SwMap params, UserSession us) {

}


/**
* 作废
*
* @throws Exception
*/
public void disuse(@SwBody SwMap params, UserSession us) {

}


/**
* 取消提交
*
* @throws Exception
*/
public void retake(@SwBody SwMap params, UserSession us) {

}

/**
* 驳回
*
* @throws Exception
*/
public void reject(@SwBody SwMap params, UserSession us) {

}


public void rejectToMake(@SwBody SwMap params, UserSession us) {

}

interface IFlowWorker {
R doWork(FlowHandler handler);
}
}

smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/define/CandidateEntity.java → smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Candidate.java Ver fichero

@@ -1,4 +1,4 @@
package cc.smtweb.system.bpm.web.engine.flow.define;
package cc.smtweb.system.bpm.web.engine.flow.entity;

import cc.smtweb.framework.core.annotation.SwTable;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
@@ -8,10 +8,10 @@ import cc.smtweb.framework.core.db.impl.DefaultEntity;
* 候选信息人
*/
@SwTable("WF_CANDIDATE")
public class CandidateEntity extends DefaultEntity {
public class Candidate extends DefaultEntity {
public static final String ENTITY_NAME = "WF_CANDIDATE";

public CandidateEntity() {
public Candidate() {
super(ENTITY_NAME);
}


smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/define/CareEntity.java → smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Care.java Ver fichero

@@ -1,4 +1,4 @@
package cc.smtweb.system.bpm.web.engine.flow.define;
package cc.smtweb.system.bpm.web.engine.flow.entity;

import cc.smtweb.framework.core.annotation.SwTable;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
@@ -8,10 +8,10 @@ import cc.smtweb.framework.core.db.impl.DefaultEntity;
* 候选信息人
*/
@SwTable("WF_CARE")
public class CareEntity extends DefaultEntity {
public class Care extends DefaultEntity {
public static final String ENTITY_NAME = "WF_CARE";

public CareEntity() {
public Care() {
super(ENTITY_NAME);
}


smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/define/CommentEntity.java → smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Comment.java Ver fichero

@@ -1,4 +1,4 @@
package cc.smtweb.system.bpm.web.engine.flow.define;
package cc.smtweb.system.bpm.web.engine.flow.entity;

import cc.smtweb.framework.core.annotation.SwTable;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
@@ -8,10 +8,10 @@ import cc.smtweb.framework.core.db.impl.DefaultEntity;
* 审批意见
*/
@SwTable("WF_COMMENT")
public class CommentEntity extends DefaultEntity {
public class Comment extends DefaultEntity {
public static final String ENTITY_NAME = "WF_COMMENT";

public CommentEntity() {
public Comment() {
super(ENTITY_NAME);
}


smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/define/ProcinstEntity.java → smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/ProcInst.java Ver fichero

@@ -1,4 +1,4 @@
package cc.smtweb.system.bpm.web.engine.flow.define;
package cc.smtweb.system.bpm.web.engine.flow.entity;

import cc.smtweb.framework.core.annotation.SwTable;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
@@ -8,10 +8,10 @@ import cc.smtweb.framework.core.db.impl.DefaultEntity;
* 流程实例
*/
@SwTable("WF_PROCINST")
public class ProcinstEntity extends DefaultEntity {
public class ProcInst extends DefaultEntity {
public static final String ENTITY_NAME = "WF_PROCINST";

public ProcinstEntity() {
public ProcInst() {
super(ENTITY_NAME);
}


smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/define/SignEntity.java → smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Sign.java Ver fichero

@@ -1,4 +1,4 @@
package cc.smtweb.system.bpm.web.engine.flow.define;
package cc.smtweb.system.bpm.web.engine.flow.entity;

import cc.smtweb.framework.core.annotation.SwTable;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
@@ -8,10 +8,10 @@ import cc.smtweb.framework.core.db.impl.DefaultEntity;
* 会签信息
*/
@SwTable("WF_SIGN")
public class SignEntity extends DefaultEntity {
public class Sign extends DefaultEntity {
public static final String ENTITY_NAME = "WF_SIGN";

public SignEntity() {
public Sign() {
super(ENTITY_NAME);
}


smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/define/TaskEntity.java → smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/Task.java Ver fichero

@@ -1,4 +1,4 @@
package cc.smtweb.system.bpm.web.engine.flow.define;
package cc.smtweb.system.bpm.web.engine.flow.entity;

import cc.smtweb.framework.core.annotation.SwTable;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
@@ -8,10 +8,10 @@ import cc.smtweb.framework.core.db.impl.DefaultEntity;
* 活动实例
*/
@SwTable("WF_TASK")
public class TaskEntity extends DefaultEntity {
public class Task extends DefaultEntity {
public static final String ENTITY_NAME = "WF_TASK";

public TaskEntity() {
public Task() {
super(ENTITY_NAME);
}


smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/define/TaskRelEntity.java → smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/flow/entity/TaskRel.java Ver fichero

@@ -1,4 +1,4 @@
package cc.smtweb.system.bpm.web.engine.flow.define;
package cc.smtweb.system.bpm.web.engine.flow.entity;

import cc.smtweb.framework.core.annotation.SwTable;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
@@ -8,10 +8,10 @@ import cc.smtweb.framework.core.db.impl.DefaultEntity;
* 活动之间的关系
*/
@SwTable("WF_CARE")
public class TaskRelEntity extends DefaultEntity {
public class TaskRel extends DefaultEntity {
public static final String ENTITY_NAME = "WF_CARE";

public TaskRelEntity() {
public TaskRel() {
super(ENTITY_NAME);
}


+ 2
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleService.java Ver fichero

@@ -1,6 +1,7 @@
package cc.smtweb.system.bpm.web.engine.model.listcard.single;

import cc.smtweb.framework.core.annotation.SwBody;
import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.mvc.service.*;
@@ -12,6 +13,7 @@ import cc.smtweb.system.bpm.web.engine.dynPage.DynPageService;
* Created by Akmm at 2022-08-12 15:37
* 单页面简单列表卡片服务类
*/
@SwService
public class LCSingleService extends DynPageService {
public final static String TYPE_MODEL_LIST = "modelList";
public final static String TYPE_MODEL_ADD = "modelAdd";


+ 18
- 0
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/db/EntityDao.java Ver fichero

@@ -359,6 +359,11 @@ public class EntityDao<T> extends AbstractEntityDao<T> {
return list;
}

public T queryEntityWhere(String sqlWhere, Object... params) {
List<T> list = queryWhere(sqlWhere, params);
if (CommUtil.isEmpty(list)) return null;
return list.get(0);
}
/**
* 查询对象所有数据,返回列表
*/
@@ -374,6 +379,19 @@ public class EntityDao<T> extends AbstractEntityDao<T> {
return list;
}

//原sql(select fields from table)后追加一段自定义,一般用于join
public List<T> queryEx(String sqlAdd, Object... params) {
StringBuilder sb = new StringBuilder();
handleSelect(sb, null);
if (StringUtils.isNotEmpty(sqlAdd)) {
sb.append(sqlAdd);
}

List<T> list = jdbcEngine.query(sb.toString(), type, params);
setTableName(list);
return list;
}

public List<Long> queryIdListWhere(String sqlWhere, Object... params) {
StringBuilder sb = new StringBuilder();
handleSelect(sb, modelTable.getIdField());


+ 708
- 10
smtweb-framework/core/src/main/resources/demo.json Ver fichero

@@ -1,13 +1,711 @@
{
"config": {
"model": "LC_SINGLE",
"props": {
"masterTable": "2",
"masterTable_text": "目录定义"
},
"form":
[
{
"page": {
"id": "p744256811959324672",
"type": "fx-page",
"props": {
"title": "模型测试列表",
"key": "744256811959324673"
}
},
"graph": {
"shape": "panel",
"id": "root_panel",
"type": "fx-split-panel",
"props": {
"horizontal": false,
"shadow": ""
},
"children": [
{
"id": "744256811959324674",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "50",
"label": "查询条件",
"colNum": 2,
"alignY": "center",
"paddingLeft": 20,
"paddingRight": 20,
"shadow": ""
},
"children": [
{
"id": "id744256811959324675",
"type": "fx-title",
"props": {
"label": "模型测试列表",
"fontSize": 15,
"color": "#313131",
"fontWeight": "bold",
"showPrefix": true,
"prefixWidth": 5,
"prefixHeight": 15,
"prefixColor": "#1E90FF"
}
},
{
"id": "id744256811959324676",
"type": "fx-button-group",
"props": {
"menus": [],
"textAlign": "right"
},
"slots": {
"default": [
{
"type": "fx-button",
"props": {
"label": "新增",
"leftIcon": "plus",
"type": "primary",
"action": "button:add",
"link": false,

"linkType": "dialog",
"fxLink": "dialog:editDialog",
"fxLink_text": "ttttt",
},
"id": "id744256811959324677"
}
]
}
}
]
},
{
"id": "744256811959324678",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "",
"label": "列表",
"colNum": 0,
"paddingLeft": 20,
"paddingRight": 20,
"shadow": ""
},
"children": [{
"id": "id744256811959324679",
"type": "fx-table",
"props": {
"label": "表格",

"border": true,
"stripe": true,
"showHeader": true,
"fit": true,
"dataset": "ds_182a5ea30e6",
"actionWidth": 120
},
"slots": {
"default": [
{
"id": "id744256811959324680",
"type": "fx-table-column",
"props": {
"field": "id_182a5ea30fe",
"label": "ID"
}
},
{
"id": "id744256811959324681",
"type": "fx-table-column",
"props": {
"field": "id_182a5ea30ff",
"label": "父ID"
}
},
{
"id": "id744256811959324682",
"type": "fx-table-column",
"props": {
"field": "id_182a5ea3100",
"label": "级次码"
}
},
{
"id": "id744256811959324683",
"type": "fx-table-column",
"props": {
"field": "id_182a5ea3101",
"label": "所属项目"
}
},
{
"id": "id744256811959324684",
"type": "fx-table-column",
"props": {
"field": "id_182a5ea3102",
"label": "编码"
}
},
{
"id": "id744256811959324685",
"type": "fx-table-column",
"props": {
"field": "id_182a5ea3103",
"label": "编码"
}
},
{
"id": "id744256811959324686",
"type": "fx-table-column",
"props": {
"field": "id_182a5ea3104",
"label": "创建人"
}
},
{
"id": "id744256811959324687",
"type": "fx-table-column",
"props": {
"field": "id_182a5ea3105",
"label": "最后更新人"
}
},
{
"id": "id744256811959324688",
"type": "fx-table-column",
"props": {
"field": "id_182a5ea3106",
"label": "创建时间"
}
},
{
"id": "id744256811959324689",
"type": "fx-table-column",
"props": {
"field": "id_182a5ea3107",
"label": "最后更新时间"
}
}
],
"button": [
{
"id": "id744256811959324690",
"type": "fx-button",
"props": {
"label": "编辑",
"type": "primary",
"leftIcon": "edit",
"action": "button:edit",
"link": false,
"text": true,
"linkType": "dialog",
"fxLink": "dialog:editDialog",
"fxLink_text": "ttttt",
"dataset": ""
}
},
{
"id": "id744256811959324691",
"type": "fx-button",
"props": {
"label": "删除",
"type": "danger",
"leftIcon": "delete-themes",
"action": "button:remove",
"preAction": "",
"link": false,
"text": true,
"confirm": "",
"nextAction": "button:search",
"dataset": ""
}
}
]
},
"events": {}
}
]
},
{
"id": "744256811959324692",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "15",
"backgroundColor": "transparent"
},
"children": []
}
]
}
}
,{
"page": {
"list": "bpm.sTestMList"
"id": "id744256811959324693",
"type": "fx-dialog",
"props": {
"title": "ttttt",
"key": "editDialog",
"fontSize": 16,
"color": "#313131",
"fontWeight": "bold",
"showPrefix": true,
"prefixWidth": 5,
"prefixHeight": 16,
"prefixColor": "#1E90FF"
},
"events": {}
},
"graph": {
"shape": "panel",
"id": "root_panel",
"type": "fx-split-panel",
"props": {
"horizontal": false,
"shadow": "never"
},
"children": [
{
"id": "744256811959324694",
"type": "fx-split-panel",
"shape": "panel",
"props": {
"horizontal": false,
"scroll": true
},
"children": [
{
"id": "744256811959324695",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "0",
"paddingTop": 15,
"colNum": 2
},
"children": [
{
"id": "id744256811959324696",
"type": "fx-text",
"props": {
"label": "ID",
"type": "text",
"dataset": "ds_182a5ea30e9",
"field": "id_182a5ea30f1",
"required": "",
"placeholder": "请输入ID",
"labelWidth": 100,
"readonly": false,
"affixError": true
},
"events": {}
}
,{
"id": "id744256811959324697",
"type": "fx-placeholder",
"props": {
"label": "占位"
},
"layout": {
"row": 1
}
}
,
{
"id": "id744256811959324698",
"type": "fx-text",
"props": {
"label": "父ID",
"type": "text",
"dataset": "ds_182a5ea30e9",
"field": "id_182a5ea30f3",
"required": "",
"placeholder": "请输入父ID",
"labelWidth": 100,
"readonly": false,
"affixError": true
},
"events": {}
}
,{
"id": "id744256811959324699",
"type": "fx-placeholder",
"props": {
"label": "占位"
},
"layout": {
"row": 1
}
}
,
{
"id": "id744256811959324700",
"type": "fx-text",
"props": {
"label": "级次码",
"type": "text",
"dataset": "ds_182a5ea30e9",
"field": "id_182a5ea30f4",
"required": "",
"maxlength": 100,
"placeholder": "请输入级次码",
"labelWidth": 100,
"readonly": false,
"affixError": true
},
"events": {}
}
,{
"id": "id744256811959324701",
"type": "fx-placeholder",
"props": {
"label": "占位"
},
"layout": {
"row": 1
}
}
,
{
"id": "id744256811959324702",
"type": "fx-text",
"props": {
"label": "所属项目",
"type": "text",
"dataset": "ds_182a5ea30e9",
"field": "id_182a5ea30f5",
"required": "",
"placeholder": "请输入所属项目",
"labelWidth": 100,
"readonly": false,
"affixError": true
},
"events": {}
}
,{
"id": "id744256811959324703",
"type": "fx-placeholder",
"props": {
"label": "占位"
},
"layout": {
"row": 1
}
}
,
{
"id": "id744256811959324704",
"type": "fx-text",
"props": {
"label": "编码",
"type": "text",
"dataset": "ds_182a5ea30e9",
"field": "id_182a5ea30f6",
"required": "",
"maxlength": 32,
"placeholder": "请输入编码",
"labelWidth": 100,
"readonly": false,
"affixError": true
},
"events": {}
}
,{
"id": "id744256811959324705",
"type": "fx-placeholder",
"props": {
"label": "占位"
},
"layout": {
"row": 1
}
}
,
{
"id": "id744256811959324706",
"type": "fx-text",
"props": {
"label": "编码",
"type": "text",
"dataset": "ds_182a5ea30e9",
"field": "id_182a5ea30f7",
"required": "",
"maxlength": 100,
"placeholder": "请输入编码",
"labelWidth": 100,
"readonly": false,
"affixError": true
},
"events": {}
}
,{
"id": "id744256811959324707",
"type": "fx-placeholder",
"props": {
"label": "占位"
},
"layout": {
"row": 1
}
}
,
{
"id": "id744256811959324708",
"type": "fx-text",
"props": {
"label": "创建人",
"type": "text",
"dataset": "ds_182a5ea30e9",
"field": "id_182a5ea30f8",
"required": "",
"placeholder": "请输入创建人",
"labelWidth": 100,
"readonly": false,
"affixError": true
},
"events": {}
}
,{
"id": "id744256811959324709",
"type": "fx-placeholder",
"props": {
"label": "占位"
},
"layout": {
"row": 1
}
}
,
{
"id": "id744256811959324710",
"type": "fx-text",
"props": {
"label": "最后更新人",
"type": "text",
"dataset": "ds_182a5ea30e9",
"field": "id_182a5ea30f9",
"required": "",
"placeholder": "请输入最后更新人",
"labelWidth": 100,
"readonly": false,
"affixError": true
},
"events": {}
}
,{
"id": "id744256811959324711",
"type": "fx-placeholder",
"props": {
"label": "占位"
},
"layout": {
"row": 1
}
}
,
{
"id": "id744256811959324712",
"type": "fx-datetime",
"props": {
"label": "创建时间",
"type": "text",
"dataset": "ds_182a5ea30e9",
"field": "id_182a5ea30fa",
"required": "",
"placeholder": "请输入创建时间",
"labelWidth": 100,
"readonly": false,
"affixError": true
},
"events": {}
}
,{
"id": "id744256811959324713",
"type": "fx-placeholder",
"props": {
"label": "占位"
},
"layout": {
"row": 1
}
}
,
{
"id": "id744256811959324714",
"type": "fx-datetime",
"props": {
"label": "最后更新时间",
"type": "text",
"dataset": "ds_182a5ea30e9",
"field": "id_182a5ea30fb",
"required": "",
"placeholder": "请输入最后更新时间",
"labelWidth": 100,
"readonly": false,
"affixError": true
},
"events": {}
}
]
},
{
"id": "744256811959324715",
"type": "fx-form-panel",
"shape": "panel",
"props": {},
"children": []
}
]
},
{
"id": "744256811959324716",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "0"
},
"children": [
{
"id": "id744256811959324717",
"type": "fx-divider",
"props": {
"label": "",
"contentPosition": "center",
"direction": "horizontal"
}
}
]
},
{
"id": "744256811959324718",
"type": "fx-form-panel",
"shape": "panel",
"props": {
"size": "50",
"alignY": "center",
"paddingRight": 20
},
"children": [
{
"id": "id744256811959324719",
"type": "fx-button-group",
"props": {
"menus": [],
"textAlign": "right"
},
"slots": {
"default": [
{
"type": "fx-button",
"props": {
"label": "保存",
"leftIcon": "save",
"type": "success",
"action": "button:save",
},
"id": "id744256811959324720"
},
{
"type": "fx-button",
"props": {
"label": "关闭",
"leftIcon": "close",
"action": "button:closeDialog",
},
"id": "id744256811959324721"
}
]
}
}
]
}
]
}
}
],
"model": [
{
"dataset": "ds_182a5ea30e6",
"label": "主数据集",
"fields": [
{
"id": "id_182a5ea30fe",
"field": "mc_id" },
{
"id": "id_182a5ea30ff",
"field": "mc_parent_id" },
{
"id": "id_182a5ea3100",
"field": "mc_level_code" },
{
"id": "id_182a5ea3101",
"field": "mc_prj_id" },
{
"id": "id_182a5ea3102",
"field": "mc_code" },
{
"id": "id_182a5ea3103",
"field": "mc_name" },
{
"id": "id_182a5ea3104",
"field": "mc_create_uid" },
{
"id": "id_182a5ea3105",
"field": "mc_update_uid" },
{
"id": "id_182a5ea3106",
"field": "mc_create_at" },
{
"id": "id_182a5ea3107",
"field": "mc_update_at" }
],
"filters": [
]
},
{
"dataset": "ds_182a5ea30e9",
"label": "卡片数据集",
"fields": [
{
"id": "id_182a5ea30f1",
"field": "mc_id" },
{
"id": "id_182a5ea30f3",
"field": "mc_parent_id" },
{
"id": "id_182a5ea30f4",
"field": "mc_level_code" },
{
"id": "id_182a5ea30f5",
"field": "mc_prj_id" },
{
"id": "id_182a5ea30f6",
"field": "mc_code" },
{
"id": "id_182a5ea30f7",
"field": "mc_name" },
{
"id": "id_182a5ea30f8",
"field": "mc_create_uid" },
{
"id": "id_182a5ea30f9",
"field": "mc_update_uid" },
{
"id": "id_182a5ea30fa",
"field": "mc_create_at" },
{
"id": "id_182a5ea30fb",
"field": "mc_update_at" }
],
"filters": [
{
"id": "fid_182a5ea30f2",
"field": "id",
"required": false,
"type": "input"
}
]
}
},
"pageType": "list"
}
],
"option": {
"widgetRef": ["737684234579218432","736544100974596096"],
"vars": []
}
}

Cargando…
Cancelar
Guardar