1. 流程定义列表,增加任务分配规则的展示

2. 流程定义列表,按照 version 倒序
This commit is contained in:
YunaiV 2022-01-16 00:36:04 +08:00
parent a3d8e8726a
commit 3acb56f880
5 changed files with 38 additions and 17 deletions

View File

@ -52,6 +52,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
* 主要进行 Activiti {@link Model} 的维护 * 主要进行 Activiti {@link Model} 的维护
* *
* @author yunlongn * @author yunlongn
* @author 芋道源码
*/ */
@Service @Service
@Validated @Validated
@ -189,12 +190,7 @@ public class BpmModelServiceImpl implements BpmModelService {
String definitionId = processDefinitionService.createProcessDefinition(definitionCreateReqDTO); String definitionId = processDefinitionService.createProcessDefinition(definitionCreateReqDTO);
// 将老的流程定义进行挂起也就是说只有最新部署的流程定义才可以发起任务 // 将老的流程定义进行挂起也就是说只有最新部署的流程定义才可以发起任务
if (StrUtil.isNotEmpty(model.getDeploymentId())) { updateProcessDefinitionSuspended(model.getDeploymentId());
ProcessDefinition oldDefinition = processDefinitionService.getProcessDefinitionByDeploymentId(model.getDeploymentId());
if (oldDefinition != null) {
processDefinitionService.updateProcessDefinitionState(oldDefinition.getId(), SuspensionState.SUSPENDED.getStateCode());
}
}
// 更新 model deploymentId进行关联 // 更新 model deploymentId进行关联
ProcessDefinition definition = processDefinitionService.getProcessDefinition(definitionId); ProcessDefinition definition = processDefinitionService.getProcessDefinition(definitionId);
@ -226,6 +222,7 @@ public class BpmModelServiceImpl implements BpmModelService {
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public void deleteModel(String id) { public void deleteModel(String id) {
// 校验流程模型存在 // 校验流程模型存在
Model model = repositoryService.getModel(id); Model model = repositoryService.getModel(id);
@ -234,6 +231,19 @@ public class BpmModelServiceImpl implements BpmModelService {
} }
// 执行删除 // 执行删除
repositoryService.deleteModel(id); repositoryService.deleteModel(id);
// 禁用流程实例
updateProcessDefinitionSuspended(model.getDeploymentId());
}
private void updateProcessDefinitionSuspended(String deploymentId) {
if (StrUtil.isEmpty(deploymentId)) {
return;
}
ProcessDefinition oldDefinition = processDefinitionService.getProcessDefinitionByDeploymentId(deploymentId);
if (oldDefinition == null) {
return;
}
processDefinitionService.updateProcessDefinitionState(oldDefinition.getId(), SuspensionState.SUSPENDED.getStateCode());
} }
@Override @Override
@ -272,10 +282,4 @@ public class BpmModelServiceImpl implements BpmModelService {
} }
} }
public static void main(String[] args) {
// 创建转换对象
BpmnXMLConverter converter = new BpmnXMLConverter();
BpmnModel bpmnModel = converter.convertToBpmnModel(new StringStreamSource(""), true, true);
}
} }

View File

@ -67,7 +67,7 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ
definitionQuery.processDefinitionKey(pageVO.getKey()); definitionQuery.processDefinitionKey(pageVO.getKey());
} }
// 执行查询 // 执行查询
List<ProcessDefinition> processDefinitions = definitionQuery.orderByProcessDefinitionId().desc() List<ProcessDefinition> processDefinitions = definitionQuery.orderByProcessDefinitionVersion().desc()
.listPage(PageUtils.getStart(pageVO), pageVO.getPageSize()); .listPage(PageUtils.getStart(pageVO), pageVO.getPageSize());
if (CollUtil.isEmpty(processDefinitions)) { if (CollUtil.isEmpty(processDefinitions)) {
return new PageResult<>(Collections.emptyList(), definitionQuery.count()); return new PageResult<>(Collections.emptyList(), definitionQuery.count());

View File

@ -41,6 +41,13 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="定义描述" align="center" prop="description" width="300" show-overflow-tooltip /> <el-table-column label="定义描述" align="center" prop="description" width="300" show-overflow-tooltip />
<el-table-column label="操作" align="center" width="150" fixed="right">
<template slot-scope="scope">
<!-- TODO 权限 -->
<el-button size="mini" type="text" icon="el-icon-s-custom" @click="handleAssignRule(scope.row)"
v-hasPermi="['bpm:model:update']">分配规则</el-button>
</template>
</el-table-column>
</el-table> </el-table>
<!-- 流程表单配置详情 --> <!-- 流程表单配置详情 -->
@ -56,6 +63,9 @@
<!-- 分页组件 --> <!-- 分页组件 -->
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/> @pagination="getList"/>
<!-- ========== 流程任务分配规则 ========== -->
<taskAssignRuleDialog ref="taskAssignRuleDialog" />
</div> </div>
</template> </template>
@ -65,11 +75,13 @@ import {DICT_TYPE, getDictDatas} from "@/utils/dict";
import {getForm} from "@/api/bpm/form"; import {getForm} from "@/api/bpm/form";
import {decodeFields} from "@/utils/formGenerator"; import {decodeFields} from "@/utils/formGenerator";
import Parser from '@/components/parser/Parser' import Parser from '@/components/parser/Parser'
import taskAssignRuleDialog from "../taskAssignRule/taskAssignRuleDialog";
export default { export default {
name: "processDefinition", name: "processDefinition",
components: { components: {
Parser Parser,
taskAssignRuleDialog
}, },
data() { data() {
return { return {
@ -141,6 +153,10 @@ export default {
this.showBpmnOpen = true this.showBpmnOpen = true
}) })
}, },
/** 处理任务分配规则列表的按钮操作 */
handleAssignRule(row) {
this.$refs['taskAssignRuleDialog'].initProcessDefinition(row.id);
},
} }
}; };
</script> </script>

View File

@ -87,7 +87,7 @@ export default {
showSearch: true, showSearch: true,
// //
total: 0, total: 0,
// //
list: [], list: [],
// //
dateRangeCreateTime: [], dateRangeCreateTime: [],

View File

@ -10,14 +10,14 @@
<span>{{ getDictDataLabel(DICT_TYPE.BPM_TASK_ASSIGN_RULE_TYPE, scope.row.type) }}</span> <span>{{ getDictDataLabel(DICT_TYPE.BPM_TASK_ASSIGN_RULE_TYPE, scope.row.type) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="规则范围" align="center" prop="options" width="300px"> <el-table-column label="规则范围" align="center" prop="options" width="440px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag size="medium" v-if="scope.row.options" v-for="option in scope.row.options"> <el-tag size="medium" v-if="scope.row.options" v-for="option in scope.row.options">
{{ getAssignRuleOptionName(scope.row.type, option) }} {{ getAssignRuleOptionName(scope.row.type, option) }}
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="80" fixed="right"> <el-table-column v-if="modelId" label="操作" align="center" width="80" fixed="right">
<template slot-scope="scope"> <template slot-scope="scope">
<!-- TODO 权限 --> <!-- TODO 权限 -->
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdateTaskAssignRule(scope.row)" <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdateTaskAssignRule(scope.row)"
@ -188,6 +188,7 @@ export default {
this.loading = true; this.loading = true;
getTaskAssignRuleList({ getTaskAssignRuleList({
modelId: this.modelId, modelId: this.modelId,
processDefinitionId: this.processDefinitionId,
}).then(response => { }).then(response => {
this.loading = false; this.loading = false;
this.list = response.data; this.list = response.data;