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 = "分类编码") @ExcelProperty(value = "分类编码")
@ApiModelProperty("分类编码") @ApiModelProperty("分类编码")
private String categoryCode; private String category;
@ApiModelProperty("版本") @ApiModelProperty("版本")
private Integer version; private Integer version;

View File

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

View File

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

View File

@@ -81,7 +81,7 @@
</el-table-column> </el-table-column>
<el-table-column label="流程分类" align="center" prop="categoryName"> <el-table-column label="流程分类" align="center" prop="categoryName">
<template slot-scope="scope"> <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> </template>
</el-table-column> </el-table-column>
<el-table-column label="业务表单" align="center" :show-overflow-tooltip="true"> <el-table-column label="业务表单" align="center" :show-overflow-tooltip="true">
@@ -200,7 +200,7 @@
<el-input v-model="process.form.processName" clearable /> <el-input v-model="process.form.processName" clearable />
</el-form-item> </el-form-item>
<el-form-item label="流程分类"> <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-option v-for="item in categoryOptions" :key="item.categoryId" :label="item.categoryName" :value="item.code" />
</el-select> </el-select>
</el-form-item> </el-form-item>
@@ -488,7 +488,7 @@ export default {
definitionId: row.definitionId, definitionId: row.definitionId,
processId: row.processKey, processId: row.processKey,
processName: row.processName, 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 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="procInsId" :show-overflow-tooltip="true"/>
<el-table-column label="流程名称" align="center" prop="procDefName" :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"> <el-table-column label="流程版本" align="center" width="80px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag size="medium" >v{{ scope.row.procDefVersion }}</el-tag> <el-tag size="medium" >v{{ scope.row.procDefVersion }}</el-tag>
@@ -120,7 +124,11 @@
<el-tag size="medium" >v{{ scope.row.version }}</el-tag> <el-tag size="medium" >v{{ scope.row.version }}</el-tag>
</template> </template>
</el-table-column> </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"> <el-table-column label="操作" align="center" width="300" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
@@ -155,6 +163,7 @@ import {
} from "@/api/workflow/finished"; } from "@/api/workflow/finished";
import { myProcessList,stopProcess } from "@/api/workflow/process"; import { myProcessList,stopProcess } from "@/api/workflow/process";
import {listDefinition} from "@/api/workflow/definition"; import {listDefinition} from "@/api/workflow/definition";
import { listCategory } from '@/api/workflow/category';
export default { export default {
name: "Deploy", name: "Deploy",
components: { components: {
@@ -174,6 +183,7 @@ export default {
showSearch: true, showSearch: true,
// 总条数 // 总条数
total: 0, total: 0,
categoryOptions: [],
processTotal:0, processTotal:0,
// 我发起的流程列表数据 // 我发起的流程列表数据
myProcessList: [], myProcessList: [],
@@ -205,6 +215,9 @@ export default {
}; };
}, },
created() { created() {
listCategory().then(response => {
this.categoryOptions = response.rows
})
this.getList(); this.getList();
}, },
methods: { methods: {