Commit e5d52e14 by yuwei

项目初始化

parent cde6371f
......@@ -10,13 +10,13 @@ public class FlowDefinitionVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private String Key;
private String name;
private String key;
private String description;
private Integer version;
private String category;
private String deploymentId;
private String resourceName;
private String diagramResourceName;
private Integer suspensionState;
private String tenantId;
}
package cn.datax.service.workflow.api.vo;
import cn.datax.service.workflow.api.enums.VariablesEnum;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.Map;
@Data
public class FlowHistInstanceVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private String name;
private String startUserId;
private Date startTime;
private Date endTime;
private String durationInMillis;
private String processDefinitionId;
private String processDefinitionKey;
private String processDefinitionName;
private Integer processDefinitionVersion;
private String deploymentId;
private String processInstanceId;
private String deleteReason;
private String tenantId;
/**
* 业务相关
*/
private String businessKey;
private String businessCode;
private String businessName;
private Map<String,Object> variables;
public void setVariables(Map<String, Object> variables) {
this.variables = variables;
if(null != variables){
//放入业务常量
this.businessKey = (String) variables.get(VariablesEnum.businessKey.toString());
this.businessCode = (String) variables.get(VariablesEnum.businessCode.toString());
this.businessName = (String) variables.get(VariablesEnum.businessName.toString());
}
}
}
......@@ -13,41 +13,19 @@ public class FlowHistTaskVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private Integer revision;
private String name;
private String executionId;
private String processInstanceId;
private String processDefinitionId;
private String taskDefinitionId;
private String scopeId;
private String subScopeId;
private String scopeType;
private String scopeDefinitionId;
private Date createTime;
private Date endTime;
private String durationInMillis;
private String deleteReason;
private String name;
private String parentTaskId;
private String description;
private String owner;
private String assignee;
private String taskDefinitionKey;
private String formKey;
private Integer priority;
private String dueDate;
private Date claimTime;
private String category;
private String tenantId;
private Date lastUpdateTime;
private String queryVariables;
private Date time;
private Date startTime;
private String workTimeInMillis;
private Boolean inserted;
private String idPrefix;
private Boolean updated;
private Boolean deleted;
private Integer revisionNext;
/**
* 业务相关
*/
......
package cn.datax.service.workflow.api.vo;
import cn.datax.service.workflow.api.enums.VariablesEnum;
import lombok.Data;
import java.io.Serializable;
......@@ -12,52 +13,34 @@ public class FlowInstanceVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private String processDefinitionKey;
private String name;
private String startUserId;
private Date startTime;
private String processDefinitionId;
private String businessKey;
private String processDefinitionKey;
private String processDefinitionName;
private Date startTime;
private String deploymentId;
private String description;
private String name;
private Integer processDefinitionVersion;
private Map<String, Object> processVariables;
private String startUserId;
private String callbackId;
private String callbackType;
private String tenantId;
private String localizedDescription;
private String localizedName;
private String deploymentId;
private String processInstanceId;
private String activityId;
private String parentId;
private String rootProcessInstanceId;
private String superExecutionId;
private Integer suspensionState;
private String tenantId;
/**
* 业务相关
*/
private String businessKey;
private String businessCode;
private String businessName;
private Map<String,Object> variables;
public void setVariables(Map<String, Object> variables) {
this.variables = variables;
if(null != variables){
//放入业务常量
this.businessKey = (String) variables.get(VariablesEnum.businessKey.toString());
this.businessCode = (String) variables.get(VariablesEnum.businessCode.toString());
this.businessName = (String) variables.get(VariablesEnum.businessName.toString());
}
}
private Boolean isSuspended;
private Boolean isEnded;
}
......@@ -13,45 +13,17 @@ public class FlowTaskVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private String name;
private String owner;
private Integer assigneeUpdatedCount;
private String originalAssignee;
private String assignee;
private String parentTaskId;
private String name;
private String localizedName;
private String description;
private String localizedDescription;
private Integer priority;
private Date createTime;
private Date dueDate;
private Integer suspensionState;
private String category;
private Boolean isIdentityLinksInitialized;
private String executionId;
private String processInstanceId;
private String processDefinitionId;
private String taskDefinitionId;
private String scopeId;
private String subScopeId;
private String scopeType;
private String scopeDefinitionId;
private String taskDefinitionKey;
private String formKey;
private Boolean isCanceled;
private Boolean isCountEnabled;
private Integer variableCount;
private Integer identityLinkCount;
private Integer subTaskCount;
private Date claimTime;
private String tenantId;
private String eventName;
private String eventHandlerId;
private String idPrefix;
private Boolean forcedUpdate;
private Boolean isInserted;
private Boolean isUpdated;
private Boolean isDeleted;
/**
* 是否委派任务
*/
......
......@@ -5,6 +5,7 @@ import cn.datax.common.core.JsonPage;
import cn.datax.common.core.R;
import cn.datax.service.workflow.api.dto.ProcessInstanceCreateRequest;
import cn.datax.service.workflow.api.query.FlowInstanceQuery;
import cn.datax.service.workflow.api.vo.FlowHistInstanceVo;
import cn.datax.service.workflow.api.vo.FlowInstanceVo;
import cn.datax.service.workflow.service.FlowInstanceService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -34,13 +35,13 @@ public class FlowInstanceController extends BaseController {
return flowInstanceVo;
}
@ApiOperation(value = "分页查询")
@ApiOperation(value = "分页查询运行中的流程实例")
@ApiImplicitParams({
@ApiImplicitParam(name = "flowInstanceQuery", value = "查询实体flowInstanceQuery", required = true, dataTypeClass = FlowInstanceQuery.class)
})
@GetMapping("/page")
public R page(FlowInstanceQuery flowInstanceQuery) {
Page<FlowInstanceVo> page = flowInstanceService.page(flowInstanceQuery);
@GetMapping("/pageRunning")
public R pageRunning(FlowInstanceQuery flowInstanceQuery) {
Page<FlowInstanceVo> page = flowInstanceService.pageRunning(flowInstanceQuery);
JsonPage<FlowInstanceVo> jsonPage = new JsonPage<>(page.getCurrent(), page.getSize(), page.getTotal(), page.getRecords());
return R.ok().setData(jsonPage);
}
......@@ -51,8 +52,9 @@ public class FlowInstanceController extends BaseController {
})
@GetMapping("/pageMyStarted")
public R pageMyStarted(FlowInstanceQuery flowInstanceQuery) {
flowInstanceService.pageMyStartedProcessInstance(flowInstanceQuery);
return R.ok();
Page<FlowHistInstanceVo> page = flowInstanceService.pageMyStartedProcessInstance(flowInstanceQuery);
JsonPage<FlowHistInstanceVo> jsonPage = new JsonPage<>(page.getCurrent(), page.getSize(), page.getTotal(), page.getRecords());
return R.ok().setData(jsonPage);
}
@ApiOperation(value = "分页查询本人参与的流程实例")
......@@ -61,8 +63,9 @@ public class FlowInstanceController extends BaseController {
})
@GetMapping("/pageMyInvolved")
public R pageMyInvolved(FlowInstanceQuery flowInstanceQuery) {
flowInstanceService.pageMyInvolvedProcessInstance(flowInstanceQuery);
return R.ok();
Page<FlowHistInstanceVo> page = flowInstanceService.pageMyInvolvedProcessInstance(flowInstanceQuery);
JsonPage<FlowHistInstanceVo> jsonPage = new JsonPage<>(page.getCurrent(), page.getSize(), page.getTotal(), page.getRecords());
return R.ok().setData(jsonPage);
}
@ApiOperation(value = "激活流程实例", notes = "根据url的id来指定激活流程实例")
......@@ -85,7 +88,7 @@ public class FlowInstanceController extends BaseController {
@ApiImplicitParam(name = "processInstanceId", value = "流程实例ID", required = true, dataType = "String", paramType = "path")
@DeleteMapping("/delete/{processInstanceId}")
public R delete(@PathVariable String processInstanceId) {
flowInstanceService.deleteProcessInstance(processInstanceId, null);
flowInstanceService.deleteProcessInstance(processInstanceId);
return R.ok();
}
......
......@@ -20,7 +20,6 @@ public class InitialAuditCompleteTaskListener implements TaskListener {
log.info("任务执行人:{}", delegateTask.getAssignee());
log.info("任务配置ID: {}", delegateTask.getTaskDefinitionKey());
Map<String, Object> variables = delegateTask.getVariables();
log.info("获取Variables:{}", variables);
Boolean approved = (Boolean) Optional.ofNullable(variables).map(s -> s.get(VariablesEnum.approved.toString())).orElse(true);
log.info("审核结果: {}", approved);
// 退回操作
......
......@@ -13,9 +13,9 @@ public class InitialAuditCreateTaskListener implements TaskListener {
public void notify(DelegateTask delegateTask) {
log.info("进入初审节点用户任务启动监听器");
TaskService taskService = SpringContextHolder.getBean(TaskService.class);
taskService.setAssignee(delegateTask.getId(), "1214835832967581698");
// taskService.setAssignee(delegateTask.getId(), "1214835832967581698");
// taskService.addCandidateUser(delegateTask.getId(), "");
// taskService.addCandidateGroup(delegateTask.getId(), "");
taskService.addCandidateGroup(delegateTask.getId(), "1214826565321543682");
log.info("Variables:{}", delegateTask.getVariables());
log.info("任务执行人:{}", delegateTask.getAssignee());
log.info("任务配置ID: {}", delegateTask.getTaskDefinitionKey());
......
......@@ -2,6 +2,7 @@ package cn.datax.service.workflow.service;
import cn.datax.service.workflow.api.dto.ProcessInstanceCreateRequest;
import cn.datax.service.workflow.api.query.FlowInstanceQuery;
import cn.datax.service.workflow.api.vo.FlowHistInstanceVo;
import cn.datax.service.workflow.api.vo.FlowInstanceVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -10,11 +11,11 @@ import java.io.InputStream;
public interface FlowInstanceService {
/**
* 分页查询流程实例
* 分页查询运行中的流程实例
* @param flowInstanceQuery
* @return
*/
Page<FlowInstanceVo> page(FlowInstanceQuery flowInstanceQuery);
Page<FlowInstanceVo> pageRunning(FlowInstanceQuery flowInstanceQuery);
/**
* 激活流程实例
......@@ -31,9 +32,8 @@ public interface FlowInstanceService {
/**
* 删除流程实例
* @param processInstanceId
* @param deleteReason
*/
void deleteProcessInstance(String processInstanceId, String deleteReason);
void deleteProcessInstance(String processInstanceId);
/**
* 启动流程实例
......@@ -59,14 +59,14 @@ public interface FlowInstanceService {
* @param flowInstanceQuery
* @return
*/
void pageMyStartedProcessInstance(FlowInstanceQuery flowInstanceQuery);
Page<FlowHistInstanceVo> pageMyStartedProcessInstance(FlowInstanceQuery flowInstanceQuery);
/**
* 本人参与的流程实例
* @param flowInstanceQuery
* @return
*/
void pageMyInvolvedProcessInstance(FlowInstanceQuery flowInstanceQuery);
Page<FlowHistInstanceVo> pageMyInvolvedProcessInstance(FlowInstanceQuery flowInstanceQuery);
/**
* 获取审批意见
......
......@@ -4,9 +4,9 @@ import cn.datax.common.utils.SecurityUtil;
import cn.datax.service.workflow.api.dto.ProcessInstanceCreateRequest;
import cn.datax.service.workflow.api.enums.VariablesEnum;
import cn.datax.service.workflow.api.query.FlowInstanceQuery;
import cn.datax.service.workflow.api.vo.FlowHistInstanceVo;
import cn.datax.service.workflow.api.vo.FlowInstanceVo;
import cn.datax.service.workflow.service.FlowInstanceService;
import cn.datax.service.workflow.utils.BeanCopyUtil;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -34,6 +34,7 @@ import org.springframework.util.Assert;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Slf4j
@Service
......@@ -55,7 +56,7 @@ public class FlowInstanceServiceImpl implements FlowInstanceService {
private static final String FONT_NAME = "宋体";
@Override
public Page<FlowInstanceVo> page(FlowInstanceQuery flowInstanceQuery) {
public Page<FlowInstanceVo> pageRunning(FlowInstanceQuery flowInstanceQuery) {
ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery();
if(StrUtil.isNotBlank(flowInstanceQuery.getName())){
processInstanceQuery.processInstanceNameLike(flowInstanceQuery.getName());
......@@ -72,10 +73,17 @@ public class FlowInstanceServiceImpl implements FlowInstanceService {
List<ProcessInstance> processInstanceList = processInstanceQuery.includeProcessVariables()
.orderByStartTime().desc()
.listPage((flowInstanceQuery.getPageNum() - 1) * flowInstanceQuery.getPageSize(), flowInstanceQuery.getPageSize());
List<FlowInstanceVo> flowInstanceVoList = BeanCopyUtil.copyListProperties(processInstanceList, FlowInstanceVo::new);
Page<FlowInstanceVo> page = new Page<>(flowInstanceQuery.getPageNum(), flowInstanceQuery.getPageSize());
List<FlowInstanceVo> list = new ArrayList<>();
processInstanceList.stream().forEach(p -> {
FlowInstanceVo flowInstanceVo = new FlowInstanceVo();
BeanUtil.copyProperties(p, flowInstanceVo, "variables");
//放入流程参数
flowInstanceVo.setVariables(p.getProcessVariables());
list.add(flowInstanceVo);
});
long count = processInstanceQuery.count();
page.setRecords(flowInstanceVoList);
Page<FlowInstanceVo> page = new Page<>(flowInstanceQuery.getPageNum(), flowInstanceQuery.getPageSize());
page.setRecords(list);
page.setTotal(count);
return page;
}
......@@ -93,9 +101,15 @@ public class FlowInstanceServiceImpl implements FlowInstanceService {
}
@Override
public void deleteProcessInstance(String processInstanceId, String deleteReason) {
public void deleteProcessInstance(String processInstanceId) {
// 发送消息队列
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
Map<String, Object> variables = processInstance.getProcessVariables();
String businessKey = (String) variables.get(VariablesEnum.businessKey.toString());
String businessCode = (String) variables.get(VariablesEnum.businessCode.toString());
log.info("业务撤销:{},{}", businessKey, businessCode);
log.info("成功删除流程实例ID:{}", processInstanceId);
runtimeService.deleteProcessInstance(processInstanceId, deleteReason);
runtimeService.deleteProcessInstance(processInstanceId, "用户撤销");
}
@Override
......@@ -183,7 +197,7 @@ public class FlowInstanceServiceImpl implements FlowInstanceService {
}
@Override
public void pageMyStartedProcessInstance(FlowInstanceQuery flowInstanceQuery) {
public Page<FlowHistInstanceVo> pageMyStartedProcessInstance(FlowInstanceQuery flowInstanceQuery) {
HistoricProcessInstanceQuery historicProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery();
historicProcessInstanceQuery.startedBy(SecurityUtil.getUserId());
if(StrUtil.isNotBlank(flowInstanceQuery.getName())){
......@@ -201,11 +215,23 @@ public class FlowInstanceServiceImpl implements FlowInstanceService {
List<HistoricProcessInstance> historicProcessInstanceList = historicProcessInstanceQuery.includeProcessVariables()
.orderByProcessInstanceStartTime().desc()
.listPage((flowInstanceQuery.getPageNum() - 1) * flowInstanceQuery.getPageSize(), flowInstanceQuery.getPageSize());
List<FlowHistInstanceVo> list = new ArrayList<>();
historicProcessInstanceList.stream().forEach(p -> {
FlowHistInstanceVo flowHistInstanceVo = new FlowHistInstanceVo();
BeanUtil.copyProperties(p, flowHistInstanceVo, "variables");
//放入流程参数
flowHistInstanceVo.setVariables(p.getProcessVariables());
list.add(flowHistInstanceVo);
});
long count = historicProcessInstanceQuery.count();
Page<FlowHistInstanceVo> page = new Page<>(flowInstanceQuery.getPageNum(), flowInstanceQuery.getPageSize());
page.setRecords(list);
page.setTotal(count);
return page;
}
@Override
public void pageMyInvolvedProcessInstance(FlowInstanceQuery flowInstanceQuery) {
public Page<FlowHistInstanceVo> pageMyInvolvedProcessInstance(FlowInstanceQuery flowInstanceQuery) {
HistoricProcessInstanceQuery historicProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery();
historicProcessInstanceQuery.involvedUser(SecurityUtil.getUserId());
if(StrUtil.isNotBlank(flowInstanceQuery.getName())){
......@@ -223,7 +249,19 @@ public class FlowInstanceServiceImpl implements FlowInstanceService {
List<HistoricProcessInstance> historicProcessInstanceList = historicProcessInstanceQuery.includeProcessVariables()
.orderByProcessInstanceStartTime().desc()
.listPage((flowInstanceQuery.getPageNum() - 1) * flowInstanceQuery.getPageSize(), flowInstanceQuery.getPageSize());
List<FlowHistInstanceVo> list = new ArrayList<>();
historicProcessInstanceList.stream().forEach(p -> {
FlowHistInstanceVo flowHistInstanceVo = new FlowHistInstanceVo();
BeanUtil.copyProperties(p, flowHistInstanceVo, "variables");
//放入流程参数
flowHistInstanceVo.setVariables(p.getProcessVariables());
list.add(flowHistInstanceVo);
});
long count = historicProcessInstanceQuery.count();
Page<FlowHistInstanceVo> page = new Page<>(flowInstanceQuery.getPageNum(), flowInstanceQuery.getPageSize());
page.setRecords(list);
page.setTotal(count);
return page;
}
@Override
......
......@@ -53,8 +53,7 @@ public class FlowTaskServiceImpl implements FlowTaskService {
taskQuery.processVariableValueLike(VariablesEnum.businessName.toString(), flowTaskQuery.getBusinessName());
}
List<Task> taskList = taskQuery.includeProcessVariables()
.orderByTaskPriority().desc()
.orderByTaskCreateTime().desc()
.orderByTaskCreateTime().asc()
.listPage((flowTaskQuery.getPageNum() - 1) * flowTaskQuery.getPageSize(), flowTaskQuery.getPageSize());
List<FlowTaskVo> list = new ArrayList<>();
taskList.stream().forEach(task -> {
......
import request from '@/utils/request'
export function pageInstance(data) {
export function pageRunningInstance(data) {
return request({
url: '/workflow/instances/page',
url: '/workflow/instances/pageRunning',
method: 'get',
params: data
})
}
export function pageMyStartedInstance(data) {
return request({
url: '/workflow/instances/pageMyStarted',
method: 'get',
params: data
})
}
export function pageMyInvolvedInstance(data) {
return request({
url: '/workflow/instances/pageMyInvolved',
method: 'get',
params: data
})
......
import request from '@/utils/request'
export function pageTodoTask(data) {
return request({
url: '/workflow/tasks/pageTodo',
method: 'get',
params: data
})
}
export function pageDoneTask(data) {
return request({
url: '/workflow/tasks/pageDone',
method: 'get',
params: data
})
}
export function executeTask(data) {
return request({
url: '/workflow/tasks/execute/' + data.taskId,
method: 'post',
data: data
})
}
<template>
<el-card class="box-card" shadow="always">
<el-form ref="queryForm" :model="queryParams" :inline="true">
<el-form-item label="流程实例名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入流程实例名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table
v-loading="loading"
:data="tableDataList"
border
tooltip-effect="dark"
:height="tableHeight"
style="width: 100%;margin: 15px 0;"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center">
<template slot-scope="scope">
<span>{{ scope.$index +1 }}</span>
</template>
</el-table-column>
<template v-for="(item, index) in tableColumns">
<el-table-column
v-if="item.show"
:key="index"
:prop="item.prop"
:label="item.label"
:formatter="item.formatter"
align="center"
show-overflow-tooltip
/>
</template>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-popover
placement="left"
trigger="click"
>
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleTrack(scope.row)"
>流程追踪</el-button>
</el-popover>
</template>
</el-table-column>
</el-table>
<el-pagination
:page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next, jumper"
:current-page.sync="queryParams.pageNum"
:page-size.sync="queryParams.pageSize"
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
<!-- 流程图对话框 -->
<el-dialog :title="dialog.title" :visible.sync="dialog.track" width="600px" append-to-body>
<el-image :src="flowSrc">
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline"></i>
</div>
</el-image>
<div slot="footer" class="dialog-footer">
<el-button @click="dialog.track = false">取 消</el-button>
</div>
</el-dialog>
</el-card>
</template>
<script>
import { pageMyInvolvedInstance, flowTrack } from '@/api/workflow/instance'
export default {
name: 'MyInvolvedInstanceList',
data() {
return {
tableHeight: document.body.offsetHeight - 310 + 'px',
// 展示切换
showOptions: {
data: {},
showList: true
},
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 表格头
tableColumns: [
{ prop: 'processDefinitionId', label: '流程定义ID', show: true },
{ prop: 'processDefinitionName', label: '流程定义名称', show: true },
{ prop: 'name', label: '流程实列名称', show: true },
{
prop: 'suspensionState',
label: '状态',
show: true,
formatter: this.statusFormatter
},
{ prop: 'startTime', label: '开始时间', show: true }
],
// 表格数据
tableDataList: [],
// 总数据条数
total: 0,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 20,
name: ''
},
dialog: {
// 是否显示弹出层
track: false,
// 弹出层标题
title: ''
},
flowSrc: ''
}
},
created() {
this.getList()
},
methods: {
/** 查询数据集列表 */
getList() {
this.loading = true
pageMyInvolvedInstance(this.queryParams).then(response => {
this.loading = false
if (response.success) {
const { data } = response
this.tableDataList = data.data
this.total = data.total
}
})
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {
pageNum: 1,
pageSize: 20,
name: ''
}
this.handleQuery()
},
/** 多选框选中数据 */
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
handleTrack(row) {
flowTrack(row.id).then(response => {
const blob = new Blob([response])
this.flowSrc = window.URL.createObjectURL(blob)
this.dialog.title = '流程追踪'
this.dialog.track = true
})
},
handleSizeChange(val) {
console.log(`每页 ${val} 条`)
this.queryParams.pageNum = 1
this.queryParams.pageSize = val
this.getList()
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`)
this.queryParams.pageNum = val
this.getList()
},
statusFormatter(row, column, cellValue, index) {
if (cellValue === 1) {
return <el-tag type='success'>激活</el-tag>
} else if (cellValue === 2) {
return <el-tag type='warning'>挂起</el-tag>
}
}
}
}
</script>
<style lang="scss" scoped>
.right-toolbar {
float: right;
}
.el-card ::v-deep .el-card__body {
height: calc(100vh - 170px);
}
</style>
<template>
<div class="app-container">
<transition name="el-zoom-in-center">
<instance-list v-if="options.showList" @showCard="showCard" />
<my-involved-instance-list v-if="options.showList" @showCard="showCard" />
</transition>
</div>
</template>
<script>
import InstanceList from './InstanceList'
import MyInvolvedInstanceList from './MyInvolvedInstanceList'
export default {
name: 'Instance',
components: { InstanceList },
name: 'MyInvolvedInstance',
components: { MyInvolvedInstanceList },
data() {
return {
options: {
......
<template>
<el-card class="box-card" shadow="always">
<el-form ref="queryForm" :model="queryParams" :inline="true">
<el-form-item label="流程实例名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入流程实例名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table
v-loading="loading"
:data="tableDataList"
border
tooltip-effect="dark"
:height="tableHeight"
style="width: 100%;margin: 15px 0;"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center">
<template slot-scope="scope">
<span>{{ scope.$index +1 }}</span>
</template>
</el-table-column>
<template v-for="(item, index) in tableColumns">
<el-table-column
v-if="item.show"
:key="index"
:prop="item.prop"
:label="item.label"
:formatter="item.formatter"
align="center"
show-overflow-tooltip
/>
</template>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-popover
placement="left"
trigger="click"
>
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleTrack(scope.row)"
>流程追踪</el-button>
<el-button slot="reference">操作</el-button>
</el-popover>
</template>
</el-table-column>
</el-table>
<el-pagination
:page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next, jumper"
:current-page.sync="queryParams.pageNum"
:page-size.sync="queryParams.pageSize"
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
<!-- 流程图对话框 -->
<el-dialog :title="dialog.title" :visible.sync="dialog.track" width="600px" append-to-body>
<el-image :src="flowSrc">
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline"></i>
</div>
</el-image>
<div slot="footer" class="dialog-footer">
<el-button @click="dialog.track = false">取 消</el-button>
</div>
</el-dialog>
</el-card>
</template>
<script>
import { pageMyStartedInstance, flowTrack } from '@/api/workflow/instance'
export default {
name: 'MyStartedInstanceList',
data() {
return {
tableHeight: document.body.offsetHeight - 310 + 'px',
// 展示切换
showOptions: {
data: {},
showList: true
},
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 表格头
tableColumns: [
{ prop: 'processDefinitionId', label: '流程定义ID', show: true },
{ prop: 'processDefinitionName', label: '流程定义名称', show: true },
{ prop: 'name', label: '流程实列名称', show: true },
{
prop: 'suspensionState',
label: '状态',
show: true,
formatter: this.statusFormatter
},
{ prop: 'startTime', label: '开始时间', show: true }
],
// 表格数据
tableDataList: [],
// 总数据条数
total: 0,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 20,
name: ''
},
dialog: {
// 是否显示弹出层
track: false,
// 弹出层标题
title: ''
},
flowSrc: ''
}
},
created() {
this.getList()
},
methods: {
/** 查询数据集列表 */
getList() {
this.loading = true
pageMyStartedInstance(this.queryParams).then(response => {
this.loading = false
if (response.success) {
const { data } = response
this.tableDataList = data.data
this.total = data.total
}
})
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {
pageNum: 1,
pageSize: 20,
name: ''
}
this.handleQuery()
},
/** 多选框选中数据 */
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
handleTrack(row) {
flowTrack(row.id).then(response => {
const blob = new Blob([response])
this.flowSrc = window.URL.createObjectURL(blob)
this.dialog.title = '流程追踪'
this.dialog.track = true
})
},
handleSizeChange(val) {
console.log(`每页 ${val} 条`)
this.queryParams.pageNum = 1
this.queryParams.pageSize = val
this.getList()
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`)
this.queryParams.pageNum = val
this.getList()
},
statusFormatter(row, column, cellValue, index) {
if (cellValue === 1) {
return <el-tag type='success'>激活</el-tag>
} else if (cellValue === 2) {
return <el-tag type='warning'>挂起</el-tag>
}
}
}
}
</script>
<style lang="scss" scoped>
.right-toolbar {
float: right;
}
.el-card ::v-deep .el-card__body {
height: calc(100vh - 170px);
}
</style>
<template>
<div class="app-container">
<transition name="el-zoom-in-center">
<my-started-instance-list v-if="options.showList" @showCard="showCard" />
</transition>
</div>
</template>
<script>
import MyStartedInstanceList from './MyStartedInstanceList'
export default {
name: 'MyStartedInstance',
components: { MyStartedInstanceList },
data() {
return {
options: {
data: {},
showList: true
}
}
},
methods: {
showCard(data) {
Object.assign(this.options, data)
}
}
}
</script>
<style lang="scss" scoped>
</style>
......@@ -104,7 +104,7 @@
</template>
<script>
import { pageInstance, delInstance, activateInstance, suspendInstance, flowTrack } from '@/api/workflow/instance'
import { pageRunningInstance, delInstance, activateInstance, suspendInstance, flowTrack } from '@/api/workflow/instance'
export default {
name: 'InstanceList',
......@@ -163,7 +163,7 @@ export default {
/** 查询数据集列表 */
getList() {
this.loading = true
pageInstance(this.queryParams).then(response => {
pageRunningInstance(this.queryParams).then(response => {
this.loading = false
if (response.success) {
const { data } = response
......
<template>
<div class="app-container">
<transition name="el-zoom-in-center">
<running-instance-list v-if="options.showList" @showCard="showCard" />
</transition>
</div>
</template>
<script>
import RunningInstanceList from './RunningInstanceList'
export default {
name: 'RunningInstance',
components: { RunningInstanceList },
data() {
return {
options: {
data: {},
showList: true
}
}
},
methods: {
showCard(data) {
Object.assign(this.options, data)
}
}
}
</script>
<style lang="scss" scoped>
</style>
<template>
<el-card class="box-card" shadow="always">
<el-form ref="queryForm" :model="queryParams" :inline="true">
<el-form-item label="业务类型" prop="businessCode">
<el-input
v-model="queryParams.businessCode"
placeholder="请输入业务类型"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="业务名称" prop="businessName">
<el-input
v-model="queryParams.businessName"
placeholder="请输入业务名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table
v-loading="loading"
:data="tableDataList"
border
tooltip-effect="dark"
:height="tableHeight"
style="width: 100%;margin: 15px 0;"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center">
<template slot-scope="scope">
<span>{{ scope.$index +1 }}</span>
</template>
</el-table-column>
<template v-for="(item, index) in tableColumns">
<el-table-column
v-if="item.show"
:key="index"
:prop="item.prop"
:label="item.label"
:formatter="item.formatter"
align="center"
show-overflow-tooltip
/>
</template>
</el-table>
<el-pagination
:page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next, jumper"
:current-page.sync="queryParams.pageNum"
:page-size.sync="queryParams.pageSize"
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</el-card>
</template>
<script>
import { pageDoneTask } from '@/api/workflow/task'
export default {
name: 'TaskDoneList',
data() {
return {
tableHeight: document.body.offsetHeight - 310 + 'px',
// 展示切换
showOptions: {
data: {},
showList: true
},
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 表格头
tableColumns: [
{ prop: 'name', label: '节点名称', show: true },
{ prop: 'createTime', label: '开始时间', show: true },
{ prop: 'endTime', label: '结束时间', show: true },
{ prop: 'durationInMillis', label: '耗时', show: true }
],
// 表格数据
tableDataList: [],
// 总数据条数
total: 0,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 20,
businessCode: '',
businessName: ''
}
}
},
created() {
this.getList()
},
methods: {
/** 查询数据集列表 */
getList() {
this.loading = true
pageDoneTask(this.queryParams).then(response => {
this.loading = false
if (response.success) {
const { data } = response
this.tableDataList = data.data
this.total = data.total
}
})
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {
pageNum: 1,
pageSize: 20,
businessCode: '',
businessName: ''
}
this.handleQuery()
},
/** 多选框选中数据 */
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
handleSizeChange(val) {
console.log(`每页 ${val} 条`)
this.queryParams.pageNum = 1
this.queryParams.pageSize = val
this.getList()
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`)
this.queryParams.pageNum = val
this.getList()
},
statusFormatter(row, column, cellValue, index) {
if (cellValue === 1) {
return <el-tag type='success'>激活</el-tag>
} else if (cellValue === 2) {
return <el-tag type='warning'>挂起</el-tag>
}
}
}
}
</script>
<style lang="scss" scoped>
.right-toolbar {
float: right;
}
.el-card ::v-deep .el-card__body {
height: calc(100vh - 170px);
}
</style>
<template>
<div class="app-container">
<transition name="el-zoom-in-center">
<task-done-list v-if="options.showList" @showCard="showCard" />
</transition>
</div>
</template>
<script>
import TaskDoneList from './TaskDoneList'
export default {
name: 'TaskDone',
components: { TaskDoneList },
data() {
return {
options: {
data: {},
showList: true
}
}
},
methods: {
showCard(data) {
Object.assign(this.options, data)
}
}
}
</script>
<style lang="scss" scoped>
</style>
<template>
<div class="app-container">
Task
</div>
</template>
<script>
export default {
name: 'Task'
}
</script>
<style lang="scss" scoped>
</style>
<template>
<el-card class="box-card" shadow="always">
<el-form ref="queryForm" :model="queryParams" :inline="true">
<el-form-item label="业务类型" prop="businessCode">
<el-input
v-model="queryParams.businessCode"
placeholder="请输入业务类型"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="业务名称" prop="businessName">
<el-input
v-model="queryParams.businessName"
placeholder="请输入业务名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table
v-loading="loading"
:data="tableDataList"
border
tooltip-effect="dark"
:height="tableHeight"
style="width: 100%;margin: 15px 0;"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="55" align="center">
<template slot-scope="scope">
<span>{{ scope.$index +1 }}</span>
</template>
</el-table-column>
<template v-for="(item, index) in tableColumns">
<el-table-column
v-if="item.show"
:key="index"
:prop="item.prop"
:label="item.label"
:formatter="item.formatter"
align="center"
show-overflow-tooltip
/>
</template>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-popover
placement="left"
trigger="click"
>
<el-button
v-if="scope.row.assignee === undefined || scope.row.assignee === null || scope.row.assignee === ''"
size="mini"
type="text"
icon="el-icon-view"
@click="handleClaim(scope.row)"
>签收</el-button>
<el-button
v-if="scope.row.assignee && scope.row.assignee === user.id"
size="mini"
type="text"
icon="el-icon-view"
@click="handleUnClaim(scope.row)"
>反签收</el-button>
<el-button
v-if="scope.row.assignee && scope.row.assignee === user.id"
size="mini"
type="text"
icon="el-icon-view"
@click="handleDelegate(scope.row)"
>委派</el-button>
<el-button
v-if="scope.row.assignee && scope.row.assignee === user.id"
size="mini"
type="text"
icon="el-icon-view"
@click="handleAssignee(scope.row)"
>转办</el-button>
<el-button
v-if="scope.row.assignee && scope.row.assignee === user.id"
size="mini"
type="text"
icon="el-icon-delete"
@click="handleTask(scope.row)"
>审批</el-button>
<el-button slot="reference">操作</el-button>
</el-popover>
</template>
</el-table-column>
</el-table>
<el-pagination
:page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next, jumper"
:current-page.sync="queryParams.pageNum"
:page-size.sync="queryParams.pageSize"
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</el-card>
</template>
<script>
import { pageTodoTask, executeTask } from '@/api/workflow/task'
import { mapGetters } from 'vuex'
export default {
name: 'TaskTodoList',
data() {
return {
tableHeight: document.body.offsetHeight - 310 + 'px',
// 展示切换
showOptions: {
data: {},
showList: true
},
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 表格头
tableColumns: [
{ prop: 'name', label: '节点名称', show: true },
{ prop: 'createTime', label: '创建时间', show: true }
],
// 表格数据
tableDataList: [],
// 总数据条数
total: 0,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 20,
businessCode: '',
businessName: ''
}
}
},
created() {
this.getList()
},
computed: {
...mapGetters([
'user'
])
},
methods: {
/** 查询数据集列表 */
getList() {
this.loading = true
pageTodoTask(this.queryParams).then(response => {
this.loading = false
if (response.success) {
const { data } = response
this.tableDataList = data.data
this.total = data.total
}
})
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {
pageNum: 1,
pageSize: 20,
businessCode: '',
businessName: ''
}
this.handleQuery()
},
/** 多选框选中数据 */
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
handleClaim(row) {
this.$confirm('签收任务?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const data = {
action: 'claim',
processInstanceId: row.processInstanceId,
taskId: row.id,
userId: '',
message: '',
variables: { approved: true }
}
executeTask(data).then(response => {
if (response.success) {
this.$message.success('任务签收成功')
this.getList()
}
})
}).catch(() => {
})
},
handleUnClaim(row) {
this.$confirm('反签收任务?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const data = {
action: 'unclaim',
processInstanceId: row.processInstanceId,
taskId: row.id,
userId: '',
message: '',
variables: { approved: true }
}
executeTask(data).then(response => {
if (response.success) {
this.$message.success('任务反签收成功')
this.getList()
}
})
}).catch(() => {
})
},
handleDelegate(row) {},
handleAssignee(row) {},
handleTask(row) {},
handleSizeChange(val) {
console.log(`每页 ${val} 条`)
this.queryParams.pageNum = 1
this.queryParams.pageSize = val
this.getList()
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`)
this.queryParams.pageNum = val
this.getList()
},
statusFormatter(row, column, cellValue, index) {
if (cellValue === 1) {
return <el-tag type='success'>激活</el-tag>
} else if (cellValue === 2) {
return <el-tag type='warning'>挂起</el-tag>
}
}
}
}
</script>
<style lang="scss" scoped>
.right-toolbar {
float: right;
}
.el-card ::v-deep .el-card__body {
height: calc(100vh - 170px);
}
</style>
<template>
<div class="app-container">
<transition name="el-zoom-in-center">
<task-todo-list v-if="options.showList" @showCard="showCard" />
</transition>
</div>
</template>
<script>
import TaskTodoList from './TaskTodoList'
export default {
name: 'TaskTodo',
components: { TaskTodoList },
data() {
return {
options: {
data: {},
showList: true
}
}
},
methods: {
showCard(data) {
Object.assign(this.options, data)
}
}
}
</script>
<style lang="scss" scoped>
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment