feat: 2.6.0
1. 完成DAG详情查询
This commit is contained in:
parent
f9ffbff98f
commit
c873b8e918
@ -443,13 +443,15 @@ CREATE TABLE `retry_summary`
|
|||||||
CREATE TABLE `workflow`
|
CREATE TABLE `workflow`
|
||||||
(
|
(
|
||||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
|
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
`workflow_name` varchar(64) NOT NULL COMMENT '工作流名称',
|
||||||
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
|
`namespace_id` varchar(64) NOT NULL DEFAULT '764d604ec6fc45f68cd92514c40e9e1a' COMMENT '命名空间id',
|
||||||
`group_name` varchar(64) NOT NULL COMMENT '组名称',
|
`group_name` varchar(64) NOT NULL COMMENT '组名称',
|
||||||
`workflow_status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '工作流状态 0、关闭、1、开启',
|
`workflow_status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '工作流状态 0、关闭、1、开启',
|
||||||
`trigger_type` tinyint(4) NOT NULL COMMENT '触发类型 1.CRON 表达式 2. 固定时间',
|
`trigger_type` tinyint(4) NOT NULL COMMENT '触发类型 1.CRON 表达式 2. 固定时间',
|
||||||
`trigger_interval` varchar(255) NOT NULL COMMENT '间隔时长',
|
`trigger_interval` varchar(255) NOT NULL COMMENT '间隔时长',
|
||||||
`execution_at` bigint(13) NOT NULL DEFAULT '0' COMMENT '任务执行时间',
|
`next_trigger_at` bigint(13) NOT NULL COMMENT '下次触发时间',
|
||||||
`executor_timeout` int(11) NOT NULL DEFAULT '0' COMMENT '任务执行超时时间,单位秒',
|
`executor_timeout` int(11) NOT NULL DEFAULT '0' COMMENT '任务执行超时时间,单位秒',
|
||||||
|
`description` varchar(256) NOT NULL DEFAULT '' COMMENT '描述',
|
||||||
`flow_info` text DEFAULT NULL COMMENT '流程信息',
|
`flow_info` text DEFAULT NULL COMMENT '流程信息',
|
||||||
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
`create_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
`update_dt` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||||
|
@ -8,9 +8,6 @@ import java.time.LocalDateTime;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 工作流
|
* 工作流
|
||||||
@ -33,6 +30,11 @@ public class Workflow implements Serializable {
|
|||||||
@TableId(value = "id", type = IdType.AUTO)
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作流名称
|
||||||
|
*/
|
||||||
|
private String workflowName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 命名空间id
|
* 命名空间id
|
||||||
*/
|
*/
|
||||||
@ -66,13 +68,18 @@ public class Workflow implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 任务执行时间
|
* 任务执行时间
|
||||||
*/
|
*/
|
||||||
private Long executionAt;
|
private Long nextTriggerAt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程信息
|
* 流程信息
|
||||||
*/
|
*/
|
||||||
private String flowInfo;
|
private String flowInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
@ -86,7 +93,7 @@ public class Workflow implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 逻辑删除 1、删除
|
* 逻辑删除 1、删除
|
||||||
*/
|
*/
|
||||||
private Byte deleted;
|
private Integer deleted;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 扩展字段
|
* 扩展字段
|
||||||
|
@ -45,9 +45,8 @@ public class JdbcLockProvider extends AbstractLockProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
||||||
public boolean unlock(final LockConfig lockConfig) {
|
public boolean unlock(final LockConfig lockConfig) {
|
||||||
LocalDateTime now = lockConfig.getCreateDt();
|
LocalDateTime now = LocalDateTime.now();
|
||||||
DistributedLock distributedLock = new DistributedLock();
|
DistributedLock distributedLock = new DistributedLock();
|
||||||
distributedLock.setLockedBy(ServerRegister.CURRENT_CID);
|
distributedLock.setLockedBy(ServerRegister.CURRENT_CID);
|
||||||
LocalDateTime lockAtLeast = lockConfig.getLockAtLeast();
|
LocalDateTime lockAtLeast = lockConfig.getLockAtLeast();
|
||||||
|
@ -1,12 +1,21 @@
|
|||||||
package com.aizuda.easy.retry.server.web.controller;
|
package com.aizuda.easy.retry.server.web.controller;
|
||||||
|
|
||||||
|
import com.aizuda.easy.retry.server.web.annotation.LoginRequired;
|
||||||
|
import com.aizuda.easy.retry.server.web.annotation.RoleEnum;
|
||||||
|
import com.aizuda.easy.retry.server.web.model.base.PageResult;
|
||||||
|
import com.aizuda.easy.retry.server.web.model.request.WorkflowQueryVO;
|
||||||
import com.aizuda.easy.retry.server.web.model.request.WorkflowRequestVO;
|
import com.aizuda.easy.retry.server.web.model.request.WorkflowRequestVO;
|
||||||
import com.aizuda.easy.retry.server.web.model.response.WorkflowDetailResponseVO;
|
import com.aizuda.easy.retry.server.web.model.response.WorkflowDetailResponseVO;
|
||||||
|
import com.aizuda.easy.retry.server.web.model.response.WorkflowResponseVO;
|
||||||
import com.aizuda.easy.retry.server.web.service.WorkflowService;
|
import com.aizuda.easy.retry.server.web.service.WorkflowService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.context.annotation.Role;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xiaowoniu
|
* @author xiaowoniu
|
||||||
* @date 2023-12-12 21:50:46
|
* @date 2023-12-12 21:50:46
|
||||||
@ -20,17 +29,25 @@ public class WorkflowController {
|
|||||||
private final WorkflowService workflowService;
|
private final WorkflowService workflowService;
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
|
@LoginRequired(role = RoleEnum.USER)
|
||||||
public Boolean saveWorkflow(@RequestBody @Validated WorkflowRequestVO workflowRequestVO) {
|
public Boolean saveWorkflow(@RequestBody @Validated WorkflowRequestVO workflowRequestVO) {
|
||||||
return workflowService.saveWorkflow(workflowRequestVO);
|
return workflowService.saveWorkflow(workflowRequestVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page/list")
|
||||||
|
@LoginRequired(role = RoleEnum.USER)
|
||||||
|
public PageResult<List<WorkflowResponseVO>> listPage(WorkflowQueryVO queryVO) {
|
||||||
|
return workflowService.listPage(queryVO);
|
||||||
|
}
|
||||||
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public void updateWorkflow() {
|
public void updateWorkflow() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("{id}")
|
@GetMapping("{id}")
|
||||||
public WorkflowDetailResponseVO getWorkflowDetail(@PathVariable("id") Long id) {
|
@LoginRequired(role = RoleEnum.USER)
|
||||||
|
public WorkflowDetailResponseVO getWorkflowDetail(@PathVariable("id") Long id) throws IOException {
|
||||||
return workflowService.getWorkflowDetail(id);
|
return workflowService.getWorkflowDetail(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.aizuda.easy.retry.server.web.model.request;
|
||||||
|
|
||||||
|
import com.aizuda.easy.retry.server.web.model.base.BaseQueryVO;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: xiaowoniu
|
||||||
|
* @date : 2023-12-15 12:09
|
||||||
|
* @since : 2.6.0
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class WorkflowQueryVO extends BaseQueryVO {
|
||||||
|
|
||||||
|
}
|
@ -21,6 +21,9 @@ public class WorkflowRequestVO {
|
|||||||
@Pattern(regexp = "^[A-Za-z0-9_]{1,64}$", message = "仅支持长度为1~64字符且类型为数字、字母和下划线")
|
@Pattern(regexp = "^[A-Za-z0-9_]{1,64}$", message = "仅支持长度为1~64字符且类型为数字、字母和下划线")
|
||||||
private String groupName;
|
private String groupName;
|
||||||
|
|
||||||
|
@NotBlank(message = "工作流名称不能为空")
|
||||||
|
private String workflowName;
|
||||||
|
|
||||||
@NotNull(message = "触发类型不能为空")
|
@NotNull(message = "触发类型不能为空")
|
||||||
private Integer triggerType;
|
private Integer triggerType;
|
||||||
|
|
||||||
@ -36,6 +39,12 @@ public class WorkflowRequestVO {
|
|||||||
@NotNull(message = "工作流状态")
|
@NotNull(message = "工作流状态")
|
||||||
private Integer workflowStatus;
|
private Integer workflowStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DAG节点配置
|
* DAG节点配置
|
||||||
*/
|
*/
|
||||||
|
@ -75,6 +75,11 @@ public class WorkflowDetailResponseVO {
|
|||||||
*/
|
*/
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1、任务节点 2、条件节点 3、回调节点
|
||||||
|
*/
|
||||||
|
private Integer nodeType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 节点名称
|
* 节点名称
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,62 @@
|
|||||||
|
package com.aizuda.easy.retry.server.web.model.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: xiaowoniu
|
||||||
|
* @date : 2023-12-15 12:22
|
||||||
|
* @since : 2.6.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class WorkflowResponseVO {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作流名称
|
||||||
|
*/
|
||||||
|
private String workflowName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组名称
|
||||||
|
*/
|
||||||
|
private String groupName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 触发类型
|
||||||
|
*/
|
||||||
|
private Integer triggerType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 触发间隔
|
||||||
|
*/
|
||||||
|
private String triggerInterval;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行超时时间
|
||||||
|
*/
|
||||||
|
private Integer executorTimeout;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作流状态 0、关闭、1、开启
|
||||||
|
*/
|
||||||
|
private Integer workflowStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务执行时间
|
||||||
|
*/
|
||||||
|
private Long nextTriggerAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createDt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updateDt;
|
||||||
|
|
||||||
|
}
|
@ -1,7 +1,13 @@
|
|||||||
package com.aizuda.easy.retry.server.web.service;
|
package com.aizuda.easy.retry.server.web.service;
|
||||||
|
|
||||||
|
import com.aizuda.easy.retry.server.web.model.base.PageResult;
|
||||||
|
import com.aizuda.easy.retry.server.web.model.request.WorkflowQueryVO;
|
||||||
import com.aizuda.easy.retry.server.web.model.request.WorkflowRequestVO;
|
import com.aizuda.easy.retry.server.web.model.request.WorkflowRequestVO;
|
||||||
import com.aizuda.easy.retry.server.web.model.response.WorkflowDetailResponseVO;
|
import com.aizuda.easy.retry.server.web.model.response.WorkflowDetailResponseVO;
|
||||||
|
import com.aizuda.easy.retry.server.web.model.response.WorkflowResponseVO;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xiaowoniu
|
* @author xiaowoniu
|
||||||
@ -12,5 +18,7 @@ public interface WorkflowService {
|
|||||||
|
|
||||||
boolean saveWorkflow(WorkflowRequestVO workflowRequestVO);
|
boolean saveWorkflow(WorkflowRequestVO workflowRequestVO);
|
||||||
|
|
||||||
WorkflowDetailResponseVO getWorkflowDetail(Long id);
|
WorkflowDetailResponseVO getWorkflowDetail(Long id) throws IOException;
|
||||||
|
|
||||||
|
PageResult<List<WorkflowResponseVO>> listPage(WorkflowQueryVO queryVO);
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.aizuda.easy.retry.server.web.service.convert;
|
|||||||
|
|
||||||
import com.aizuda.easy.retry.server.web.model.request.WorkflowRequestVO;
|
import com.aizuda.easy.retry.server.web.model.request.WorkflowRequestVO;
|
||||||
import com.aizuda.easy.retry.server.web.model.response.WorkflowDetailResponseVO;
|
import com.aizuda.easy.retry.server.web.model.response.WorkflowDetailResponseVO;
|
||||||
|
import com.aizuda.easy.retry.server.web.model.response.WorkflowResponseVO;
|
||||||
import com.aizuda.easy.retry.template.datasource.persistence.po.Workflow;
|
import com.aizuda.easy.retry.template.datasource.persistence.po.Workflow;
|
||||||
import com.aizuda.easy.retry.template.datasource.persistence.po.WorkflowNode;
|
import com.aizuda.easy.retry.template.datasource.persistence.po.WorkflowNode;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
@ -25,5 +26,7 @@ public interface WorkflowConverter {
|
|||||||
|
|
||||||
WorkflowDetailResponseVO toWorkflowDetailResponseVO(Workflow workflow);
|
WorkflowDetailResponseVO toWorkflowDetailResponseVO(Workflow workflow);
|
||||||
|
|
||||||
WorkflowDetailResponseVO.NodeInfo toNodeInfo(WorkflowNode workflowNode);
|
List<WorkflowDetailResponseVO.NodeInfo> toNodeInfo(List<WorkflowNode> workflowNodes);
|
||||||
|
|
||||||
|
List<WorkflowResponseVO> toWorkflowResponseVO(List<Workflow> workflowList);
|
||||||
}
|
}
|
||||||
|
@ -2,21 +2,32 @@ package com.aizuda.easy.retry.server.web.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.aizuda.easy.retry.common.core.enums.StatusEnum;
|
||||||
import com.aizuda.easy.retry.common.core.util.JsonUtil;
|
import com.aizuda.easy.retry.common.core.util.JsonUtil;
|
||||||
import com.aizuda.easy.retry.server.common.exception.EasyRetryServerException;
|
import com.aizuda.easy.retry.server.common.exception.EasyRetryServerException;
|
||||||
|
import com.aizuda.easy.retry.server.web.model.base.PageResult;
|
||||||
|
import com.aizuda.easy.retry.server.web.model.request.UserSessionVO;
|
||||||
|
import com.aizuda.easy.retry.server.web.model.request.WorkflowQueryVO;
|
||||||
import com.aizuda.easy.retry.server.web.model.request.WorkflowRequestVO;
|
import com.aizuda.easy.retry.server.web.model.request.WorkflowRequestVO;
|
||||||
import com.aizuda.easy.retry.server.web.model.request.WorkflowRequestVO.NodeConfig;
|
import com.aizuda.easy.retry.server.web.model.request.WorkflowRequestVO.NodeConfig;
|
||||||
import com.aizuda.easy.retry.server.web.model.request.WorkflowRequestVO.NodeInfo;
|
import com.aizuda.easy.retry.server.web.model.request.WorkflowRequestVO.NodeInfo;
|
||||||
|
import com.aizuda.easy.retry.server.web.model.response.JobResponseVO;
|
||||||
import com.aizuda.easy.retry.server.web.model.response.WorkflowDetailResponseVO;
|
import com.aizuda.easy.retry.server.web.model.response.WorkflowDetailResponseVO;
|
||||||
|
import com.aizuda.easy.retry.server.web.model.response.WorkflowResponseVO;
|
||||||
import com.aizuda.easy.retry.server.web.service.WorkflowService;
|
import com.aizuda.easy.retry.server.web.service.WorkflowService;
|
||||||
|
import com.aizuda.easy.retry.server.web.service.convert.JobResponseVOConverter;
|
||||||
import com.aizuda.easy.retry.server.web.service.convert.WorkflowConverter;
|
import com.aizuda.easy.retry.server.web.service.convert.WorkflowConverter;
|
||||||
|
import com.aizuda.easy.retry.server.web.util.UserSessionUtils;
|
||||||
import com.aizuda.easy.retry.template.datasource.persistence.mapper.WorkflowMapper;
|
import com.aizuda.easy.retry.template.datasource.persistence.mapper.WorkflowMapper;
|
||||||
import com.aizuda.easy.retry.template.datasource.persistence.mapper.WorkflowNodeMapper;
|
import com.aizuda.easy.retry.template.datasource.persistence.mapper.WorkflowNodeMapper;
|
||||||
|
import com.aizuda.easy.retry.template.datasource.persistence.po.Job;
|
||||||
import com.aizuda.easy.retry.template.datasource.persistence.po.Workflow;
|
import com.aizuda.easy.retry.template.datasource.persistence.po.Workflow;
|
||||||
import com.aizuda.easy.retry.template.datasource.persistence.po.WorkflowNode;
|
import com.aizuda.easy.retry.template.datasource.persistence.po.WorkflowNode;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.graph.ElementOrder;
|
|
||||||
import com.google.common.graph.GraphBuilder;
|
import com.google.common.graph.GraphBuilder;
|
||||||
import com.google.common.graph.MutableGraph;
|
import com.google.common.graph.MutableGraph;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@ -25,6 +36,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -51,6 +63,8 @@ public class WorkflowServiceImpl implements WorkflowService {
|
|||||||
|
|
||||||
// 组装工作流信息
|
// 组装工作流信息
|
||||||
Workflow workflow = WorkflowConverter.INSTANCE.toWorkflow(workflowRequestVO);
|
Workflow workflow = WorkflowConverter.INSTANCE.toWorkflow(workflowRequestVO);
|
||||||
|
// TODO 临时设置值
|
||||||
|
workflow.setNextTriggerAt(1L);
|
||||||
workflow.setFlowInfo(StrUtil.EMPTY);
|
workflow.setFlowInfo(StrUtil.EMPTY);
|
||||||
Assert.isTrue(1 == workflowMapper.insert(workflow), () -> new EasyRetryServerException("新增工作流失败"));
|
Assert.isTrue(1 == workflowMapper.insert(workflow), () -> new EasyRetryServerException("新增工作流失败"));
|
||||||
|
|
||||||
@ -69,34 +83,94 @@ public class WorkflowServiceImpl implements WorkflowService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WorkflowDetailResponseVO getWorkflowDetail(Long id) {
|
public WorkflowDetailResponseVO getWorkflowDetail(Long id) throws IOException {
|
||||||
|
|
||||||
Workflow workflow = workflowMapper.selectById(id);
|
Workflow workflow = workflowMapper.selectById(id);
|
||||||
|
if (Objects.isNull(workflow)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
WorkflowDetailResponseVO responseVO = WorkflowConverter.INSTANCE.toWorkflowDetailResponseVO(workflow);
|
WorkflowDetailResponseVO responseVO = WorkflowConverter.INSTANCE.toWorkflowDetailResponseVO(workflow);
|
||||||
WorkflowDetailResponseVO.NodeConfig nodeConfig = new WorkflowDetailResponseVO.NodeConfig();
|
|
||||||
responseVO.setNodeConfig(nodeConfig);
|
|
||||||
List<WorkflowNode> workflowNodes = workflowNodeMapper.selectList(new LambdaQueryWrapper<WorkflowNode>()
|
List<WorkflowNode> workflowNodes = workflowNodeMapper.selectList(new LambdaQueryWrapper<WorkflowNode>()
|
||||||
.eq(WorkflowNode::getDeleted, 0)
|
.eq(WorkflowNode::getDeleted, 0)
|
||||||
.eq(WorkflowNode::getWorkflowId, id));
|
.eq(WorkflowNode::getWorkflowId, id));
|
||||||
|
|
||||||
Map<Long, WorkflowNode> workflowNodeMap = workflowNodes.stream().collect(Collectors.toMap(WorkflowNode::getId, i -> i));
|
List<WorkflowDetailResponseVO.NodeInfo> nodeInfos = WorkflowConverter.INSTANCE.toNodeInfo(workflowNodes);
|
||||||
|
|
||||||
|
Map<Long, WorkflowDetailResponseVO.NodeInfo> workflowNodeMap = nodeInfos.stream().collect(Collectors.toMap(WorkflowDetailResponseVO.NodeInfo::getId, i -> i));
|
||||||
|
|
||||||
String flowInfo = workflow.getFlowInfo();
|
String flowInfo = workflow.getFlowInfo();
|
||||||
|
try {
|
||||||
// 反序列化构建图
|
// 反序列化构建图
|
||||||
MutableGraph<Long> graph = GraphBuilder.directed().allowsSelfLoops(false).build();
|
WorkflowDetailResponseVO.NodeConfig config = deserializeJsonToGraph(flowInfo, workflowNodeMap);
|
||||||
Set<Long> successors = graph.successors(root);
|
responseVO.setNodeConfig(config);
|
||||||
for (Long nodeId : successors) {
|
} catch (Exception e) {
|
||||||
WorkflowNode workflowNode = workflowNodeMap.get(nodeId);
|
log.error("反序列化失败. json:[{}]", flowInfo, e);
|
||||||
nodeConfig.setNodeType(workflowNode.getNodeType());
|
throw e;
|
||||||
List<WorkflowDetailResponseVO.NodeInfo> nodeInfos = Optional.ofNullable(nodeConfig.getConditionNodes()).orElse(Lists.newArrayList());
|
|
||||||
nodeInfos.add(WorkflowConverter.INSTANCE.toNodeInfo(workflowNode));
|
|
||||||
nodeConfig.setConditionNodes(nodeInfos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return responseVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<List<WorkflowResponseVO>> listPage(final WorkflowQueryVO queryVO) {
|
||||||
|
PageDTO<Workflow> pageDTO = new PageDTO<>(queryVO.getPage(), queryVO.getSize());
|
||||||
|
|
||||||
|
UserSessionVO userSessionVO = UserSessionUtils.currentUserSession();
|
||||||
|
LambdaQueryWrapper<Workflow> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(Workflow::getDeleted, StatusEnum.NO.getStatus());
|
||||||
|
queryWrapper.eq(Workflow::getNamespaceId, userSessionVO.getNamespaceId());
|
||||||
|
|
||||||
|
PageDTO<Workflow> page = workflowMapper.selectPage(pageDTO, queryWrapper);
|
||||||
|
|
||||||
|
List<WorkflowResponseVO> jobResponseList = WorkflowConverter.INSTANCE.toWorkflowResponseVO(page.getRecords());
|
||||||
|
|
||||||
|
return new PageResult<>(pageDTO, jobResponseList);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从JSON反序列化为Guava图
|
||||||
|
private static WorkflowDetailResponseVO.NodeConfig deserializeJsonToGraph(String jsonGraph,
|
||||||
|
Map<Long, WorkflowDetailResponseVO.NodeInfo> workflowNodeMap) throws IOException {
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
|
// 将JSON字符串转换为Map<String, Iterable<String>>
|
||||||
|
Map<Long, Iterable<Long>> adjacencyList = objectMapper.readValue(
|
||||||
|
jsonGraph, new TypeReference<Map<Long, Iterable<Long>>>() {});
|
||||||
|
|
||||||
|
Map<Long, WorkflowDetailResponseVO.NodeConfig> configMap = new HashMap<>();
|
||||||
|
WorkflowDetailResponseVO.NodeConfig rootConfig = new WorkflowDetailResponseVO.NodeConfig();
|
||||||
|
|
||||||
|
// 创建Guava图并添加节点和边
|
||||||
|
for (Map.Entry<Long, Iterable<Long>> entry : adjacencyList.entrySet()) {
|
||||||
|
Long node = entry.getKey();
|
||||||
|
Iterable<Long> successors = entry.getValue();
|
||||||
|
WorkflowDetailResponseVO.NodeConfig previousConfig = configMap.getOrDefault(node, new WorkflowDetailResponseVO.NodeConfig());
|
||||||
|
|
||||||
|
WorkflowDetailResponseVO.NodeConfig currentConfig = new WorkflowDetailResponseVO.NodeConfig();
|
||||||
|
for (Long successor : successors) {
|
||||||
|
WorkflowDetailResponseVO.NodeInfo nodeInfo = workflowNodeMap.get(successor);
|
||||||
|
// 第一层节点
|
||||||
|
if (node == root) {
|
||||||
|
rootConfig.setNodeType(nodeInfo.getNodeType());
|
||||||
|
List<WorkflowDetailResponseVO.NodeInfo> nodeInfos = Optional.ofNullable(
|
||||||
|
rootConfig.getConditionNodes()).orElse(Lists.newArrayList());
|
||||||
|
nodeInfos.add(nodeInfo);
|
||||||
|
rootConfig.setConditionNodes(nodeInfos);
|
||||||
|
configMap.put(nodeInfo.getId(), rootConfig);
|
||||||
|
} else {
|
||||||
|
currentConfig.setNodeType(nodeInfo.getNodeType());
|
||||||
|
List<WorkflowDetailResponseVO.NodeInfo> nodeInfos = Optional.ofNullable(
|
||||||
|
currentConfig.getConditionNodes()).orElse(Lists.newArrayList());
|
||||||
|
nodeInfos.add(nodeInfo);
|
||||||
|
currentConfig.setConditionNodes(nodeInfos);
|
||||||
|
configMap.put(nodeInfo.getId(), currentConfig);
|
||||||
|
previousConfig.setChildNode(currentConfig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return rootConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private Map<Long, Iterable<Long>> convertGraphToAdjacencyList(MutableGraph<Long> graph) {
|
private Map<Long, Iterable<Long>> convertGraphToAdjacencyList(MutableGraph<Long> graph) {
|
||||||
@ -123,6 +197,7 @@ public class WorkflowServiceImpl implements WorkflowService {
|
|||||||
WorkflowNode workflowNode = WorkflowConverter.INSTANCE.toWorkflowNode(nodeInfo);
|
WorkflowNode workflowNode = WorkflowConverter.INSTANCE.toWorkflowNode(nodeInfo);
|
||||||
workflowNode.setWorkflowId(workflowId);
|
workflowNode.setWorkflowId(workflowId);
|
||||||
workflowNode.setGroupName(groupName);
|
workflowNode.setGroupName(groupName);
|
||||||
|
workflowNode.setNodeType(nodeConfig.getNodeType());
|
||||||
Assert.isTrue(1 == workflowNodeMapper.insert(workflowNode), () -> new EasyRetryServerException("新增工作流节点失败"));
|
Assert.isTrue(1 == workflowNodeMapper.insert(workflowNode), () -> new EasyRetryServerException("新增工作流节点失败"));
|
||||||
// 添加节点
|
// 添加节点
|
||||||
graph.addNode(workflowNode.getId());
|
graph.addNode(workflowNode.getId());
|
||||||
|
@ -27,11 +27,26 @@ const jobApi = {
|
|||||||
jobTaskList: '/job/task/list',
|
jobTaskList: '/job/task/list',
|
||||||
|
|
||||||
// 日志
|
// 日志
|
||||||
jobLogList: '/job/log/list'
|
jobLogList: '/job/log/list',
|
||||||
|
|
||||||
|
// DAG
|
||||||
|
listPage: '/workflow/page/list',
|
||||||
|
saveWorkflow: '/workflow',
|
||||||
|
updateWorkflow: '/workflow',
|
||||||
|
workflowDetail: '/workflow'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default jobApi
|
export default jobApi
|
||||||
|
|
||||||
|
export function listPage (parameter) {
|
||||||
|
return request({
|
||||||
|
url: jobApi.listPage,
|
||||||
|
method: 'get',
|
||||||
|
params: parameter
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export function triggerJob (id) {
|
export function triggerJob (id) {
|
||||||
return request({
|
return request({
|
||||||
url: jobApi.triggerJob + id,
|
url: jobApi.triggerJob + id,
|
||||||
|
@ -209,6 +209,12 @@ export const asyncRouterMap = [
|
|||||||
hidden: true,
|
hidden: true,
|
||||||
component: () => import('@/views/job/form/JobNotifyForm.vue'),
|
component: () => import('@/views/job/form/JobNotifyForm.vue'),
|
||||||
meta: { title: '通知配置', icon: 'profile', keepAlive: true, permission: ['jobNotify'] }
|
meta: { title: '通知配置', icon: 'profile', keepAlive: true, permission: ['jobNotify'] }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/job/workflow/list',
|
||||||
|
name: 'WorkflowList',
|
||||||
|
component: () => import('@/views/job/WorkflowList'),
|
||||||
|
meta: { title: '工作流', icon: 'profile', permission: ['jobBatch'] }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -172,7 +172,7 @@ const enums = {
|
|||||||
'color': '#087da1'
|
'color': '#087da1'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
notifyStatus: {
|
notifyStatus: {
|
||||||
'0': {
|
'0': {
|
||||||
'name': '停用',
|
'name': '停用',
|
||||||
'color': '#9c1f1f'
|
'color': '#9c1f1f'
|
||||||
@ -182,7 +182,7 @@ notifyStatus: {
|
|||||||
'color': '#f5a22d'
|
'color': '#f5a22d'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
rateLimiterStatus: {
|
rateLimiterStatus: {
|
||||||
'0': {
|
'0': {
|
||||||
'name': '未启用',
|
'name': '未启用',
|
||||||
'color': '#9c1f1f'
|
'color': '#9c1f1f'
|
||||||
@ -191,6 +191,16 @@ rateLimiterStatus: {
|
|||||||
'name': '启用',
|
'name': '启用',
|
||||||
'color': '#f5a22d'
|
'color': '#f5a22d'
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
workflowStatus: {
|
||||||
|
'0': {
|
||||||
|
'name': '关闭',
|
||||||
|
'color': '#9c1f1f'
|
||||||
|
},
|
||||||
|
'1': {
|
||||||
|
'name': '开启',
|
||||||
|
'color': '#f5a22d'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
377
frontend/src/views/job/WorkflowList.vue
Normal file
377
frontend/src/views/job/WorkflowList.vue
Normal file
@ -0,0 +1,377 @@
|
|||||||
|
<template>
|
||||||
|
<a-card :bordered="false">
|
||||||
|
<div class="table-page-search-wrapper">
|
||||||
|
<a-form layout="inline">
|
||||||
|
<a-row :gutter="48">
|
||||||
|
<a-col :md="8" :sm="24">
|
||||||
|
<a-form-item label="组名称">
|
||||||
|
<a-select
|
||||||
|
v-model="queryParam.groupName"
|
||||||
|
placeholder="请输入组名称"
|
||||||
|
@change="(value) => handleChange(value)"
|
||||||
|
>
|
||||||
|
<a-select-option v-for="item in groupNameList" :value="item" :key="item">{{ item }}</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :md="8" :sm="24">
|
||||||
|
<a-form-item label="任务名称">
|
||||||
|
<a-input v-model="queryParam.jobName" placeholder="请输入任务名称" allowClear />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :md="8" :sm="24">
|
||||||
|
<a-form-item label="状态">
|
||||||
|
<a-select v-model="queryParam.jobStatus" placeholder="请选择状态" allowClear>
|
||||||
|
<a-select-option v-for="(index, value) in jobStatusEnum" :value="value" :key="value">
|
||||||
|
{{ index.name }}</a-select-option
|
||||||
|
>
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<template v-if="advanced">
|
||||||
|
<!-- <a-col :md="8" :sm="24">-->
|
||||||
|
<!-- <a-form-item label="业务编号">-->
|
||||||
|
<!-- <a-input v-model="queryParam.bizNo" placeholder="请输入业务编号" allowClear />-->
|
||||||
|
<!-- </a-form-item>-->
|
||||||
|
<!-- </a-col>-->
|
||||||
|
<!-- <a-col :md="8" :sm="24">-->
|
||||||
|
<!-- <a-form-item label="幂等id">-->
|
||||||
|
<!-- <a-input v-model="queryParam.idempotentId" placeholder="请输入幂等id" allowClear />-->
|
||||||
|
<!-- </a-form-item>-->
|
||||||
|
<!-- </a-col>-->
|
||||||
|
<!-- <a-col :md="8" :sm="24">-->
|
||||||
|
<!-- <a-form-item label="UniqueId">-->
|
||||||
|
<!-- <a-input v-model="queryParam.uniqueId" placeholder="请输入唯一id" allowClear/>-->
|
||||||
|
<!-- </a-form-item>-->
|
||||||
|
<!-- </a-col>-->
|
||||||
|
</template>
|
||||||
|
<a-col :md="(!advanced && 8) || 24" :sm="24">
|
||||||
|
<span
|
||||||
|
class="table-page-search-submitButtons"
|
||||||
|
:style="(advanced && { float: 'right', overflow: 'hidden' }) || {}"
|
||||||
|
>
|
||||||
|
<a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
|
||||||
|
<a-button style="margin-left: 8px" @click="() => (queryParam = {})">重置</a-button>
|
||||||
|
<a @click="toggleAdvanced" style="margin-left: 8px">
|
||||||
|
{{ advanced ? '收起' : '展开' }}
|
||||||
|
<a-icon :type="advanced ? 'up' : 'down'" />
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-form>
|
||||||
|
</div>
|
||||||
|
<div class="table-operator">
|
||||||
|
<a-button type="primary" icon="plus" @click="handleNew()">新增</a-button>
|
||||||
|
<!-- <a-button type="primary" icon="plus" @click="handleBatchNew()">批量</a-button>-->
|
||||||
|
<a-dropdown v-action:edit v-if="selectedRowKeys.length > 0">
|
||||||
|
<!-- <a-menu-item key="1"><a-icon type="delete" />删除</a-menu-item>-->
|
||||||
|
<!-- <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /> </a-button>-->
|
||||||
|
</a-dropdown>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<s-table
|
||||||
|
ref="table"
|
||||||
|
size="default"
|
||||||
|
:rowKey="(record) => record.id"
|
||||||
|
:columns="columns"
|
||||||
|
:data="loadData"
|
||||||
|
:scroll="{ x: 1800 }"
|
||||||
|
>
|
||||||
|
<span slot="serial" slot-scope="text, record">
|
||||||
|
{{ record.id }}
|
||||||
|
</span>
|
||||||
|
<span slot="workflowName" slot-scope="text, record">
|
||||||
|
<a href="#" @click="handlerOpenDrawer(record)">{{ text }}</a>
|
||||||
|
</span>
|
||||||
|
<span slot="jobStatus" slot-scope="text">
|
||||||
|
<a-tag :color="workflowStatus[text].color">
|
||||||
|
{{ workflowStatus[text].name }}
|
||||||
|
</a-tag>
|
||||||
|
</span>
|
||||||
|
<span slot="triggerType" slot-scope="text">
|
||||||
|
<a-tag :color="triggerType[text].color">
|
||||||
|
{{ triggerType[text].name }}
|
||||||
|
</a-tag>
|
||||||
|
</span>
|
||||||
|
<span slot="triggerInterval" slot-scope="text">
|
||||||
|
<span>{{ text }}</span>
|
||||||
|
</span>
|
||||||
|
<span slot="executorTimeout" slot-scope="text">
|
||||||
|
<span>{{ text }}(秒)</span>
|
||||||
|
</span>
|
||||||
|
<span slot="action" slot-scope="text, record">
|
||||||
|
<template>
|
||||||
|
<a-popconfirm
|
||||||
|
title="是否运行?"
|
||||||
|
ok-text="运行"
|
||||||
|
cancel-text="取消"
|
||||||
|
@confirm="handleTrigger(record)"
|
||||||
|
>
|
||||||
|
<a href="javascript:;">运行</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
<a-divider type="vertical" />
|
||||||
|
<a @click="handleInfo(record)">详情</a>
|
||||||
|
<a-divider type="vertical" />
|
||||||
|
<a @click="goJobBatchList(record)">批次</a>
|
||||||
|
<a-divider type="vertical" />
|
||||||
|
<a @click="handleEdit(record)">编辑</a>
|
||||||
|
<a-divider type="vertical" />
|
||||||
|
<a-popconfirm
|
||||||
|
title="是否关闭?"
|
||||||
|
ok-text="关闭"
|
||||||
|
cancel-text="取消"
|
||||||
|
@confirm="handleClose(record)"
|
||||||
|
>
|
||||||
|
<a href="javascript:;" v-if="record.jobStatus === 1">关闭</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
<a-divider type="vertical" v-if="record.jobStatus === 1" />
|
||||||
|
<a-popconfirm
|
||||||
|
title="是否开启?"
|
||||||
|
ok-text="开启"
|
||||||
|
cancel-text="取消"
|
||||||
|
@confirm="handleOpen(record)"
|
||||||
|
>
|
||||||
|
<a href="javascript:;" v-if="record.jobStatus === 0">开启</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
<a-divider type="vertical" v-if="record.jobStatus === 0" />
|
||||||
|
<a-popconfirm
|
||||||
|
title="是否删除任务?"
|
||||||
|
ok-text="删除"
|
||||||
|
cancel-text="取消"
|
||||||
|
@confirm="handleDel(record)"
|
||||||
|
v-if="$auth('job.del')"
|
||||||
|
>
|
||||||
|
<a href="javascript:;" v-if="record.jobStatus === 0">删除</a>
|
||||||
|
</a-popconfirm>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
</span>
|
||||||
|
</s-table>
|
||||||
|
|
||||||
|
<Drawer
|
||||||
|
title="任务详情"
|
||||||
|
placement="right"
|
||||||
|
:width="800"
|
||||||
|
:visibleAmplify="true"
|
||||||
|
:visible="openDrawer"
|
||||||
|
@closeDrawer="onClose"
|
||||||
|
@handlerAmplify="handleInfo"
|
||||||
|
>
|
||||||
|
<job-info ref="jobInfoRef" :showHeader="false" :column="2"/>
|
||||||
|
</Drawer>
|
||||||
|
|
||||||
|
</a-card>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import ATextarea from 'ant-design-vue/es/input/TextArea'
|
||||||
|
import AInput from 'ant-design-vue/es/input/Input'
|
||||||
|
import { STable, Drawer } from '@/components'
|
||||||
|
import { delJob, listPage, triggerJob, updateJobStatus } from '@/api/jobApi'
|
||||||
|
import { getAllGroupNameList } from '@/api/manage'
|
||||||
|
import enums from '@/utils/jobEnum'
|
||||||
|
import JobInfo from '@/views/job/JobInfo'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'JobList',
|
||||||
|
components: {
|
||||||
|
AInput,
|
||||||
|
ATextarea,
|
||||||
|
STable,
|
||||||
|
JobInfo,
|
||||||
|
Drawer
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
currentComponet: 'List',
|
||||||
|
record: '',
|
||||||
|
mdl: {},
|
||||||
|
visible: false,
|
||||||
|
// 高级搜索 展开/关闭
|
||||||
|
advanced: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParam: {},
|
||||||
|
workflowStatus: enums.workflowStatus,
|
||||||
|
triggerType: enums.triggerType,
|
||||||
|
blockStrategy: enums.blockStrategy,
|
||||||
|
executorType: enums.executorType,
|
||||||
|
// 表头
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
title: 'ID',
|
||||||
|
scopedSlots: { customRender: 'serial' },
|
||||||
|
fixed: 'left'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '任务名称',
|
||||||
|
dataIndex: 'workflowName',
|
||||||
|
scopedSlots: { customRender: 'workflowName' },
|
||||||
|
ellipsis: true,
|
||||||
|
fixed: 'left'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '组名称',
|
||||||
|
dataIndex: 'groupName',
|
||||||
|
width: '10%'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '触发时间',
|
||||||
|
dataIndex: 'nextTriggerAt',
|
||||||
|
width: '10%',
|
||||||
|
ellipsis: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '状态',
|
||||||
|
dataIndex: 'workflowStatus',
|
||||||
|
scopedSlots: { customRender: 'workflowStatus' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '触发类型',
|
||||||
|
dataIndex: 'triggerType',
|
||||||
|
scopedSlots: { customRender: 'triggerType' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '间隔时长',
|
||||||
|
dataIndex: 'triggerInterval',
|
||||||
|
scopedSlots: { customRender: 'triggerInterval' },
|
||||||
|
ellipsis: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '超时时间',
|
||||||
|
dataIndex: 'executorTimeout',
|
||||||
|
scopedSlots: { customRender: 'executorTimeout' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '更新时间',
|
||||||
|
dataIndex: 'updateDt',
|
||||||
|
sorter: true,
|
||||||
|
width: '10%'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
fixed: 'right',
|
||||||
|
dataIndex: 'action',
|
||||||
|
width: '180px',
|
||||||
|
scopedSlots: { customRender: 'action' }
|
||||||
|
}
|
||||||
|
],
|
||||||
|
// 加载数据方法 必须为 Promise 对象
|
||||||
|
loadData: (parameter) => {
|
||||||
|
return listPage(Object.assign(parameter, this.queryParam)).then((res) => {
|
||||||
|
return res
|
||||||
|
})
|
||||||
|
},
|
||||||
|
selectedRowKeys: [],
|
||||||
|
selectedRows: [],
|
||||||
|
|
||||||
|
// custom table alert & rowSelection
|
||||||
|
options: {
|
||||||
|
alert: {
|
||||||
|
show: true,
|
||||||
|
clear: () => {
|
||||||
|
this.selectedRowKeys = []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rowSelection: {
|
||||||
|
selectedRowKeys: this.selectedRowKeys,
|
||||||
|
onChange: this.onSelectChange
|
||||||
|
}
|
||||||
|
},
|
||||||
|
optionAlertShow: false,
|
||||||
|
groupNameList: [],
|
||||||
|
sceneList: [],
|
||||||
|
openDrawer: false,
|
||||||
|
currentShowRecord: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created () {
|
||||||
|
getAllGroupNameList().then((res) => {
|
||||||
|
this.groupNameList = res.data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleEdit (record) {
|
||||||
|
this.$router.push({ path: '/job/config', query: { id: record.id } })
|
||||||
|
},
|
||||||
|
goJobBatchList (record) {
|
||||||
|
this.$router.push({ path: '/job/batch/list', query: { jobId: record.id } })
|
||||||
|
},
|
||||||
|
handleNew () {
|
||||||
|
this.$router.push({ path: '/job/config' })
|
||||||
|
},
|
||||||
|
handleChange (value) {
|
||||||
|
},
|
||||||
|
toggleAdvanced () {
|
||||||
|
this.advanced = !this.advanced
|
||||||
|
},
|
||||||
|
handleInfo (record) {
|
||||||
|
record = record || this.currentShowRecord
|
||||||
|
this.$router.push({ path: '/job/info', query: { id: record.id, groupName: record.groupName } })
|
||||||
|
},
|
||||||
|
handleOk (record) {},
|
||||||
|
handleClose (record) {
|
||||||
|
updateJobStatus({ id: record.id, jobStatus: 0 }).then((res) => {
|
||||||
|
const { status } = res
|
||||||
|
if (status === 0) {
|
||||||
|
this.$message.error('关闭失败')
|
||||||
|
} else {
|
||||||
|
this.$refs.table.refresh(true)
|
||||||
|
this.$message.success('关闭成功')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleTrigger (record) {
|
||||||
|
triggerJob(record.id).then((res) => {
|
||||||
|
const { status } = res
|
||||||
|
if (status === 0) {
|
||||||
|
this.$message.error('执行失败')
|
||||||
|
} else {
|
||||||
|
// this.$refs.table.refresh(true)
|
||||||
|
this.$message.success('执行成功')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleOpen (record) {
|
||||||
|
updateJobStatus({ id: record.id, jobStatus: 1 }).then((res) => {
|
||||||
|
const { status } = res
|
||||||
|
if (status === 0) {
|
||||||
|
this.$message.error('开启失败')
|
||||||
|
} else {
|
||||||
|
this.$refs.table.refresh(true)
|
||||||
|
this.$message.success('开启成功')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleDel (record) {
|
||||||
|
delJob(record.id).then((res) => {
|
||||||
|
const { status } = res
|
||||||
|
if (status === 0) {
|
||||||
|
this.$message.error('删除失败')
|
||||||
|
} else {
|
||||||
|
this.$refs.table.refresh(true)
|
||||||
|
this.$message.success('删除成功')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
refreshTable (v) {
|
||||||
|
this.$refs.table.refresh(true)
|
||||||
|
},
|
||||||
|
onSelectChange (selectedRowKeys, selectedRows) {
|
||||||
|
this.selectedRowKeys = selectedRowKeys
|
||||||
|
this.selectedRows = selectedRows
|
||||||
|
},
|
||||||
|
handlerOpenDrawer (record) {
|
||||||
|
this.currentShowRecord = record
|
||||||
|
this.openDrawer = true
|
||||||
|
setTimeout(() => {
|
||||||
|
this.$refs.jobInfoRef.jobDetail(record.id)
|
||||||
|
}, 200)
|
||||||
|
},
|
||||||
|
onClose () {
|
||||||
|
this.openDrawer = false
|
||||||
|
this.currentShowRecord = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
Reference in New Issue
Block a user