2022-06-14 09:32:49 +08:00
|
|
|
|
import { addDynamicRoute } from '@/router'
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
data () {
|
|
|
|
|
return {
|
|
|
|
|
processVisible: false
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
// 初始化流程配置(集成发起流程和任务处理功能)
|
|
|
|
|
initProcessMultiple (callbacks) {
|
|
|
|
|
// showType 用于区分流程启动(start)、任务处理(taskHandle)以及查看详情(null)
|
|
|
|
|
// 流程启动显示的是“流程启动”按钮,任务处理显示的是“通过、委托、回退、驳回、终止”按钮,查看详情都不显示
|
|
|
|
|
var showType = this.$route.params.processShowType
|
|
|
|
|
this.processVisible = true
|
|
|
|
|
this.$nextTick(() => {
|
2022-12-08 17:27:30 +08:00
|
|
|
|
if (this.$route.params.processDefinitionKey && this.$refs.renProcessMultiple) {
|
2022-06-14 09:32:49 +08:00
|
|
|
|
this.$refs.renProcessMultiple.dataForm.processDefinitionKey = this.$route.params.processDefinitionKey
|
|
|
|
|
}
|
2022-12-08 17:27:30 +08:00
|
|
|
|
if (this.$route.params.taskId && this.$refs.renProcessMultiple) {
|
2022-06-14 09:32:49 +08:00
|
|
|
|
this.$refs.renProcessMultiple.dataForm.taskId = this.$route.params.taskId
|
|
|
|
|
}
|
2022-12-08 17:27:30 +08:00
|
|
|
|
if (this.$route.params.processInstanceId && this.$refs.renProcessMultiple) {
|
2022-06-14 09:32:49 +08:00
|
|
|
|
this.$refs.renProcessMultiple.dataForm.processInstanceId = this.$route.params.processInstanceId
|
|
|
|
|
}
|
2022-12-08 17:27:30 +08:00
|
|
|
|
if (this.$refs.renProcessMultiple) {
|
|
|
|
|
this.$refs.renProcessMultiple.dataForm.businessKey = this.$route.params.businessKey
|
|
|
|
|
this.$refs.renProcessMultiple.showType = showType
|
|
|
|
|
this.$refs.renProcessMultiple.parentObj = this
|
|
|
|
|
this.$refs.renProcessMultiple.callbacks = callbacks
|
|
|
|
|
}
|
2022-06-14 09:32:49 +08:00
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 关闭当前窗口
|
|
|
|
|
closeCurrentTab (data) {
|
|
|
|
|
var tabName = this.$store.state.contentTabsActiveName
|
|
|
|
|
// 在窗口里去掉当前窗口
|
|
|
|
|
this.$store.state.contentTabs = this.$store.state.contentTabs.filter(item => item.name !== tabName)
|
|
|
|
|
// 如果是唯一一个回首页
|
|
|
|
|
if (this.$store.state.contentTabs.length <= 0) {
|
|
|
|
|
this.$store.state.sidebarMenuActiveName = this.$store.state.contentTabsActiveName = 'home'
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
// 不是唯一一个,回到之前的最后一个
|
|
|
|
|
if (tabName === this.$store.state.contentTabsActiveName) {
|
|
|
|
|
this.$router.push({ name: this.$store.state.contentTabs[this.$store.state.contentTabs.length - 1].name })
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 获取流程定义的表单路由配置信息
|
2022-12-16 14:21:04 +08:00
|
|
|
|
getProcDefRouteSet (data, callback, str) {
|
|
|
|
|
if (data.resourceName && !data.processDefinitionId) {
|
|
|
|
|
switch (str) {
|
|
|
|
|
case '待办':
|
|
|
|
|
this.$router.push({ name: 'activiti-RoomExamineAdmin' })
|
|
|
|
|
break
|
|
|
|
|
case '已办':
|
|
|
|
|
this.$router.push({ name: 'activiti-RoomExamineAdminDone' })
|
|
|
|
|
break
|
2022-06-14 09:32:49 +08:00
|
|
|
|
}
|
2022-12-16 14:21:04 +08:00
|
|
|
|
} else {
|
|
|
|
|
this.$http.get(`/act/process/getProcDefBizRoute/${data.processDefinitionId}`).then(({ data: res }) => {
|
|
|
|
|
if (res.code !== 0) {
|
|
|
|
|
return this.$message.error(res.msg)
|
|
|
|
|
}
|
|
|
|
|
if (!res.data || !res.data.bizRoute) {
|
|
|
|
|
return this.$message.error(this.$t('process.routeError'))
|
|
|
|
|
}
|
|
|
|
|
var param = {
|
|
|
|
|
...data,
|
|
|
|
|
...res.data
|
|
|
|
|
}
|
|
|
|
|
callback(param)
|
|
|
|
|
}).catch(() => { })
|
|
|
|
|
}
|
2022-06-14 09:32:49 +08:00
|
|
|
|
},
|
|
|
|
|
getProcDefBizRouteAndProcessInstance (params, callback) {
|
|
|
|
|
this.$http.get('/act/process/getProcDefBizRouteAndProcessInstance', {
|
|
|
|
|
params: params
|
|
|
|
|
}).then(({ data: res }) => {
|
|
|
|
|
if (res.code !== 0) {
|
|
|
|
|
return this.$message.error(res.msg)
|
|
|
|
|
}
|
|
|
|
|
if (!res.data || !res.data.bizRoute) {
|
|
|
|
|
return this.$message.error(this.$t('process.routeError'))
|
|
|
|
|
}
|
|
|
|
|
var param = {
|
|
|
|
|
...params,
|
|
|
|
|
...res.data
|
|
|
|
|
}
|
|
|
|
|
callback(param)
|
|
|
|
|
}).catch(() => { })
|
|
|
|
|
},
|
|
|
|
|
// 根据流程定义KEY获取最新的表单路由配置信息
|
|
|
|
|
getLatestProcDefRouteSet (procDefKey, callback) {
|
|
|
|
|
this.$http.get('/act/process/getLatestProcDefBizRoute', {
|
|
|
|
|
params: {
|
|
|
|
|
procDefKey: procDefKey
|
|
|
|
|
}
|
|
|
|
|
}).then(({ data: res }) => {
|
|
|
|
|
if (res.code !== 0) {
|
|
|
|
|
return this.$message.error(res.msg)
|
|
|
|
|
}
|
|
|
|
|
if (!res.data || !res.data.bizRoute) {
|
|
|
|
|
return this.$message.error(this.$t('process.routeError'))
|
|
|
|
|
}
|
|
|
|
|
var param = {
|
|
|
|
|
procDefKey: procDefKey,
|
|
|
|
|
...res.data
|
|
|
|
|
}
|
|
|
|
|
callback(param)
|
|
|
|
|
}).catch(() => { })
|
|
|
|
|
},
|
|
|
|
|
// 查看流程图
|
|
|
|
|
forwardDetail (data) {
|
|
|
|
|
var routeParams = {
|
|
|
|
|
routeName: `${this.$route.name}__detail_${data.processInstanceId}`,
|
|
|
|
|
menuId: `${this.$route.meta.menuId}`,
|
|
|
|
|
title: `${this.$route.meta.title} - ${data.processDefinitionName}`,
|
|
|
|
|
path: data.bizRoute,
|
|
|
|
|
params: {
|
|
|
|
|
params: data,
|
|
|
|
|
processInstanceId: data.processInstanceId,
|
|
|
|
|
businessKey: data.businessKey
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
addDynamicRoute(routeParams, this.$router)
|
|
|
|
|
},
|
|
|
|
|
// 子级 查看流程图
|
|
|
|
|
forwardTaskDetail (data) {
|
|
|
|
|
var routeParams = {
|
|
|
|
|
routeName: `${this.$route.name}__detail_${data.taskId}`,
|
|
|
|
|
menuId: `${this.$route.meta.menuId}`,
|
|
|
|
|
title: `${this.$route.meta.title} - ${data.taskName}`,
|
|
|
|
|
path: data.bizRoute,
|
|
|
|
|
params: {
|
|
|
|
|
taskId: data.taskId,
|
|
|
|
|
processInstanceId: data.processInstanceId,
|
|
|
|
|
businessKey: data.businessKey
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
addDynamicRoute(routeParams, this.$router)
|
|
|
|
|
},
|
|
|
|
|
forwardHandleUrl (data) {
|
|
|
|
|
var routeParams = {
|
|
|
|
|
routeName: `${this.$route.name}__handle_${data.taskId}`,
|
|
|
|
|
menuId: `${this.$route.meta.menuId}`,
|
|
|
|
|
title: `${this.$route.meta.title} - ${data.taskName}`,
|
|
|
|
|
path: data.bizRoute,
|
|
|
|
|
params: {
|
|
|
|
|
params: data,
|
|
|
|
|
taskId: data.taskId,
|
|
|
|
|
processInstanceId: data.processInstanceId,
|
|
|
|
|
processShowType: 'taskHandle',
|
|
|
|
|
businessKey: data.businessKey
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
addDynamicRoute(routeParams, this.$router)
|
|
|
|
|
},
|
|
|
|
|
downloadFile (path, name) {
|
|
|
|
|
const xhr = new XMLHttpRequest()
|
|
|
|
|
xhr.open('get', path)
|
|
|
|
|
xhr.responseType = 'blob'
|
|
|
|
|
xhr.send()
|
|
|
|
|
xhr.onload = function () {
|
|
|
|
|
if (this.status === 200 || this.status === 304) {
|
|
|
|
|
// 如果是IE10及以上,不支持download属性,采用msSaveOrOpenBlob方法,但是IE10以下也不支持msSaveOrOpenBlob
|
|
|
|
|
if ('msSaveOrOpenBlob' in navigator) {
|
|
|
|
|
navigator.msSaveOrOpenBlob(this.response, name)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
// const blob = new Blob([this.response], { type: xhr.getResponseHeader('Content-Type') });
|
|
|
|
|
// const url = URL.createObjectURL(blob);
|
|
|
|
|
const url = URL.createObjectURL(this.response)
|
|
|
|
|
const a = document.createElement('a')
|
|
|
|
|
a.style.display = 'none'
|
|
|
|
|
a.href = url
|
|
|
|
|
a.download = name
|
|
|
|
|
document.body.appendChild(a)
|
|
|
|
|
a.click()
|
|
|
|
|
document.body.removeChild(a)
|
|
|
|
|
URL.revokeObjectURL(url)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|