OA增加节点按钮管理
This commit is contained in:
parent
b972e6d172
commit
9b948b4b5a
@ -44,15 +44,15 @@ public class ActivitiModelController extends DefaultBaseController {
|
||||
@ApiImplicitParam(name = "modelId", value = "模型ID", paramType = "path")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@PutMapping("save/{modelId}")
|
||||
public SuccessResult saveModel(@PathVariable String modelId, @RequestBody ActivitiModelVO activitiModelVO) throws Exception {
|
||||
@PutMapping("save/{modelId}/version/{modelVersion}")
|
||||
public SuccessResult saveModel(@PathVariable String modelId, @PathVariable("modelVersion") Integer modelVersion, @RequestBody ActivitiModelVO activitiModelVO) throws Exception {
|
||||
if (StringUtils.isBlank(activitiModelVO.getName())) {
|
||||
throw new ParamsException("流程名称不能为空");
|
||||
}
|
||||
if(StringUtils.isBlank(activitiModelVO.getDescription())) {
|
||||
throw new ParamsException("流程描述不能为空");
|
||||
}
|
||||
activitiModelService.save(modelId, activitiModelVO);
|
||||
activitiModelService.save(modelId, modelVersion, activitiModelVO);
|
||||
return new SuccessResult();
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,56 @@
|
||||
package ink.wgink.module.activiti.dao.oa;
|
||||
|
||||
import ink.wgink.exceptions.RemoveException;
|
||||
import ink.wgink.exceptions.SaveException;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.exceptions.UpdateException;
|
||||
import ink.wgink.interfaces.init.IInitBaseTable;
|
||||
import ink.wgink.module.activiti.pojo.dtos.oa.NodeButtonDTO;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: INodeButtonDao
|
||||
* @Description: 节点按钮
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/4/27 11:00
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Repository
|
||||
public interface INodeButtonDao extends IInitBaseTable {
|
||||
|
||||
/**
|
||||
* 新增配置
|
||||
*
|
||||
* @param params
|
||||
* @throws SaveException
|
||||
*/
|
||||
void save(Map<String, Object> params) throws SaveException;
|
||||
|
||||
/**
|
||||
* 删除配置
|
||||
*
|
||||
* @param params
|
||||
* @throws RemoveException
|
||||
*/
|
||||
void delete(Map<String, Object> params) throws RemoveException;
|
||||
|
||||
/**
|
||||
* 更新部署ID
|
||||
*
|
||||
* @param params
|
||||
* @throws UpdateException
|
||||
*/
|
||||
void updateDeploymentId(Map<String, Object> params) throws UpdateException;
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
NodeButtonDTO get(Map<String, Object> params) throws SearchException;
|
||||
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package ink.wgink.module.activiti.pojo.dtos.oa;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* @Description: 节点字段
|
||||
* @Author: WenG
|
||||
* @Date: 2022/3/19 11:05
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@ApiModel
|
||||
public class NodeButtonDTO {
|
||||
|
||||
@ApiModelProperty(name = "nodeButtonId", value = "主键")
|
||||
private String nodeButtonId;
|
||||
@ApiModelProperty(name = "formId", value = "表单ID")
|
||||
private String formId;
|
||||
@ApiModelProperty(name = "deploymentId", value = "部署ID")
|
||||
private String deploymentId;
|
||||
@ApiModelProperty(name = "nodeIndex", value = "节点下标")
|
||||
private String nodeIndex;
|
||||
@ApiModelProperty(name = "nodeId", value = "节点ID")
|
||||
private String nodeId;
|
||||
@ApiModelProperty(name = "btnAttachment", value = "上传附件")
|
||||
private Integer btnAttachment;
|
||||
@ApiModelProperty(name = "btnGoBack", value = "回退")
|
||||
private Integer btnGoBack;
|
||||
|
||||
public String getNodeButtonId() {
|
||||
return nodeButtonId == null ? "" : nodeButtonId.trim();
|
||||
}
|
||||
|
||||
public void setNodeButtonId(String nodeButtonId) {
|
||||
this.nodeButtonId = nodeButtonId;
|
||||
}
|
||||
|
||||
public String getFormId() {
|
||||
return formId == null ? "" : formId.trim();
|
||||
}
|
||||
|
||||
public void setFormId(String formId) {
|
||||
this.formId = formId;
|
||||
}
|
||||
|
||||
public String getDeploymentId() {
|
||||
return deploymentId == null ? "" : deploymentId.trim();
|
||||
}
|
||||
|
||||
public void setDeploymentId(String deploymentId) {
|
||||
this.deploymentId = deploymentId;
|
||||
}
|
||||
|
||||
public String getNodeIndex() {
|
||||
return nodeIndex == null ? "" : nodeIndex.trim();
|
||||
}
|
||||
|
||||
public void setNodeIndex(String nodeIndex) {
|
||||
this.nodeIndex = nodeIndex;
|
||||
}
|
||||
|
||||
public String getNodeId() {
|
||||
return nodeId == null ? "" : nodeId.trim();
|
||||
}
|
||||
|
||||
public void setNodeId(String nodeId) {
|
||||
this.nodeId = nodeId;
|
||||
}
|
||||
|
||||
public Integer getBtnAttachment() {
|
||||
return btnAttachment == null ? 0 : btnAttachment;
|
||||
}
|
||||
|
||||
public void setBtnAttachment(Integer btnAttachment) {
|
||||
this.btnAttachment = btnAttachment;
|
||||
}
|
||||
|
||||
public Integer getBtnGoBack() {
|
||||
return btnGoBack == null ? 0 : btnGoBack;
|
||||
}
|
||||
|
||||
public void setBtnGoBack(Integer btnGoBack) {
|
||||
this.btnGoBack = btnGoBack;
|
||||
}
|
||||
}
|
@ -30,6 +30,8 @@ public class NodeFieldDTO {
|
||||
private Integer isEditable;
|
||||
@ApiModelProperty(name = "editHistory", value = "编辑历史")
|
||||
private String editHistory;
|
||||
@ApiModelProperty(name = "autoBackFill", value = "自动回填")
|
||||
private String autoBackFill;
|
||||
|
||||
public String getNodeFieldId() {
|
||||
return nodeFieldId;
|
||||
@ -102,4 +104,12 @@ public class NodeFieldDTO {
|
||||
public void setEditHistory(String editHistory) {
|
||||
this.editHistory = editHistory;
|
||||
}
|
||||
|
||||
public String getAutoBackFill() {
|
||||
return autoBackFill == null ? "" : autoBackFill.trim();
|
||||
}
|
||||
|
||||
public void setAutoBackFill(String autoBackFill) {
|
||||
this.autoBackFill = autoBackFill;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package ink.wgink.module.activiti.pojo.vos.oa.nodemanage;
|
||||
|
||||
import ink.wgink.module.activiti.pojo.vos.oa.nodemanage.config.AssigneeVO;
|
||||
import ink.wgink.module.activiti.pojo.vos.oa.nodemanage.config.NodeFormButtonVO;
|
||||
import ink.wgink.module.activiti.pojo.vos.oa.nodemanage.config.NodeFormFieldVO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@ -23,6 +24,8 @@ public class ConfigVO {
|
||||
private AssigneeVO assignee;
|
||||
@ApiModelProperty(name = "formFields", value = "表单字段列表")
|
||||
private List<NodeFormFieldVO> formFields;
|
||||
@ApiModelProperty(name = "formButton", value = "表单按钮")
|
||||
private NodeFormButtonVO formButton;
|
||||
|
||||
public String getFormId() {
|
||||
return formId == null ? "" : formId.trim();
|
||||
@ -48,6 +51,14 @@ public class ConfigVO {
|
||||
this.formFields = formFields;
|
||||
}
|
||||
|
||||
public NodeFormButtonVO getFormButton() {
|
||||
return formButton;
|
||||
}
|
||||
|
||||
public void setFormButton(NodeFormButtonVO formButton) {
|
||||
this.formButton = formButton;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
@ -57,6 +68,8 @@ public class ConfigVO {
|
||||
.append(assignee);
|
||||
sb.append(",\"formFields\":")
|
||||
.append(formFields);
|
||||
sb.append(",\"formButton\":")
|
||||
.append(formButton);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -0,0 +1,35 @@
|
||||
package ink.wgink.module.activiti.pojo.vos.oa.nodemanage.config;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* @Description: 按钮与流程节点
|
||||
* @Author: WenG
|
||||
* @Date: 2022/3/17 19:51
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@ApiModel
|
||||
public class NodeFormButtonVO {
|
||||
|
||||
@ApiModelProperty(name = "btnAttachment", value = "附件上传按钮")
|
||||
private Integer btnAttachment;
|
||||
@ApiModelProperty(name = "btnGoBack", value = "回退按钮")
|
||||
private Integer btnGoBack;
|
||||
|
||||
public Integer getBtnAttachment() {
|
||||
return btnAttachment == null ? 0 : btnAttachment;
|
||||
}
|
||||
|
||||
public void setBtnAttachment(Integer btnAttachment) {
|
||||
this.btnAttachment = btnAttachment;
|
||||
}
|
||||
|
||||
public Integer getBtnGoBack() {
|
||||
return btnGoBack == null ? 0 : btnGoBack;
|
||||
}
|
||||
|
||||
public void setBtnGoBack(Integer btnGoBack) {
|
||||
this.btnGoBack = btnGoBack;
|
||||
}
|
||||
}
|
@ -29,6 +29,8 @@ public class NodeFormFieldVO {
|
||||
private Boolean isVisible;
|
||||
@ApiModelProperty(name = "editHistory", value = "编辑历史")
|
||||
private String editHistory;
|
||||
@ApiModelProperty(name = "autoFillBack", value = "自动填充")
|
||||
private String autoFillBack;
|
||||
|
||||
public String getFieldId() {
|
||||
return fieldId == null ? "" : fieldId.trim();
|
||||
@ -94,6 +96,14 @@ public class NodeFormFieldVO {
|
||||
this.editHistory = editHistory;
|
||||
}
|
||||
|
||||
public String getAutoFillBack() {
|
||||
return autoFillBack == null ? "" : autoFillBack.trim();
|
||||
}
|
||||
|
||||
public void setAutoFillBack(String autoFillBack) {
|
||||
this.autoFillBack = autoFillBack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("{");
|
||||
@ -113,6 +123,8 @@ public class NodeFormFieldVO {
|
||||
.append(isVisible);
|
||||
sb.append(",\"editHistory\":\"")
|
||||
.append(editHistory).append('\"');
|
||||
sb.append(",\"autoFillBack\":\"")
|
||||
.append(autoFillBack).append('\"');
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
|
@ -0,0 +1,42 @@
|
||||
package ink.wgink.module.activiti.pojo.vos.oa.page;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: FieldControlVO
|
||||
* @Description: 字段
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/4/20 14:59
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class FormButtonVO {
|
||||
|
||||
private Integer btnAttachment;
|
||||
private Integer btnGoBack;
|
||||
private List<GoBackUserTaskVO> goBackUserTasks;
|
||||
|
||||
public Integer getBtnAttachment() {
|
||||
return btnAttachment == null ? 0 : btnAttachment;
|
||||
}
|
||||
|
||||
public void setBtnAttachment(Integer btnAttachment) {
|
||||
this.btnAttachment = btnAttachment;
|
||||
}
|
||||
|
||||
public Integer getBtnGoBack() {
|
||||
return btnGoBack == null ? 0 : btnGoBack;
|
||||
}
|
||||
|
||||
public void setBtnGoBack(Integer btnGoBack) {
|
||||
this.btnGoBack = btnGoBack;
|
||||
}
|
||||
|
||||
public List<GoBackUserTaskVO> getGoBackUserTasks() {
|
||||
return goBackUserTasks == null ? new ArrayList() : goBackUserTasks;
|
||||
}
|
||||
|
||||
public void setGoBackUserTasks(List<GoBackUserTaskVO> goBackUserTasks) {
|
||||
this.goBackUserTasks = goBackUserTasks;
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package ink.wgink.module.activiti.pojo.vos.oa.page;
|
||||
|
||||
/**
|
||||
* @ClassName: GoBackUserTaskVO
|
||||
* @Description: 回退用户任务
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/4/27 17:21
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class GoBackUserTaskVO {
|
||||
|
||||
private String taskId;
|
||||
private String nodeId;
|
||||
private String taskName;
|
||||
private String userId;
|
||||
private String userName;
|
||||
|
||||
public String getTaskId() {
|
||||
return taskId == null ? "" : taskId.trim();
|
||||
}
|
||||
|
||||
public void setTaskId(String taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
public String getNodeId() {
|
||||
return nodeId == null ? "" : nodeId.trim();
|
||||
}
|
||||
|
||||
public void setNodeId(String nodeId) {
|
||||
this.nodeId = nodeId;
|
||||
}
|
||||
|
||||
public String getTaskName() {
|
||||
return taskName == null ? "" : taskName.trim();
|
||||
}
|
||||
|
||||
public void setTaskName(String taskName) {
|
||||
this.taskName = taskName;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId == null ? "" : userId.trim();
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName == null ? "" : userName.trim();
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
}
|
@ -64,10 +64,11 @@ public interface IActivitiModelService {
|
||||
* 保存模型
|
||||
*
|
||||
* @param modelId
|
||||
* @param modelVersion
|
||||
* @param activitiModelVO
|
||||
* @throws Exception
|
||||
*/
|
||||
void save(String modelId, ActivitiModelVO activitiModelVO) throws Exception;
|
||||
void save(String modelId, Integer modelVersion, ActivitiModelVO activitiModelVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 删除模型
|
||||
|
@ -60,19 +60,22 @@ public class ActivitiModelServiceImpl extends DefaultBaseService implements IAct
|
||||
private INodeManageService nodeManageService;
|
||||
|
||||
@Override
|
||||
public void save(String modelId, ActivitiModelVO activitiModelVO) throws Exception {
|
||||
public void save(String modelId, Integer modelVersion, ActivitiModelVO activitiModelVO) throws Exception {
|
||||
Model model = repositoryService.getModel(modelId);
|
||||
if (model == null) {
|
||||
throw new SearchException("模型不存在");
|
||||
}
|
||||
String deploymentId = model.getDeploymentId();
|
||||
Integer modelVersion;
|
||||
if (!StringUtils.isBlank(deploymentId)) {
|
||||
LOG.debug("已经部署,版本号递增");
|
||||
modelVersion = model.getVersion() + 1;
|
||||
String deploymentId = null;
|
||||
Integer existModelVersion = model.getVersion();
|
||||
Integer newModelVersion;
|
||||
// 版本相同的模型,如果已经部署,创建新版本;如果没有部署,版本号不变
|
||||
if (modelVersion.equals(existModelVersion) && !StringUtils.isBlank(model.getDeploymentId())) {
|
||||
LOG.debug("最新版本已经部署,版本号递增");
|
||||
newModelVersion = model.getVersion() + 1;
|
||||
deploymentId = model.getDeploymentId();
|
||||
} else {
|
||||
LOG.debug("未部署,版本号不变");
|
||||
modelVersion = model.getVersion();
|
||||
LOG.debug("最新版本未部署,版本号不变");
|
||||
newModelVersion = model.getVersion();
|
||||
}
|
||||
|
||||
JSONObject modelObject = JSONObject.parseObject(model.getMetaInfo());
|
||||
@ -80,7 +83,7 @@ public class ActivitiModelServiceImpl extends DefaultBaseService implements IAct
|
||||
modelObject.put(MODEL_DESCRIPTION, activitiModelVO.getDescription());
|
||||
model.setMetaInfo(modelObject.toString());
|
||||
model.setName(activitiModelVO.getName());
|
||||
model.setVersion(modelVersion);
|
||||
model.setVersion(newModelVersion);
|
||||
repositoryService.saveModel(model);
|
||||
repositoryService.addModelEditorSource(model.getId(), activitiModelVO.getJsonXml().getBytes(ISystemConstant.CHARSET_UTF8));
|
||||
|
||||
@ -99,7 +102,7 @@ public class ActivitiModelServiceImpl extends DefaultBaseService implements IAct
|
||||
outStream.close();
|
||||
|
||||
LOG.debug("保存节点配置");
|
||||
nodeManageService.save(activitiModelVO, modelId, modelVersion, deploymentId);
|
||||
nodeManageService.save(activitiModelVO, modelId, newModelVersion, deploymentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -322,6 +325,7 @@ public class ActivitiModelServiceImpl extends DefaultBaseService implements IAct
|
||||
result.put(MODEL_NAME, model.getName());
|
||||
}
|
||||
result.put(MODEL_ID, model.getId());
|
||||
result.put("modelVersion", model.getVersion());
|
||||
String readTree = new String(repositoryService.getModelEditorSource(model.getId()), ISystemConstant.CHARSET_UTF8);
|
||||
JSONObject editorJson = JSONObject.parseObject(readTree);
|
||||
result.put("model", editorJson);
|
||||
|
@ -12,6 +12,7 @@ import ink.wgink.module.activiti.pojo.vos.ActivitiVO;
|
||||
import ink.wgink.module.activiti.service.activiti.IActivitiModelService;
|
||||
import ink.wgink.module.activiti.service.activiti.IActivitiService;
|
||||
import ink.wgink.module.activiti.service.oa.INodeAssigneeService;
|
||||
import ink.wgink.module.activiti.service.oa.INodeButtonService;
|
||||
import ink.wgink.module.activiti.service.oa.INodeFieldService;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.util.date.DateUtil;
|
||||
@ -55,6 +56,8 @@ public class ActivitiServiceImpl extends DefaultBaseService implements IActiviti
|
||||
private INodeAssigneeService nodeAssigneeService;
|
||||
@Autowired
|
||||
private INodeFieldService nodeFieldService;
|
||||
@Autowired
|
||||
private INodeButtonService nodeButtonService;
|
||||
|
||||
@Override
|
||||
public String create(ActivitiVO activitiVO) throws UnsupportedEncodingException {
|
||||
@ -102,6 +105,8 @@ public class ActivitiServiceImpl extends DefaultBaseService implements IActiviti
|
||||
nodeAssigneeService.updateDeploymentId(modelId, model.getVersion(), deploymentId);
|
||||
LOG.debug("3.绑定节点表单字段");
|
||||
nodeFieldService.updateDeploymentId(modelId, model.getVersion(), deploymentId);
|
||||
LOG.debug("4.绑定节点按钮");
|
||||
nodeButtonService.updateDeploymentId(modelId, model.getVersion(), deploymentId);
|
||||
} else {
|
||||
LOG.debug("不存在自定义表单,不是OA流程,直接部署");
|
||||
deploymentId = deployProcess(model, bpmnModel);
|
||||
|
@ -0,0 +1,55 @@
|
||||
package ink.wgink.module.activiti.service.oa;
|
||||
|
||||
import ink.wgink.module.activiti.pojo.dtos.oa.NodeButtonDTO;
|
||||
import ink.wgink.module.activiti.pojo.vos.oa.nodemanage.config.NodeFormButtonVO;
|
||||
|
||||
/**
|
||||
* @ClassName: INodeButtonService
|
||||
* @Description: 节点按钮
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/4/27 11:38
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public interface INodeButtonService {
|
||||
|
||||
/**
|
||||
* 保存节点按钮
|
||||
*
|
||||
* @param modelId
|
||||
* @param modelVersion
|
||||
* @param nodeId
|
||||
* @param nodeIndex
|
||||
* @param formId
|
||||
* @param nodeButton
|
||||
*/
|
||||
void save(String modelId, Integer modelVersion, String nodeId, int nodeIndex, String formId, NodeFormButtonVO nodeButton);
|
||||
|
||||
/**
|
||||
* 更新节点按钮
|
||||
*
|
||||
* @param modelId
|
||||
* @param modelVersion
|
||||
* @param nodeId
|
||||
* @param nodeIndex
|
||||
* @param formId
|
||||
* @param nodeButton
|
||||
*/
|
||||
void update(String modelId, Integer modelVersion, String nodeId, int nodeIndex, String formId, NodeFormButtonVO nodeButton);
|
||||
|
||||
/**
|
||||
* 更新部署ID
|
||||
*
|
||||
* @param modelId
|
||||
* @param modelVersion
|
||||
* @param deploymentId
|
||||
*/
|
||||
void updateDeploymentId(String modelId, Integer modelVersion, String deploymentId);
|
||||
|
||||
/**
|
||||
* @param deploymentId
|
||||
* @param nodeId
|
||||
* @return
|
||||
*/
|
||||
NodeButtonDTO getByDeploymentIdAndNodeId(String deploymentId, String nodeId);
|
||||
|
||||
}
|
@ -24,6 +24,7 @@ public interface IOaFormReportService {
|
||||
String KEY_SELECT_TYPE = "selectType";
|
||||
String KEY_IS_NEXT_END_EVENT = "isNextEndEvent";
|
||||
String KEY_RECORD_FIELDS = "recordFields";
|
||||
String KEY_ASSIGNEE_USER_NAME = "assigneeUserName";
|
||||
/**
|
||||
* 编辑记录分隔符
|
||||
*/
|
||||
|
@ -0,0 +1,80 @@
|
||||
package ink.wgink.module.activiti.service.oa.impl;
|
||||
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.module.activiti.dao.oa.INodeButtonDao;
|
||||
import ink.wgink.module.activiti.pojo.dtos.oa.NodeButtonDTO;
|
||||
import ink.wgink.module.activiti.pojo.vos.oa.nodemanage.config.NodeFormButtonVO;
|
||||
import ink.wgink.module.activiti.service.oa.INodeButtonService;
|
||||
import ink.wgink.util.UUIDUtil;
|
||||
import ink.wgink.util.map.HashMapUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: NodeButtonServiceImpl
|
||||
* @Description: 节点按钮
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/4/27 11:39
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Service
|
||||
public class NodeButtonServiceImpl extends DefaultBaseService implements INodeButtonService {
|
||||
|
||||
@Autowired
|
||||
private INodeButtonDao nodeButtonDao;
|
||||
|
||||
@Override
|
||||
public void save(String modelId, Integer modelVersion, String nodeId, int nodeIndex, String formId, NodeFormButtonVO nodeButton) {
|
||||
Map<String, Object> params = HashMapUtil.beanToMap(nodeButton);
|
||||
params.put("nodeButtonId", UUIDUtil.getUUID());
|
||||
params.put("modelId", modelId);
|
||||
params.put("modelVersion", modelVersion);
|
||||
params.put("nodeId", nodeId);
|
||||
params.put("nodeIndex", nodeIndex);
|
||||
params.put("formId", formId);
|
||||
nodeButtonDao.save(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(String modelId, Integer modelVersion, String nodeId, int nodeIndex, String formId, NodeFormButtonVO nodeButton) {
|
||||
delete(modelId, modelVersion, nodeId, formId);
|
||||
save(modelId, modelVersion, nodeId, nodeIndex, formId, nodeButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDeploymentId(String modelId, Integer modelVersion, String deploymentId) {
|
||||
Map<String, Object> params = getHashMap(6);
|
||||
params.put("modelId", modelId);
|
||||
params.put("modelVersion", modelVersion);
|
||||
params.put("deploymentId", deploymentId);
|
||||
nodeButtonDao.updateDeploymentId(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NodeButtonDTO getByDeploymentIdAndNodeId(String deploymentId, String nodeId) {
|
||||
Map<String, Object> params = getHashMap(4);
|
||||
params.put("deploymentId", deploymentId);
|
||||
params.put("nodeId", nodeId);
|
||||
return nodeButtonDao.get(params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param modelId 模型ID
|
||||
* @param modelVersion 模型版本
|
||||
* @param nodeId 节点ID
|
||||
* @param formId 表单ID
|
||||
*/
|
||||
private void delete(String modelId, Integer modelVersion, String nodeId, String formId) {
|
||||
LOG.debug("删除原有按钮配置");
|
||||
Map<String, Object> params = getHashMap(6);
|
||||
params.put("modelId", modelId);
|
||||
params.put("modelVersion", modelVersion);
|
||||
params.put("nodeId", nodeId);
|
||||
params.put("formId", formId);
|
||||
nodeButtonDao.delete(params);
|
||||
}
|
||||
}
|
@ -6,8 +6,9 @@ import ink.wgink.module.activiti.pojo.vos.oa.nodemanage.OaNodeManageVO;
|
||||
import ink.wgink.module.activiti.pojo.vos.oa.nodemanage.config.AssigneeVO;
|
||||
import ink.wgink.module.activiti.pojo.vos.oa.nodemanage.config.NodeFormFieldVO;
|
||||
import ink.wgink.module.activiti.service.oa.INodeAssigneeService;
|
||||
import ink.wgink.module.activiti.service.oa.INodeManageService;
|
||||
import ink.wgink.module.activiti.service.oa.INodeButtonService;
|
||||
import ink.wgink.module.activiti.service.oa.INodeFieldService;
|
||||
import ink.wgink.module.activiti.service.oa.INodeManageService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -28,6 +29,8 @@ public class NodeManageServiceImpl extends DefaultBaseService implements INodeMa
|
||||
private INodeAssigneeService nodeAssigneeService;
|
||||
@Autowired
|
||||
private INodeFieldService nodeFieldService;
|
||||
@Autowired
|
||||
private INodeButtonService nodeButtonService;
|
||||
|
||||
@Override
|
||||
public void save(ActivitiModelVO activitiModelVO, String modelId, Integer modelVersion, String deploymentId) {
|
||||
@ -47,6 +50,8 @@ public class NodeManageServiceImpl extends DefaultBaseService implements INodeMa
|
||||
nodeAssigneeService.save(modelId, modelVersion, nodeId, i, assignee);
|
||||
// 保存节点与表单字段配置
|
||||
nodeFieldService.save(modelId, modelVersion, nodeId, i, formId, formFields);
|
||||
// 保存节点按钮
|
||||
nodeButtonService.save(modelId, modelVersion, nodeId, i, formId, oaNodeManageVO.getConfig().getFormButton());
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < oaNodeManages.size(); i++) {
|
||||
@ -59,6 +64,8 @@ public class NodeManageServiceImpl extends DefaultBaseService implements INodeMa
|
||||
nodeAssigneeService.update(modelId, modelVersion, nodeId, i, assignee);
|
||||
// 保存节点与表单字段配置
|
||||
nodeFieldService.update(modelId, modelVersion, nodeId, i, formId, formFields);
|
||||
// 保存节点按钮
|
||||
nodeButtonService.update(modelId, modelVersion, nodeId, i, formId, oaNodeManageVO.getConfig().getFormButton());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,14 +5,15 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.interfaces.user.IUserBaseService;
|
||||
import ink.wgink.module.activiti.pojo.dtos.oa.NodeButtonDTO;
|
||||
import ink.wgink.module.activiti.pojo.dtos.oa.NodeFieldDTO;
|
||||
import ink.wgink.module.activiti.pojo.pos.oa.OaNodeAssigneePO;
|
||||
import ink.wgink.module.activiti.pojo.vos.oa.page.FormButtonVO;
|
||||
import ink.wgink.module.activiti.pojo.vos.oa.page.ConfirmAssigneeVO;
|
||||
import ink.wgink.module.activiti.pojo.vos.oa.page.FieldVO;
|
||||
import ink.wgink.module.activiti.pojo.vos.oa.page.GoBackUserTaskVO;
|
||||
import ink.wgink.module.activiti.service.activiti.IActivitiModelService;
|
||||
import ink.wgink.module.activiti.service.oa.INodeAssigneeService;
|
||||
import ink.wgink.module.activiti.service.oa.INodeFieldService;
|
||||
import ink.wgink.module.activiti.service.oa.IOaFormReportRouteService;
|
||||
import ink.wgink.module.activiti.service.oa.*;
|
||||
import ink.wgink.module.form.enums.design.FormTypeEnum;
|
||||
import ink.wgink.module.form.service.design.IFormFieldService;
|
||||
import ink.wgink.module.form.service.report.IFormReportRouteService;
|
||||
@ -20,8 +21,10 @@ import ink.wgink.pojo.dtos.user.UserDTO;
|
||||
import org.activiti.bpmn.model.FlowNode;
|
||||
import org.activiti.bpmn.model.SequenceFlow;
|
||||
import org.activiti.bpmn.model.UserTask;
|
||||
import org.activiti.engine.HistoryService;
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.activiti.engine.TaskService;
|
||||
import org.activiti.engine.history.HistoricTaskInstance;
|
||||
import org.activiti.engine.repository.ProcessDefinition;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -52,6 +55,8 @@ public class OaFormReportRouteServiceImpl extends DefaultBaseService implements
|
||||
@Autowired
|
||||
private RepositoryService repositoryService;
|
||||
@Autowired
|
||||
private HistoryService historyService;
|
||||
@Autowired
|
||||
private IFormReportRouteService formReportRouteService;
|
||||
@Autowired
|
||||
private IUserBaseService userBaseService;
|
||||
@ -63,6 +68,8 @@ public class OaFormReportRouteServiceImpl extends DefaultBaseService implements
|
||||
private IFormFieldService formFieldService;
|
||||
@Autowired
|
||||
private INodeFieldService nodeFieldService;
|
||||
@Autowired
|
||||
private INodeButtonService nodeButtonService;
|
||||
|
||||
@Override
|
||||
public void save(String processDefinitionId, String formCode, Integer formVersion, HttpSession httpSession, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
|
||||
@ -81,9 +88,11 @@ public class OaFormReportRouteServiceImpl extends DefaultBaseService implements
|
||||
model.put("confirmAssignees", JSON.toJSONString(confirmAssigneeVOs));
|
||||
|
||||
setPageFields(deploymentId, firstUserTask, model);
|
||||
setPageFormButtonsAndHistoryUserTasks(deploymentId, null, firstUserTask, model);
|
||||
formReportRouteService.save(formCode, formVersion, httpSession, httpServletRequest, httpServletResponse, model);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void update(String taskId, String formCode, Integer formVersion, Integer isNeedClaim, HttpSession httpSession, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
|
||||
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
|
||||
@ -109,6 +118,7 @@ public class OaFormReportRouteServiceImpl extends DefaultBaseService implements
|
||||
model.put("confirmAssignees", JSON.toJSONString(confirmAssigneeVOs));
|
||||
|
||||
setPageFields(deploymentId, currentUserTask, model);
|
||||
setPageFormButtonsAndHistoryUserTasks(deploymentId, null, currentUserTask, model);
|
||||
// 设置代理人
|
||||
formReportRouteService.update(formCode, formVersion, httpSession, httpServletRequest, httpServletResponse, model);
|
||||
}
|
||||
@ -161,6 +171,60 @@ public class OaFormReportRouteServiceImpl extends DefaultBaseService implements
|
||||
model.put("fields", JSONObject.toJSONString(fieldVOs));
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置页面按钮与历史任务,如果没有回退按钮,不设置回退
|
||||
*
|
||||
* @param deploymentId
|
||||
* @param userTask
|
||||
* @param model
|
||||
*/
|
||||
private void setPageFormButtonsAndHistoryUserTasks(String deploymentId, String currentTaskId, UserTask userTask, Map<String, Object> model) {
|
||||
NodeButtonDTO nodeButtonDTO = nodeButtonService.getByDeploymentIdAndNodeId(deploymentId, userTask.getId());
|
||||
FormButtonVO formButtonVO = new FormButtonVO();
|
||||
if (nodeButtonDTO == null) {
|
||||
model.put("formButton", JSONObject.toJSONString(formButtonVO));
|
||||
return;
|
||||
}
|
||||
formButtonVO.setBtnAttachment(nodeButtonDTO.getBtnAttachment());
|
||||
if (StringUtils.isBlank(currentTaskId)) {
|
||||
formButtonVO.setBtnGoBack(0);
|
||||
} else {
|
||||
formButtonVO.setBtnGoBack(nodeButtonDTO.getBtnGoBack());
|
||||
}
|
||||
if (nodeButtonDTO.getBtnGoBack() == 1) {
|
||||
LOG.debug("存在回退按钮,查询历史节点");
|
||||
List<HistoricTaskInstance> historicTaskInstances = historyService.createHistoricTaskInstanceQuery()
|
||||
.includeTaskLocalVariables()
|
||||
.taskId(currentTaskId)
|
||||
.finished()
|
||||
.orderByHistoricTaskInstanceEndTime()
|
||||
.asc()
|
||||
.list();
|
||||
List<GoBackUserTaskVO> goBackUserTaskVOs = historicTaskInstances.stream().map(historicTaskInstance -> {
|
||||
String assigneeUserId = historicTaskInstance.getAssignee();
|
||||
Map<String, Object> localVariables = historicTaskInstance.getTaskLocalVariables();
|
||||
Object assigneeUserNameObject = localVariables.get(IOaFormReportService.KEY_ASSIGNEE_USER_NAME);
|
||||
String assigneeUserName = localVariables.get(IOaFormReportService.KEY_ASSIGNEE_USER_NAME).toString();
|
||||
if (assigneeUserNameObject != null) {
|
||||
assigneeUserName = assigneeUserNameObject.toString();
|
||||
}
|
||||
String nodeId = historicTaskInstance.getTaskDefinitionKey();
|
||||
String taskId = historicTaskInstance.getId();
|
||||
String taskName = historicTaskInstance.getName();
|
||||
|
||||
GoBackUserTaskVO goBackUserTaskVO = new GoBackUserTaskVO();
|
||||
goBackUserTaskVO.setTaskId(taskId);
|
||||
goBackUserTaskVO.setNodeId(nodeId);
|
||||
goBackUserTaskVO.setTaskName(taskName);
|
||||
goBackUserTaskVO.setUserId(assigneeUserId);
|
||||
goBackUserTaskVO.setUserName(assigneeUserName);
|
||||
return goBackUserTaskVO;
|
||||
}).collect(Collectors.toList());
|
||||
formButtonVO.setGoBackUserTasks(goBackUserTaskVOs);
|
||||
}
|
||||
model.put("formButton", JSONObject.toJSONString(formButtonVO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认代理人列表
|
||||
*
|
||||
|
@ -0,0 +1,133 @@
|
||||
<?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="ink.wgink.module.activiti.dao.oa.INodeButtonDao">
|
||||
|
||||
<resultMap id="nodeButtonDTO" type="ink.wgink.module.activiti.pojo.dtos.oa.NodeButtonDTO">
|
||||
<id column="node_button_id" property="nodeButtonId"/>
|
||||
<result column="deployment_id" property="deploymentId"/>
|
||||
<result column="form_id" property="formId"/>
|
||||
<result column="node_index" property="nodeIndex"/>
|
||||
<result column="node_id" property="nodeId"/>
|
||||
<result column="btn_attachment" property="btnAttachment"/>
|
||||
<result column="btn_go_back" property="btnGoBack"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 建表 -->
|
||||
<update id="createTable">
|
||||
CREATE TABLE IF NOT EXISTS `oa_node_button` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`node_button_id` char(36) DEFAULT NULL COMMENT '主键',
|
||||
`model_id` char(36) DEFAULT NULL COMMENT '模型ID',
|
||||
`model_version` int(1) DEFAULT NULL COMMENT '模型版本',
|
||||
`deployment_id` char(36) DEFAULT NULL COMMENT '部署ID',
|
||||
`form_id` char(36) DEFAULT NULL COMMENT '表单ID',
|
||||
`node_id` char(60) DEFAULT NULL COMMENT '节点ID',
|
||||
`node_index` int(11) DEFAULT NULL COMMENT '节点下标',
|
||||
`btn_attachment` varchar(255) DEFAULT NULL COMMENT '附件上传',
|
||||
`btn_go_back` varchar(255) DEFAULT NULL COMMENT '回退',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `node_button_id` (`node_button_id`),
|
||||
KEY `model_id` (`model_id`,`model_version`),
|
||||
KEY `deployment_id` (`deployment_id`),
|
||||
KEY `form_id` (`form_id`),
|
||||
KEY `node_id` (`node_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='节点按钮';
|
||||
</update>
|
||||
|
||||
<!-- 新增 -->
|
||||
<insert id="save" parameterType="map">
|
||||
INSERT INTO oa_node_button(
|
||||
node_button_id,
|
||||
model_id,
|
||||
model_version,
|
||||
form_id,
|
||||
node_id,
|
||||
node_index,
|
||||
btn_attachment,
|
||||
btn_go_back
|
||||
) VALUES(
|
||||
#{nodeButtonId},
|
||||
#{modelId},
|
||||
#{modelVersion},
|
||||
#{formId},
|
||||
#{nodeId},
|
||||
#{nodeIndex},
|
||||
#{btnAttachment},
|
||||
#{btnGoBack}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 删除 -->
|
||||
<delete id="delete" parameterType="map">
|
||||
DELETE FROM
|
||||
oa_node_button
|
||||
WHERE
|
||||
model_id = #{modelId}
|
||||
AND
|
||||
model_version = #{modelVersion}
|
||||
<if test="formId != null and formId != ''">
|
||||
AND
|
||||
form_id = #{formId}
|
||||
</if>
|
||||
<if test="nodeId != null and nodeId != ''">
|
||||
AND
|
||||
node_id = #{nodeId}
|
||||
</if>
|
||||
</delete>
|
||||
|
||||
<!-- 更新 -->
|
||||
<update id="update" parameterType="map">
|
||||
UPDATE
|
||||
oa_node_button
|
||||
SET
|
||||
<if test="btnAttachment != null">
|
||||
btn_attachment = #{btnAttachment},
|
||||
</if>
|
||||
node_button_id = #{nodeButtonId}
|
||||
WHERE
|
||||
node_button_id = #{nodeButtonId}
|
||||
</update>
|
||||
|
||||
<!-- 更新部署ID -->
|
||||
<update id="updateDeploymentId" parameterType="map">
|
||||
UPDATE
|
||||
oa_node_button
|
||||
SET
|
||||
deployment_id = #{deploymentId}
|
||||
WHERE
|
||||
model_id = #{modelId}
|
||||
AND
|
||||
model_version = #{modelVersion}
|
||||
</update>
|
||||
|
||||
<!-- 删除部署ID -->
|
||||
<update id="deleteDeploymentId" parameterType="java.lang.String">
|
||||
UPDATE
|
||||
oa_node_button
|
||||
SET
|
||||
deployment_id = NULL
|
||||
WHERE
|
||||
deployment_id = #{_parameter}
|
||||
</update>
|
||||
|
||||
<!-- 详情 -->
|
||||
<select id="get" parameterType="map" resultMap="nodeButtonDTO">
|
||||
SELECT
|
||||
node_button_id,
|
||||
model_id,
|
||||
model_version,
|
||||
form_id,
|
||||
node_id,
|
||||
node_index,
|
||||
btn_attachment,
|
||||
btn_go_back
|
||||
FROM
|
||||
oa_node_button
|
||||
WHERE
|
||||
deployment_id = #{deploymentId}
|
||||
AND
|
||||
node_id = #{nodeId}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
@ -12,6 +12,7 @@
|
||||
<result column="is_visible" property="isVisible"/>
|
||||
<result column="is_editable" property="isEditable"/>
|
||||
<result column="edit_history" property="editHistory"/>
|
||||
<result column="auto_back_fill" property="autoBackFill"/>
|
||||
</resultMap>
|
||||
|
||||
<update id="createTable">
|
||||
@ -30,7 +31,14 @@
|
||||
`is_visible` int(1) DEFAULT '1' COMMENT '是否可见',
|
||||
`is_editable` int(1) DEFAULT '1' COMMENT '是否可编辑',
|
||||
`editHistory` varchar(255) DEFAULT NULL COMMENT '编辑历史',
|
||||
PRIMARY KEY (`id`)
|
||||
`auto_back_fill` varchar(255) DEFAULT NULL COMMENT '自动回填',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `node_field_id` (`node_field_id`),
|
||||
KEY `deployment_id` (`deployment_id`),
|
||||
KEY `deployment_id_2` (`deployment_id`),
|
||||
KEY `form_id` (`form_id`),
|
||||
KEY `node_id` (`node_id`),
|
||||
KEY `model_id` (`model_id`,`model_version`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='节点字段绑定';
|
||||
</update>
|
||||
|
||||
@ -48,7 +56,8 @@
|
||||
field_explain,
|
||||
is_visible,
|
||||
is_editable,
|
||||
edit_history
|
||||
edit_history,
|
||||
auto_back_fill
|
||||
) VALUES(
|
||||
#{nodeFieldId},
|
||||
#{modelId},
|
||||
@ -61,7 +70,8 @@
|
||||
#{fieldExplain},
|
||||
#{isVisible},
|
||||
#{isEditable},
|
||||
#{editHistory}
|
||||
#{editHistory},
|
||||
#{autoBackFill}
|
||||
)
|
||||
</insert>
|
||||
|
||||
@ -165,7 +175,8 @@
|
||||
field_name,
|
||||
is_visible,
|
||||
is_editable,
|
||||
edit_history
|
||||
edit_history,
|
||||
auto_back_fill
|
||||
FROM
|
||||
oa_node_field
|
||||
<where>
|
||||
|
@ -64,6 +64,10 @@ var OaNodeManagePopupCtrl = ['$scope', '$timeout', '$http', function ($scope, $t
|
||||
},
|
||||
formId: '',
|
||||
formFields: [],
|
||||
formButton: {
|
||||
btnAttachment: 0,
|
||||
btnGoBack: 0
|
||||
},
|
||||
oaUserTaskListeners: []
|
||||
}
|
||||
|
||||
@ -399,6 +403,7 @@ var OaNodeManagePopupCtrl = ['$scope', '$timeout', '$http', function ($scope, $t
|
||||
}
|
||||
$scope.updatePropertyInModel(assigneeProperty);
|
||||
}
|
||||
|
||||
// 更新手动指定单选代理人
|
||||
function updateAssignee() {
|
||||
assigneeProperty.value = {};
|
||||
@ -438,13 +443,13 @@ var OaNodeManagePopupCtrl = ['$scope', '$timeout', '$http', function ($scope, $t
|
||||
multiInstanceVariable.value = MULTI_INSTANCE_VARIABLE;
|
||||
if (assignee.completeCondition === 'allPass') {
|
||||
// 全部通过
|
||||
multiInstanceCondition.value = '${'+ NR_OF_COMPLETED_INSTANCES +' == '+ NR_OF_INSTANCES +'}'
|
||||
multiInstanceCondition.value = '${' + NR_OF_COMPLETED_INSTANCES + ' == ' + NR_OF_INSTANCES + '}'
|
||||
} else if (assignee.completeCondition === 'singlePass') {
|
||||
// 单人通过
|
||||
multiInstanceCondition.value = '${'+ NR_OF_COMPLETED_INSTANCES +' >= 1}'
|
||||
multiInstanceCondition.value = '${' + NR_OF_COMPLETED_INSTANCES + ' >= 1}'
|
||||
} else if (assignee.completeCondition === 'customPass') {
|
||||
// 通过多少人
|
||||
multiInstanceCondition.value = '${'+ NR_OF_COMPLETED_INSTANCES +' >= ' + assignee.completeCount + '}'
|
||||
multiInstanceCondition.value = '${' + NR_OF_COMPLETED_INSTANCES + ' >= ' + assignee.completeCount + '}'
|
||||
} else {
|
||||
top.dialog.msg('多实例(完成)通过条件错误');
|
||||
return;
|
||||
@ -484,7 +489,7 @@ var OaNodeManagePopupCtrl = ['$scope', '$timeout', '$http', function ($scope, $t
|
||||
}
|
||||
|
||||
var assignee = $scope.oaNodeManage.assignee;
|
||||
if($scope.isFirstUserTask) {
|
||||
if ($scope.isFirstUserTask) {
|
||||
updateStartAssignee();
|
||||
return;
|
||||
}
|
||||
@ -508,7 +513,7 @@ var OaNodeManagePopupCtrl = ['$scope', '$timeout', '$http', function ($scope, $t
|
||||
}
|
||||
// 自动获取
|
||||
if (assignee.assigneeType === 'auto') {
|
||||
if(assignee.quickAssignee === 'starter') {
|
||||
if (assignee.quickAssignee === 'starter') {
|
||||
updateAssignee();
|
||||
return;
|
||||
}
|
||||
@ -630,9 +635,9 @@ var OaNodeManagePopupCtrl = ['$scope', '$timeout', '$http', function ($scope, $t
|
||||
};
|
||||
|
||||
// function initOaNodeManage() {
|
||||
if ($scope.property.value) {
|
||||
$scope.oaNodeManage = EDITOR.UTIL.deepClone($scope.property.value);
|
||||
}
|
||||
if ($scope.property.value) {
|
||||
$scope.oaNodeManage = EDITOR.UTIL.deepClone($scope.property.value);
|
||||
}
|
||||
// }
|
||||
|
||||
// 初始化开始节点
|
||||
@ -648,7 +653,7 @@ var OaNodeManagePopupCtrl = ['$scope', '$timeout', '$http', function ($scope, $t
|
||||
$scope.close();
|
||||
return;
|
||||
}
|
||||
if(startNode.outgoing.length != 1) {
|
||||
if (startNode.outgoing.length != 1) {
|
||||
top.dialog.msg('流程绘制错误,开始节点后只能有一个UserTask');
|
||||
$scope.close();
|
||||
return;
|
||||
@ -659,15 +664,15 @@ var OaNodeManagePopupCtrl = ['$scope', '$timeout', '$http', function ($scope, $t
|
||||
function initOaNodeManage() {
|
||||
var firstUserTaskResourceId;
|
||||
for (var i = 0, node; node = childShapes[i++];) {
|
||||
if(node.stencil.id != 'SequenceFlow') {
|
||||
if (node.stencil.id != 'SequenceFlow') {
|
||||
continue;
|
||||
}
|
||||
if(startNode.outgoing[0].resourceId == node.resourceId) {
|
||||
if (startNode.outgoing[0].resourceId == node.resourceId) {
|
||||
firstUserTaskResourceId = node.outgoing[0].resourceId;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!firstUserTaskResourceId) {
|
||||
if (!firstUserTaskResourceId) {
|
||||
top.dialog.msg('流程绘制错误,开始节点后没有连线的UserTask');
|
||||
$scope.close();
|
||||
return;
|
||||
@ -677,7 +682,7 @@ var OaNodeManagePopupCtrl = ['$scope', '$timeout', '$http', function ($scope, $t
|
||||
$scope.oaNodeManage = EDITOR.UTIL.deepClone($scope.property.value);
|
||||
}
|
||||
$scope.isFirstUserTask = firstUserTaskResourceId == selection.resourceId;
|
||||
if($scope.isFirstUserTask) {
|
||||
if ($scope.isFirstUserTask) {
|
||||
$scope.oaNodeManage.assignee.nodeType = 'normal';
|
||||
$scope.oaNodeManage.assignee.assigneeType = 'auto';
|
||||
$scope.oaNodeManage.assignee.autoAssignType = 'quick';
|
||||
@ -707,11 +712,13 @@ var OaNodeManagePopupCtrl = ['$scope', '$timeout', '$http', function ($scope, $t
|
||||
var isVisible = true;
|
||||
var isEditable = true;
|
||||
var editHistory = 'noRecord';
|
||||
var autoBackFill = 'noBackFill';
|
||||
for (var j = 0, item; item = $scope.oaNodeManage.formFields[j++];) {
|
||||
if (formField.fieldId === item.fieldId) {
|
||||
isVisible = item.isVisible;
|
||||
isEditable = item.isEditable;
|
||||
editHistory = item.editHistory;
|
||||
autoBackFill = item.autoBackFill;
|
||||
}
|
||||
}
|
||||
formFields.push({
|
||||
@ -722,7 +729,8 @@ var OaNodeManagePopupCtrl = ['$scope', '$timeout', '$http', function ($scope, $t
|
||||
fieldType: formField.fieldType,
|
||||
isVisible: isVisible,
|
||||
isEditable: isEditable,
|
||||
editHistory: editHistory
|
||||
editHistory: editHistory,
|
||||
autoBackFill: autoBackFill
|
||||
})
|
||||
}
|
||||
$scope.oaNodeManage.formFields = formFields;
|
||||
|
@ -11,15 +11,15 @@
|
||||
<li class="active">
|
||||
<a href="#nodeConfig" aria-controls="home" role="tab" data-toggle="tab"><h5>代理人配置</h5></a>
|
||||
</li>
|
||||
<!-- <li>-->
|
||||
<!-- <a href="#buttonConfig" aria-controls="profile" role="tab" data-toggle="tab"><h5>按钮配置</h5></a>-->
|
||||
<!-- </li>-->
|
||||
<li>
|
||||
<a href="#formFieldConfig" aria-controls="profile" role="tab" data-toggle="tab"><h5>表单字段配置</h5></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#listenerConfig" aria-controls="profile" role="tab" data-toggle="tab"><h5>监听器配置</h5></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#buttonConfig" aria-controls="profile" role="tab" data-toggle="tab"><h5>按钮配置</h5></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div role="tabpanel" class="tab-pane active" id="nodeConfig" style="padding: 15px 0;">
|
||||
@ -301,7 +301,6 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- <div role="tabpanel" class="tab-pane" id="buttonConfig" style="padding: 15px 0;"></div>-->
|
||||
<div role="tabpanel" class="tab-pane" id="formFieldConfig" style="padding: 15px 0;">
|
||||
<table class="table table-bordered table-hover">
|
||||
<colgroup>
|
||||
@ -312,7 +311,8 @@
|
||||
<col>
|
||||
<col width="60">
|
||||
<col width="60">
|
||||
<col width="250">
|
||||
<col width="100">
|
||||
<col width="100">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
@ -324,6 +324,7 @@
|
||||
<th class="text-center">可见</th>
|
||||
<th class="text-center">可操作</th>
|
||||
<th class="text-center">编辑历史</th>
|
||||
<th class="text-center">自动填充</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -340,15 +341,17 @@
|
||||
<input type="checkbox" ng-model="formField.isEditable">
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<label class="radio-inline">
|
||||
<input ng-model="formField.editHistory" type="radio" value="noRecord"> 不记录
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input ng-model="formField.editHistory" type="radio" value="latest"> 最新
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input ng-model="formField.editHistory" type="radio" value="all"> 全部
|
||||
</label>
|
||||
<select class="form-control input-sm" ng-model="formField.editHistory" >
|
||||
<option value="noRecord">不记录</option>
|
||||
<option value="latest" ng-if="formField.fieldTag == 'input' || formField.fieldTag == 'textarea'">最新</option>
|
||||
<option value="all" ng-if="formField.fieldTag == 'textarea'">全部</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control input-sm" ng-model="formField.autoBackFill">
|
||||
<option value="noBackFill">不回填</option>
|
||||
<option value="currentUser">当前用户</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -399,6 +402,48 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="buttonConfig" style="padding: 15px 0;">
|
||||
<table class="table table-bordered table-hover">
|
||||
<colgroup>
|
||||
<col width="60">
|
||||
<col>
|
||||
<col width="160">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>序号</th>
|
||||
<th>按钮</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="text-center">1</td>
|
||||
<td>附件</td>
|
||||
<td>
|
||||
<label class="radio-inline">
|
||||
<input ng-model="oaNodeManage.formButton.btnAttachment" type="radio" value="0"> 关闭
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input ng-model="oaNodeManage.formButton.btnAttachment" type="radio" value="1"> 开启
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-center">2</td>
|
||||
<td>回退</td>
|
||||
<td>
|
||||
<label class="radio-inline">
|
||||
<input ng-model="oaNodeManage.formButton.btnGoBack" type="radio" value="0"> 关闭
|
||||
</label>
|
||||
<label class="radio-inline">
|
||||
<input ng-model="oaNodeManage.formButton.btnGoBack" type="radio" value="1"> 开启
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -87,7 +87,7 @@ KISBPM.TOOLBAR = {
|
||||
oaNodeManages: oaNodeManages
|
||||
}
|
||||
var loadLayerIndex;
|
||||
top.restAjax.put(KISBPM.URL.putModel(modelMetaData.modelId), params, null, function (code, data) {
|
||||
top.restAjax.put(KISBPM.URL.putModel(modelMetaData.modelId, modelMetaData.modelVersion), params, null, function (code, data) {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
top.dialog.msg('保存成功');
|
||||
}, function (code, data) {
|
||||
@ -98,12 +98,6 @@ KISBPM.TOOLBAR = {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
})
|
||||
// var modal = services.$modal({
|
||||
// backdrop: true,
|
||||
// keyboard: true,
|
||||
// template: 'editor-app/popups/save-model.html?version=' + Date.now(),
|
||||
// scope: services.$scope
|
||||
// });
|
||||
},
|
||||
|
||||
undo: function (services) {
|
||||
|
@ -28,7 +28,7 @@ KISBPM.URL = {
|
||||
return ACTIVITI.CONFIG.contextRoot + '/model/editor/stencilset?version=' + Date.now();
|
||||
},
|
||||
|
||||
putModel: function(modelId) {
|
||||
return ACTIVITI.CONFIG.contextRoot + '/model/save/' + modelId;
|
||||
putModel: function(modelId, modelVersion) {
|
||||
return ACTIVITI.CONFIG.contextRoot + '/model/save/' + modelId +'/version/'+ modelVersion;
|
||||
}
|
||||
};
|
@ -1515,4 +1515,14 @@ button.selection:active, button.selection:focus {
|
||||
|
||||
.fullscreen .modal-header h3 .summary {
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
|
||||
table tbody tr td {
|
||||
vertical-align: middle !important;
|
||||
}
|
||||
|
||||
select.input-sm {
|
||||
height: 21px;
|
||||
line-height: 20px;
|
||||
padding: 0;
|
||||
}
|
||||
|
@ -932,7 +932,7 @@ layui.config({
|
||||
}
|
||||
}
|
||||
});
|
||||
var SYSTEM_KEY_ARRAY = ['id', 'uid', 'gmt_create', 'creator', 'gmt_modified', 'modifier', 'is_delete', 'MAIN_TITLE'];
|
||||
var SYSTEM_KEY_ARRAY = ['id', 'uid', 'gmt_create', 'creator', 'gmt_modified', 'modifier', 'is_delete', 'MAIN_TITLE', 'attachments', 'attachmentBtn', 'showAttachmentBtn', 'goBackBtn'];
|
||||
// 更新 option json
|
||||
$(document).off('blur', '#columnProperty .layui-input').on('blur', '#columnProperty .layui-input', function () {
|
||||
if ($(this).attr("name") !== undefined) {
|
||||
|
@ -243,7 +243,7 @@ function FormUtil(layui, viewer) {
|
||||
var fileName = idNameArray[1];
|
||||
html += [
|
||||
'<tr>',
|
||||
' <td>' + fileName + '</td>',
|
||||
' <td><a href="route/file/download/false/'+ fileId +'" target="_blank">' + fileName + '</a></td>',
|
||||
' <td class="operation">',
|
||||
' <button type="button" class="layui-btn layui-btn-xs layui-btn-danger delete-btn delete-' + fieldName + '-btn" data-id="' + fileId + '" data-name="' + fileName + '" data-field-name="' + fieldName + '">删除</button>',
|
||||
' </td>',
|
||||
@ -309,7 +309,7 @@ function FormUtil(layui, viewer) {
|
||||
if (files.length > 0) {
|
||||
files += ',';
|
||||
}
|
||||
files += res.data.fileId + ':' + res.data.fileName;
|
||||
files += res.data.fileId + ':' + res.data.fileName.replace(/\,/g, ',');
|
||||
$('#' + name).val(files);
|
||||
init();
|
||||
},
|
||||
@ -317,14 +317,7 @@ function FormUtil(layui, viewer) {
|
||||
layer.close(layerLoadingIndex);
|
||||
layer.msg('文件上传失败');
|
||||
},
|
||||
progress: function (n, elem, res, index) {
|
||||
var percent = n + '%'
|
||||
console.log(percent);
|
||||
console.log(elem);
|
||||
console.log(res);
|
||||
console.log(index);
|
||||
element.progress('demo-' + index, n + '%');
|
||||
}
|
||||
progress: function (n, elem, res, index) {}
|
||||
});
|
||||
$(document).on('click', deleteBtnClass, function () {
|
||||
var id = this.dataset.id;
|
||||
@ -496,7 +489,7 @@ function FormUtil(layui, viewer) {
|
||||
if (files.length > 0) {
|
||||
files += ',';
|
||||
}
|
||||
files += res.data.fileId + ':' + res.data.fileName;
|
||||
files += res.data.fileId + ':' + res.data.fileName.replace(/\,/g, ',');
|
||||
$('#' + name).val(files);
|
||||
init();
|
||||
},
|
||||
@ -504,14 +497,7 @@ function FormUtil(layui, viewer) {
|
||||
layer.close(layerLoadingIndex);
|
||||
layer.msg('文件上传失败');
|
||||
},
|
||||
progress: function (n, elem, res, index) {
|
||||
var percent = n + '%'
|
||||
console.log(percent);
|
||||
console.log(elem);
|
||||
console.log(res);
|
||||
console.log(index);
|
||||
element.progress('demo-' + index, n + '%');
|
||||
}
|
||||
progress: function (n, elem, res, index) {}
|
||||
});
|
||||
$(document).on('click', deleteBtnClass, function () {
|
||||
var name = this.dataset.name;
|
||||
@ -681,7 +667,7 @@ function FormUtil(layui, viewer) {
|
||||
if (files.length > 0) {
|
||||
files += ',';
|
||||
}
|
||||
files += res.data.fileId + ':' + res.data.fileName;
|
||||
files += res.data.fileId + ':' + res.data.fileName.replace(/\,/g, ',');
|
||||
$('#' + name).val(files);
|
||||
init();
|
||||
},
|
||||
@ -689,14 +675,7 @@ function FormUtil(layui, viewer) {
|
||||
layer.close(layerLoadingIndex);
|
||||
layer.msg('文件上传失败');
|
||||
},
|
||||
progress: function (n, elem, res, index) {
|
||||
var percent = n + '%'
|
||||
console.log(percent);
|
||||
console.log(elem);
|
||||
console.log(res);
|
||||
console.log(index);
|
||||
element.progress('demo-' + index, n + '%');
|
||||
}
|
||||
progress: function (n, elem, res, index) {}
|
||||
});
|
||||
$(document).on('click', deleteBtnClass, function () {
|
||||
var name = this.dataset.name;
|
||||
|
@ -2,6 +2,7 @@ function OaFormUtil(layui) {
|
||||
var $ = layui.$;
|
||||
var win = $(window);
|
||||
var layer = layui.layer;
|
||||
var upload = layui.upload;
|
||||
var restAjax = layui.restajax;
|
||||
var processImageEnlargeScale = 0;
|
||||
|
||||
@ -65,7 +66,7 @@ function OaFormUtil(layui) {
|
||||
var signList = formData[key];
|
||||
var signListText = '';
|
||||
for (var i = 0, item; item = signList[i++];) {
|
||||
signListText += item.userName + ':' + item.content + ' - ' + item.time +'\n';
|
||||
signListText += item.userName + ':' + item.content + ' - ' + item.time + '\n';
|
||||
}
|
||||
formData[signPreDomKey] = signListText;
|
||||
delete formData[key];
|
||||
@ -236,4 +237,147 @@ function OaFormUtil(layui) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化表单按钮
|
||||
* @param formButton
|
||||
*/
|
||||
this.initFormButtons = function (formButton, opt) {
|
||||
var headers = opt.headers;
|
||||
headers = headers ? headers : {};
|
||||
var isApp = opt.isApp;
|
||||
var isShow = opt.isShow;
|
||||
|
||||
function initButton() {
|
||||
var buttons = '';
|
||||
buttons += '<div class="layui-btn-group">'
|
||||
if (formButton.btnAttachment) {
|
||||
buttons += '<button id="attachmentBtn" type="button" class="layui-btn layui-btn-sm layui-btn-default">上传附件</button>';
|
||||
}
|
||||
buttons += '<button id="showAttachmentBtn" type="button" class="layui-btn layui-btn-sm layui-btn-primary" title="附件列表"><i class="fa fa-list-ul" aria-hidden="true"></i></button>';
|
||||
buttons += '<input type="hidden" name="attachments" id="attachments"/>';
|
||||
buttons += '</div>';
|
||||
if (formButton.btnGoBack) {
|
||||
buttons += '<button id="goBackBtn" type="button" class="layui-btn layui-btn-sm layui-btn-danger">回退</button>';
|
||||
}
|
||||
$('#formButtonGroup').append(buttons);
|
||||
}
|
||||
|
||||
function addClick() {
|
||||
if(formButton.btnAttachment) {
|
||||
var layerLoadingIndex;
|
||||
var url = 'api/file/v2/upload-file';
|
||||
if (isApp) {
|
||||
url = 'app/file/v2/upload-file'
|
||||
}
|
||||
upload.render({
|
||||
elem: '#attachmentBtn',
|
||||
url: url,
|
||||
accept: 'file',
|
||||
acceptMime: [
|
||||
'application/pdf',
|
||||
'application/msword',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'application/vnd.ms-excel',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'application/vnd.ms-powerpoint',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
||||
'application/vnd.ms-works',
|
||||
'text/plain',
|
||||
'application/x-rar',
|
||||
'application/x-zip-compressed'
|
||||
].join(''),
|
||||
field: 'file',
|
||||
exts: 'pdf|doc|docx|xls|xlsx|ppt|pptx|wps|txt|rar|zip',
|
||||
headers: headers,
|
||||
before: function (obj) {
|
||||
layerLoadingIndex = layer.msg('上传中...', {icon: 16, time: 0, shade: 0.3})
|
||||
},
|
||||
done: function (res, index, upload) {
|
||||
layer.close(layerLoadingIndex);
|
||||
var attachments = $('#attachments').val();
|
||||
var data = res.data;
|
||||
if(attachments.length > 0) {
|
||||
attachments += ',';
|
||||
}
|
||||
attachments += data.fileId +':'+ data.fileName.replace(/\,/g, ',');
|
||||
$('#attachments').val(attachments);
|
||||
},
|
||||
error: function (index, upload) {
|
||||
layer.close(layerLoadingIndex);
|
||||
layer.msg('文件上传失败');
|
||||
},
|
||||
progress: function (n, elem, res, index) {}
|
||||
});
|
||||
}
|
||||
$(document.body).on('click', '#showAttachmentBtn', function() {
|
||||
var attachments = $('#attachments').val();
|
||||
var attachmentArray = attachments.split(',');
|
||||
var html = [
|
||||
'<div class="form-upload-file" style="margin: 0 10px;">',
|
||||
' <table class="layui-table" lay-size="sm">',
|
||||
' <colgroup>',
|
||||
' <col>',
|
||||
' <col width="60">',
|
||||
' </colgroup>',
|
||||
' <thead>',
|
||||
' <tr>',
|
||||
' <th>文件名</th>',
|
||||
' <th class="operation">操作</th>',
|
||||
' </tr>',
|
||||
' </thead>',
|
||||
' <tbody>',
|
||||
].join('');
|
||||
for (var i = 0, file; file = attachmentArray[i++];) {
|
||||
var idNameArray = file.split(':');
|
||||
var fileId = idNameArray[0];
|
||||
var fileName = idNameArray[1];
|
||||
html += [
|
||||
'<tr>',
|
||||
' <td><a href="route/file/download/false/'+ fileId +'" target="_blank">' + fileName + '</a></td>',
|
||||
' <td class="operation">',
|
||||
formButton.btnAttachment ? '<button type="button" class="layui-btn layui-btn-xs layui-btn-danger delete-btn delete-attachment-btn" data-id="' + fileId + '" data-name="' + fileName + '">删除</button>' : '',
|
||||
' </td>',
|
||||
'</tr>',
|
||||
].join('');
|
||||
}
|
||||
html += [
|
||||
' </tbody>',
|
||||
' </table>',
|
||||
'</div>'
|
||||
].join('');
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: false,
|
||||
area: ['80%'],
|
||||
maxHeight: '60%',
|
||||
closeBtn: 0,
|
||||
shadeClose: true,
|
||||
content: html
|
||||
});
|
||||
});
|
||||
|
||||
$(document.body).on('click', '.delete-attachment-btn', function() {
|
||||
var id = this.dataset.id;
|
||||
var name = this.dataset.name;
|
||||
var files = $('#attachments').val().replace(id + ':' + name, '');
|
||||
files = files.replace(/\,+/g, ',');
|
||||
if (files.charAt(0) == ',') {
|
||||
files = files.substring(1);
|
||||
}
|
||||
if (files.charAt(files.length - 1) == ',') {
|
||||
files = files.substring(0, files.length - 1);
|
||||
}
|
||||
$('#attachments').val(files);
|
||||
$(this).parent().parent().remove();
|
||||
});
|
||||
|
||||
$(document.body).on('click', '#goBackBtn', function() {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
initButton();
|
||||
addClick();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user