fix -- 修复"我的流程"显示分类错误bug

This commit is contained in:
konbai
2022-03-12 00:01:21 +08:00
parent ae24174746
commit 77850488e4
5 changed files with 36 additions and 23 deletions

View File

@@ -49,7 +49,7 @@ public class WfDefinitionVo {
*/
@ExcelProperty(value = "分类编码")
@ApiModelProperty("分类编码")
private String categoryCode;
private String category;
@ApiModelProperty("版本")
private Integer version;

View File

@@ -86,7 +86,7 @@ public class WfDefinitionServiceImpl extends FlowServiceFactory implements IWfDe
vo.setProcessKey(processDefinition.getKey());
vo.setProcessName(processDefinition.getName());
vo.setVersion(processDefinition.getVersion());
vo.setCategoryCode(processDefinition.getCategory());
vo.setCategory(processDefinition.getCategory());
vo.setDeploymentId(processDefinition.getDeploymentId());
vo.setSuspended(processDefinition.isSuspended());
WfFormVo formVo = formMapper.selectFormByDeployId(deploymentId);
@@ -95,7 +95,7 @@ public class WfDefinitionServiceImpl extends FlowServiceFactory implements IWfDe
vo.setFormName(formVo.getFormName());
}
// 流程定义时间
vo.setCategoryCode(deployment.getCategory());
vo.setCategory(deployment.getCategory());
vo.setDeploymentTime(deployment.getDeploymentTime());
definitionVoList.add(vo);
}
@@ -125,7 +125,7 @@ public class WfDefinitionServiceImpl extends FlowServiceFactory implements IWfDe
vo.setProcessKey(item.getKey());
vo.setProcessName(item.getName());
vo.setVersion(item.getVersion());
vo.setCategoryCode(item.getCategory());
vo.setCategory(item.getCategory());
vo.setDeploymentId(item.getDeploymentId());
vo.setSuspended(item.isSuspended());
// BeanUtil.copyProperties(item, vo);

View File

@@ -424,29 +424,29 @@ public class WfTaskServiceImpl extends FlowServiceFactory implements IWfTaskServ
List<HistoricProcessInstance> historicProcessInstances = historicProcessInstanceQuery
.listPage(offset, pageQuery.getPageSize());
page.setTotal(historicProcessInstanceQuery.count());
List<WfTaskVo> flowList = new ArrayList<>();
List<WfTaskVo> taskVoList = new ArrayList<>();
for (HistoricProcessInstance hisIns : historicProcessInstances) {
WfTaskVo flowTask = new WfTaskVo();
flowTask.setCreateTime(hisIns.getStartTime());
flowTask.setFinishTime(hisIns.getEndTime());
flowTask.setProcInsId(hisIns.getId());
WfTaskVo taskVo = new WfTaskVo();
taskVo.setCreateTime(hisIns.getStartTime());
taskVo.setFinishTime(hisIns.getEndTime());
taskVo.setProcInsId(hisIns.getId());
// 计算耗时
if (Objects.nonNull(hisIns.getEndTime())) {
long time = hisIns.getEndTime().getTime() - hisIns.getStartTime().getTime();
flowTask.setDuration(getDate(time));
taskVo.setDuration(getDate(time));
} else {
long time = System.currentTimeMillis() - hisIns.getStartTime().getTime();
flowTask.setDuration(getDate(time));
taskVo.setDuration(getDate(time));
}
// 流程部署实例信息
Deployment deployment = repositoryService.createDeploymentQuery()
.deploymentId(hisIns.getDeploymentId()).singleResult();
flowTask.setDeployId(hisIns.getDeploymentId());
flowTask.setProcDefId(hisIns.getProcessDefinitionId());
flowTask.setProcDefName(hisIns.getProcessDefinitionName());
flowTask.setProcDefVersion(hisIns.getProcessDefinitionVersion());
flowTask.setCategory(deployment.getCategory());
taskVo.setDeployId(hisIns.getDeploymentId());
taskVo.setProcDefId(hisIns.getProcessDefinitionId());
taskVo.setProcDefName(hisIns.getProcessDefinitionName());
taskVo.setProcDefVersion(hisIns.getProcessDefinitionVersion());
taskVo.setCategory(deployment.getCategory());
// 当前所处流程 todo: 本地启动放开以下注释
// List<Task> taskList = taskService.createTaskQuery().processInstanceId(hisIns.getId()).list();
// if (CollectionUtils.isNotEmpty(taskList)) {
@@ -455,9 +455,9 @@ public class WfTaskServiceImpl extends FlowServiceFactory implements IWfTaskServ
// List<HistoricTaskInstance> historicTaskInstance = historyService.createHistoricTaskInstanceQuery().processInstanceId(hisIns.getId()).orderByHistoricTaskInstanceEndTime().desc().list();
// flowTask.setTaskId(historicTaskInstance.get(0).getId());
// }
flowList.add(flowTask);
taskVoList.add(taskVo);
}
page.setRecords(flowList);
page.setRecords(taskVoList);
return TableDataInfo.build(page);
}

View File

@@ -81,7 +81,7 @@
</el-table-column>
<el-table-column label="流程分类" align="center" prop="categoryName">
<template slot-scope="scope">
<span>{{ categoryOptions.find(k => k.code === scope.row.categoryCode).categoryName }}</span>
<span>{{ categoryOptions.find(k => k.code === scope.row.category).categoryName }}</span>
</template>
</el-table-column>
<el-table-column label="业务表单" align="center" :show-overflow-tooltip="true">
@@ -200,7 +200,7 @@
<el-input v-model="process.form.processName" clearable />
</el-form-item>
<el-form-item label="流程分类">
<el-select v-model="process.form.categoryCode" placeholder="请选择" clearable style="width:100%">
<el-select v-model="process.form.category" placeholder="请选择" clearable style="width:100%">
<el-option v-for="item in categoryOptions" :key="item.categoryId" :label="item.categoryName" :value="item.code" />
</el-select>
</el-form-item>
@@ -488,7 +488,7 @@ export default {
definitionId: row.definitionId,
processId: row.processKey,
processName: row.processName,
category: row.categoryCode
category: row.category
}
})
},

View File

@@ -60,7 +60,11 @@
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="流程编号" align="center" prop="procInsId" :show-overflow-tooltip="true"/>
<el-table-column label="流程名称" align="center" prop="procDefName" :show-overflow-tooltip="true"/>
<el-table-column label="流程类别" align="center" prop="category" width="100px" />
<el-table-column label="流程类别" align="center" prop="category" width="100px">
<template slot-scope="scope">
<span>{{ categoryOptions.find(k => k.code === scope.row.category).categoryName }}</span>
</template>
</el-table-column>
<el-table-column label="流程版本" align="center" width="80px">
<template slot-scope="scope">
<el-tag size="medium" >v{{ scope.row.procDefVersion }}</el-tag>
@@ -120,7 +124,11 @@
<el-tag size="medium" >v{{ scope.row.version }}</el-tag>
</template>
</el-table-column>
<el-table-column label="流程分类" align="center" prop="categoryCode" />
<el-table-column label="流程分类" align="center" prop="category">
<template slot-scope="scope">
<span>{{ categoryOptions.find(k => k.code === scope.row.category).categoryName }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="300" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
@@ -155,6 +163,7 @@ import {
} from "@/api/workflow/finished";
import { myProcessList,stopProcess } from "@/api/workflow/process";
import {listDefinition} from "@/api/workflow/definition";
import { listCategory } from '@/api/workflow/category';
export default {
name: "Deploy",
components: {
@@ -174,6 +183,7 @@ export default {
showSearch: true,
// 总条数
total: 0,
categoryOptions: [],
processTotal:0,
// 我发起的流程列表数据
myProcessList: [],
@@ -205,6 +215,9 @@ export default {
};
},
created() {
listCategory().then(response => {
this.categoryOptions = response.rows
})
this.getList();
},
methods: {