@@ -52,37 +52,24 @@ public class ModelProcService extends AbstractCompService { | |||||
} | } | ||||
//加载工作流的列表字段 | //加载工作流的列表字段 | ||||
public R loadProcInstFields(@SwBody SwMap params, UserSession us) { | |||||
ModelTable table = ModelTableCache.getInstance().getByName(ProcInst.ENTITY_NAME); | |||||
if (table == null) return R.error("没有找到表定义信息(table=" + ProcInst.ENTITY_NAME + ")!"); | |||||
public R loadFlowListFields (@SwBody SwMap params, UserSession us) { | |||||
List<SwMap> ret = new ArrayList<>(); | List<SwMap> ret = new ArrayList<>(); | ||||
for (ModelField field : table.getFields()) { | |||||
SwMap col = new SwMap(2); | |||||
ModelFormHelper.buildFieldInfo(table, field, col); | |||||
ret.add(col); | |||||
} | |||||
SwMap col = new SwMap(); | |||||
col.put("name", "selTaskId"); | |||||
col.put("dataType", SwEnum.DataType.ID.value); | |||||
col.put("title", "选中的任务id"); | |||||
col.put("table", table.getId()); | |||||
col.put("table_text", table.getTitle()); | |||||
ret.add(col); | |||||
ModelFormHelper.buildTableFields(ret, ProcInst.ENTITY_NAME); | |||||
return R.success(ret); | |||||
} | |||||
public R loadFlowCardFields(@SwBody SwMap params, UserSession us) { | |||||
List<SwMap> ret = new ArrayList<>(); | |||||
ModelFormHelper.buildTableFields(ret, ProcInst.ENTITY_NAME); | |||||
ret.add(buildField("selTaskId", SwEnum.DataType.ID.value, "选中任务")); | |||||
return R.success(ret); | return R.success(ret); | ||||
} | } | ||||
//加载审批意见的列表字段 | //加载审批意见的列表字段 | ||||
public R loadCommentFields(@SwBody SwMap params, UserSession us) { | public R loadCommentFields(@SwBody SwMap params, UserSession us) { | ||||
ModelTable table = ModelTableCache.getInstance().getByName(Comment.ENTITY_NAME); | |||||
if (table == null) return R.error("没有找到表定义信息(table=" + Comment.ENTITY_NAME + ")!"); | |||||
List<SwMap> ret = new ArrayList<>(); | List<SwMap> ret = new ArrayList<>(); | ||||
for (ModelField field : table.getFields()) { | |||||
SwMap col = new SwMap(2); | |||||
ModelFormHelper.buildFieldInfo(table, field, col); | |||||
ret.add(col); | |||||
} | |||||
ModelFormHelper.buildTableFields(ret, Comment.ENTITY_NAME); | |||||
ret.add(buildField("cmt_act_code", SwEnum.DataType.CODE.value, "活动编号")); | ret.add(buildField("cmt_act_code", SwEnum.DataType.CODE.value, "活动编号")); | ||||
ret.add(buildField("cmt_act_text", SwEnum.DataType.NAME.value, "活动名称")); | ret.add(buildField("cmt_act_text", SwEnum.DataType.NAME.value, "活动名称")); | ||||
return R.success(ret); | return R.success(ret); | ||||
@@ -1,11 +1,13 @@ | |||||
package cc.smtweb.system.bpm.web.design.form; | package cc.smtweb.system.bpm.web.design.form; | ||||
import cc.smtweb.framework.core.common.R; | |||||
import cc.smtweb.framework.core.common.SwEnum; | import cc.smtweb.framework.core.common.SwEnum; | ||||
import cc.smtweb.framework.core.common.SwMap; | import cc.smtweb.framework.core.common.SwMap; | ||||
import cc.smtweb.framework.core.db.cache.ModelTableCache; | import cc.smtweb.framework.core.db.cache.ModelTableCache; | ||||
import cc.smtweb.framework.core.db.vo.ModelField; | import cc.smtweb.framework.core.db.vo.ModelField; | ||||
import cc.smtweb.framework.core.db.vo.ModelTable; | import cc.smtweb.framework.core.db.vo.ModelTable; | ||||
import cc.smtweb.framework.core.exception.BizException; | import cc.smtweb.framework.core.exception.BizException; | ||||
import cc.smtweb.framework.core.exception.SwException; | |||||
import cc.smtweb.framework.core.mvc.variable.SwVariableFactory; | import cc.smtweb.framework.core.mvc.variable.SwVariableFactory; | ||||
import cc.smtweb.framework.core.session.UserSession; | import cc.smtweb.framework.core.session.UserSession; | ||||
import cc.smtweb.framework.core.util.JsonUtil; | import cc.smtweb.framework.core.util.JsonUtil; | ||||
@@ -18,6 +20,7 @@ import cc.smtweb.system.bpm.util.IdeaUtil; | |||||
import cc.smtweb.system.bpm.web.design.db.ModelCatalogCache; | import cc.smtweb.system.bpm.web.design.db.ModelCatalogCache; | ||||
import cc.smtweb.system.bpm.web.design.db.ModelProjectCache; | import cc.smtweb.system.bpm.web.design.db.ModelProjectCache; | ||||
import cc.smtweb.system.bpm.web.design.form.define.*; | import cc.smtweb.system.bpm.web.design.form.define.*; | ||||
import cc.smtweb.system.bpm.web.engine.flow.entity.Comment; | |||||
import com.fasterxml.jackson.core.JsonProcessingException; | import com.fasterxml.jackson.core.JsonProcessingException; | ||||
import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
@@ -513,6 +516,17 @@ public class ModelFormHelper { | |||||
} | } | ||||
} | } | ||||
public static void buildTableFields(List<SwMap> ret, String tableName) { | |||||
ModelTable table = ModelTableCache.getInstance().getByName(tableName); | |||||
if (table == null) throw new SwException("没有找到表定义信息(table=" + tableName + ")!"); | |||||
for (ModelField field : table.getFields()) { | |||||
SwMap col = new SwMap(2); | |||||
ModelFormHelper.buildFieldInfo(table, field, col); | |||||
ret.add(col); | |||||
} | |||||
} | |||||
/** | /** | ||||
* 页面设计时,返回的字段信息,带控件 | * 页面设计时,返回的字段信息,带控件 | ||||
* | * | ||||