flowable 更新
This commit is contained in:
parent
f8a2aaa75d
commit
2e6567b2bd
1722
sql/tansci_boot.sql
1722
sql/tansci_boot.sql
File diff suppressed because one or more lines are too long
@ -1,10 +1,10 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询分配给指定用户的任务
|
||||
export function getTaskByAssignee(params:any){
|
||||
// 模型列表
|
||||
export function modelList(params:any){
|
||||
return new Promise((resolve, reject) => {
|
||||
request({
|
||||
url: '/tansci/system/work/workflow/getTaskByAssignee',
|
||||
url: '/tansci/system/work/workflow/modelList',
|
||||
method: 'get',
|
||||
params: params
|
||||
}).then((res:any) => {
|
||||
@ -15,7 +15,97 @@ export function getTaskByAssignee(params:any){
|
||||
})
|
||||
}
|
||||
|
||||
// 部署流程模型
|
||||
// 流程定义
|
||||
export function processDefinitionList(params:any){
|
||||
return new Promise((resolve, reject) => {
|
||||
request({
|
||||
url: '/tansci/system/work/workflow/processDefinitionList',
|
||||
method: 'get',
|
||||
params: params
|
||||
}).then((res:any) => {
|
||||
resolve(res.data)
|
||||
}).catch((e:any) => {
|
||||
reject(e)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 激活流程
|
||||
export function activateProcess(params:any){
|
||||
return new Promise((resolve, reject) => {
|
||||
request({
|
||||
url: '/tansci/system/work/workflow/activateProcess',
|
||||
method: 'get',
|
||||
params: params
|
||||
}).then((res:any) => {
|
||||
resolve(res.data)
|
||||
}).catch((e:any) => {
|
||||
reject(e)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 挂起流程
|
||||
export function suspendProcess(params:any){
|
||||
return new Promise((resolve, reject) => {
|
||||
request({
|
||||
url: '/tansci/system/work/workflow/suspendProcess',
|
||||
method: 'get',
|
||||
params: params
|
||||
}).then((res:any) => {
|
||||
resolve(res.data)
|
||||
}).catch((e:any) => {
|
||||
reject(e)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 删除流程
|
||||
export function deleteDeployment(params:any){
|
||||
return new Promise((resolve, reject) => {
|
||||
request({
|
||||
url: '/tansci/system/work/workflow/deleteDeployment',
|
||||
method: 'get',
|
||||
params: params
|
||||
}).then((res:any) => {
|
||||
resolve(res.data)
|
||||
}).catch((e:any) => {
|
||||
reject(e)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 删除正在运行的流程
|
||||
export function deleteProcessInstance(params:any){
|
||||
return new Promise((resolve, reject) => {
|
||||
request({
|
||||
url: '/tansci/system/work/workflow/deleteProcessInstance',
|
||||
method: 'get',
|
||||
params: params
|
||||
}).then((res:any) => {
|
||||
resolve(res.data)
|
||||
}).catch((e:any) => {
|
||||
reject(e)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 任务列表
|
||||
export function taskList(params:any){
|
||||
return new Promise((resolve, reject) => {
|
||||
request({
|
||||
url: '/tansci/system/work/workflow/taskList',
|
||||
method: 'get',
|
||||
params: params
|
||||
}).then((res:any) => {
|
||||
resolve(res.data)
|
||||
}).catch((e:any) => {
|
||||
reject(e)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 部署流程
|
||||
export function deployProcess(data:any){
|
||||
return new Promise((resolve, reject) => {
|
||||
request({
|
||||
|
||||
87
tansci-boot-ui/src/views/work/Flowable.vue
Normal file
87
tansci-boot-ui/src/views/work/Flowable.vue
Normal file
@ -0,0 +1,87 @@
|
||||
<script setup lang="ts">
|
||||
import {onMounted, reactive, ref} from 'vue'
|
||||
import {ElMessage, ElMessageBox} from 'element-plus'
|
||||
import type {FormInstance} from 'element-plus'
|
||||
import Table from '@/components/Table.vue'
|
||||
import {modelList,processDefinitionList,activateProcess,suspendProcess,deleteDeployment,deleteProcessInstance,taskList,deployProcess,startProcessInstance,approveTask,rejectTask} from '@/api/work/workflow'
|
||||
|
||||
const state = reactive({
|
||||
tabsActive: 'process',
|
||||
tabs: [
|
||||
{id: 'process', name: '流程定义'},
|
||||
{id: 'tasks', name: '任务管理'},
|
||||
{id: 'model', name: '模型列表'},
|
||||
]
|
||||
})
|
||||
|
||||
onMounted(()=>{
|
||||
onTabClick(null);
|
||||
})
|
||||
|
||||
function onTabClick(tab: any){
|
||||
table.loading = true;
|
||||
if(tab && tab.props.name == 'process'){
|
||||
processDefinitionList({}).then((res:any)=>{
|
||||
if(res){
|
||||
console.log(res)
|
||||
table.loading = false;
|
||||
}
|
||||
})
|
||||
} else if(tab && tab.props.name == 'tasks'){
|
||||
taskList({}).then((res:any)=>{
|
||||
if(res){
|
||||
console.log(res)
|
||||
table.loading = false;
|
||||
}
|
||||
})
|
||||
} else if(tab && tab.props.name == 'model'){
|
||||
modelList({}).then((res:any)=>{
|
||||
if(res){
|
||||
console.log(res)
|
||||
table.loading = false;
|
||||
}
|
||||
})
|
||||
} else {
|
||||
processDefinitionList({}).then((res:any)=>{
|
||||
if(res){
|
||||
console.log(res)
|
||||
table.loading = false;
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const table = reactive({
|
||||
loading: false,
|
||||
operation:{
|
||||
isShow: true,
|
||||
width: '240'
|
||||
},
|
||||
tableTitle: [
|
||||
{prop:'name',label:'流程名称'},
|
||||
{prop:'updateTime',label:'更新时间'},
|
||||
{prop:'remarks',label:'描述'}
|
||||
],
|
||||
tableData:[],
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<div class="flowable-container">
|
||||
<el-tabs v-model="state.tabsActive" @tab-click="onTabClick">
|
||||
<el-tab-pane v-for="item in state.tabs" :key="item.id" :label="item.name" :name="item.id">
|
||||
<Table :data="table.tableData" :column="table.tableTitle" :page="null" :operation="table.operation" :loading="table.loading">
|
||||
<template #column="scope">
|
||||
<el-button type='primary' link style="color:var(--delete); padding:0;">TODO</el-button>
|
||||
</template>
|
||||
</Table>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.flowable-container{
|
||||
|
||||
}
|
||||
</style>
|
||||
@ -27,13 +27,8 @@
|
||||
tableTitle: [
|
||||
{prop:'code',label:'流程编码'},
|
||||
{prop:'name',label:'流程名称'},
|
||||
{prop:'status',label:'是否部署',type:'switch',
|
||||
option:{
|
||||
activeValue:0,activeColor:'#ff4949',activeText:'未部署',
|
||||
inactiveValue:1,inactiveColor:'#13ce66',inactiveText:'已部署',
|
||||
inlinePrompt: false
|
||||
}
|
||||
},
|
||||
{prop:'status',label:'部署状态',type:'dict',dictType:'model_status'},
|
||||
{prop:'taskId',label:'任务ID'},
|
||||
{prop:'updateTime',label:'更新时间'},
|
||||
{prop:'remarks',label:'描述'}
|
||||
],
|
||||
@ -132,7 +127,8 @@
|
||||
if(res && res.result != null){
|
||||
update({
|
||||
id: val.column.row.id,
|
||||
status: 1
|
||||
status: 1,
|
||||
taskId: res.result
|
||||
}).then(res=>{
|
||||
if(res){
|
||||
ElMessage.success('部署成功!');
|
||||
@ -161,9 +157,9 @@
|
||||
</template>
|
||||
<template #column="scope">
|
||||
<el-button @click="onViewer(scope)" type='primary' link style="color:var(--query); padding:0;">预览</el-button>
|
||||
<el-button @click="onDeployProcess(scope)" type='primary' link style="color:var(--add); padding:0;">部署</el-button>
|
||||
<el-button @click="onEdit(scope)" v-permission="'model:update'" type='primary' link style="color:var(--edit); padding:0;">编辑</el-button>
|
||||
<el-button @click="onDelete(scope)" v-permission="'model:delete'" type='primary' link style="color:var(--delete); padding:0;">删除</el-button>
|
||||
<el-button v-if="scope.column.row.status == 0" @click="onDeployProcess(scope)" type='primary' link style="color:var(--add); padding:0;">部署</el-button>
|
||||
<el-button v-if="scope.column.row.status == 0" @click="onEdit(scope)" v-permission="'model:update'" type='primary' link style="color:var(--edit); padding:0;">编辑</el-button>
|
||||
<el-button v-if="scope.column.row.status == 0" @click="onDelete(scope)" v-permission="'model:delete'" type='primary' link style="color:var(--delete); padding:0;">删除</el-button>
|
||||
</template>
|
||||
</Table>
|
||||
<el-dialog v-model="viewer.viewerVisible" title="预览">
|
||||
|
||||
@ -1,77 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import {onMounted, reactive, ref} from 'vue'
|
||||
import {ElMessage, ElMessageBox} from 'element-plus'
|
||||
import type {FormInstance} from 'element-plus'
|
||||
import Table from '@/components/Table.vue'
|
||||
import {getTaskByAssignee,deployProcess,startProcessInstance,approveTask,rejectTask} from '@/api/work/workflow'
|
||||
|
||||
const table = reactive({
|
||||
loading: false,
|
||||
operation:{
|
||||
isShow: true,
|
||||
width: '240'
|
||||
},
|
||||
tableTitle: [
|
||||
{prop:'name',label:'流程名称'},
|
||||
{prop:'status',label:'是否禁用',type:'switch',
|
||||
option:{
|
||||
activeValue:0,activeColor:'#13ce66',activeText:'启用',
|
||||
inactiveValue:1,inactiveColor:'#ff4949',inactiveText:'禁用',
|
||||
inlinePrompt: false
|
||||
}
|
||||
},
|
||||
{prop:'updateTime',label:'更新时间'},
|
||||
{prop:'remarks',label:'描述'}
|
||||
],
|
||||
tableData:[],
|
||||
})
|
||||
|
||||
onMounted(()=>{
|
||||
onPage()
|
||||
})
|
||||
|
||||
function onPage(){
|
||||
table.loading = true;
|
||||
getTaskByAssignee({assignee: '6cfc6a42-0984-11f0-82ff-4ccc6a2e3718'}).then((res:any)=>{
|
||||
if(res){
|
||||
console.log(res)
|
||||
table.loading = false;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 删除
|
||||
function onDelete(val:any){
|
||||
ElMessageBox.confirm('此操作将永久删除, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
// del(val.column.row.id).then(res=>{
|
||||
// if(res){
|
||||
// ElMessage.success('删除成功!');
|
||||
// onPage();
|
||||
// }
|
||||
// })
|
||||
}).catch(e=>{
|
||||
console.log(e)
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<div class="workflow-container">
|
||||
<Table :data="table.tableData" :column="table.tableTitle" :operation="table.operation" :loading="table.loading">
|
||||
<template #search>
|
||||
</template>
|
||||
<template #column="scope">
|
||||
<el-button @click="onDelete(scope)" v-permission="'workflow:delete'" type='primary' link style="color:var(--delete); padding:0;">删除</el-button>
|
||||
</template>
|
||||
</Table>
|
||||
</div>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.workflow-container{
|
||||
|
||||
}
|
||||
</style>
|
||||
@ -1,4 +1,4 @@
|
||||
package com.tansci.service;
|
||||
package com.tansci.service;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.flowable.engine.IdentityService;
|
||||
@ -19,24 +19,22 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @className:FlowableService.java
|
||||
* @description: Flowable
|
||||
* @author:tanyp
|
||||
* @date:2025/3/23
|
||||
*/
|
||||
* @ClassName: FlowableService.java
|
||||
* @ClassPath: com.tansci.service.FlowableService.java
|
||||
* @Description: Flowable
|
||||
* @Author: tanyp
|
||||
* @Date: 2025/3/30
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class FlowableService {
|
||||
|
||||
@Autowired
|
||||
private RepositoryService repositoryService;
|
||||
|
||||
@Autowired
|
||||
private RuntimeService runtimeService;
|
||||
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
|
||||
@Autowired
|
||||
private IdentityService identityService;
|
||||
|
||||
@ -47,10 +45,10 @@ public class FlowableService {
|
||||
* @Description: 模型列表
|
||||
* @Author: tanyp
|
||||
* @Date: 2025/3/23
|
||||
* @Param: [name, xml]
|
||||
* @Param: []
|
||||
* @return: java.util.List
|
||||
**/
|
||||
public List<Model> modelList(String name, String xml) {
|
||||
public List<Model> modelList() {
|
||||
try {
|
||||
List<Model> list = repositoryService.createModelQuery().list();
|
||||
return list;
|
||||
@ -65,10 +63,10 @@ public class FlowableService {
|
||||
* @Description: 流程定义列表
|
||||
* @Author: tanyp
|
||||
* @Date: 2025/3/23
|
||||
* @Param: [name, xml]
|
||||
* @Param: []
|
||||
* @return: java.util.List
|
||||
**/
|
||||
public List<ProcessDefinition> processDefinitionList(String name, String xml) {
|
||||
public List<ProcessDefinition> processDefinitionList() {
|
||||
try {
|
||||
List<ProcessDefinition> list = repositoryService.createProcessDefinitionQuery().list();
|
||||
return list;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user