1. 程式人生 > 其它 >基於Flowable 定製工作流

基於Flowable 定製工作流

1.前言

[Flowable工作流]是目前市面上最受歡迎的工作流引擎之一,國內很多BPM廠家基於Flowable定製自已的BPM產品。
定製最簡單的辦法:是直接在專案中整合Flowable idm restful api,直接在專案中定製和擴充套件工作流。

2.整合Flowable idm restful api

//初始化idm請求url
this.axios = this.$axios.create({
baseURL: 'http://localhost:8080',
timeout: 1000
})

//設定請求引數
this.axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'
let param = new URLSearchParams()
param.append('j_username', this.username)
param.append('j_password', this.pass)
param.append('_spring_security_remember_me', true)
param.append('submit', 'login')

//呼叫登入方法,登入成功,Cookie設定token,並在每次請求時傳送Cookine
this.axios.post('/flowable-idm/app/authentication', param)

3.在專案中定製和擴充套件工作流

// 獲取流程定義
this.axios.defaults.withCredentials = true
this.axios.get('/flowable-modeler/app/rest/models?filter=processes&modelType=0&sort=modifiedDesc')
.then(response => {
console.log(response)
if (response.status === 200) {
this.flows = response.data.data
}
})
.catch(function (error) {
console.log(error)
})

// 獲取應用資訊
this.axios.defaults.withCredentials = true
this.axios.get('/flowable-modeler/app/rest/models?filter=apps&modelType=3&sort=modifiedDesc')
.then(response => {
console.log(response.data.data)
if (response.status === 200) {
this.applications = response.data.data
}
})
.catch(function (error) {
console.log(error)
})

// 獲取其他資訊,直接監控Task專案