fix: 流程详情页与流程发起页修改为动态路由,解决页面数据不刷新与刷新转圈的问题

This commit is contained in:
konbai
2022-11-27 15:16:44 +08:00
parent 76ed6b4cc5
commit 0d8d7c5e63
8 changed files with 39 additions and 44 deletions

View File

@@ -74,25 +74,6 @@ export const constantRoutes = [
} }
] ]
}, },
{
path: '/work',
component: Layout,
hidden: true,
children: [
{
path: 'start',
component: () => import('@/views/workflow/work/start'),
name: 'start',
meta: { title: '发起流程', icon: '' }
},
{
path: 'detail',
component: () => import('@/views/workflow/work/detail'),
name: 'Detail',
meta: { title: '流程详情', icon: '' }
}
]
},
{ {
path: '/tool', path: '/tool',
component: Layout, component: Layout,
@@ -193,7 +174,27 @@ export const dynamicRoutes = [
meta: { title: '修改生成配置', activeMenu: '/tool/gen' } meta: { title: '修改生成配置', activeMenu: '/tool/gen' }
} }
] ]
} },
{
path: '/workflow/process',
component: Layout,
hidden: true,
permissions: ['workflow:process:query'],
children: [
{
path: 'start/:deployId([\\w|\\-]+)',
component: () => import('@/views/workflow/work/start'),
name: 'WorkStart',
meta: { title: '发起流程', icon: '' }
},
{
path: 'detail/:procInsId([\\w|\\-]+)',
component: () => import('@/views/workflow/work/detail'),
name: 'WorkDetail',
meta: { title: '流程详情', activeMenu: '/work/own' }
}
]
},
] ]
// 防止连续点击多次路由报错 // 防止连续点击多次路由报错

View File

@@ -188,10 +188,11 @@ export default {
}, },
/** 查看详情 */ /** 查看详情 */
handleFlowRecord(row){ handleFlowRecord(row){
this.$router.push({ path: '/work/detail', console.log(row);
this.$router.push({
path: '/workflow/process/detail/' + row.instanceId,
query: { query: {
definitionId: row.processId, definitionId: row.processId,
procInsId: row.instanceId,
deployId: row.deploymentId, deployId: row.deploymentId,
taskId: row.taskId, taskId: row.taskId,
finished: false finished: false

View File

@@ -216,7 +216,7 @@ import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import Treeselect from '@riophae/vue-treeselect' import Treeselect from '@riophae/vue-treeselect'
export default { export default {
name: "Detail", name: "WorkDetail",
components: { components: {
ProcessViewer, ProcessViewer,
Parser, Parser,
@@ -316,17 +316,14 @@ export default {
}; };
}, },
created() { created() {
this.init(); this.initData();
},
activated() {
this.init();
}, },
methods: { methods: {
init() { initData() {
this.taskForm.procInsId = this.$route.params && this.$route.params.procInsId;
this.taskForm.deployId = this.$route.query && this.$route.query.deployId; this.taskForm.deployId = this.$route.query && this.$route.query.deployId;
this.taskForm.definitionId = this.$route.query && this.$route.query.definitionId; this.taskForm.definitionId = this.$route.query && this.$route.query.definitionId;
this.taskForm.taskId = this.$route.query && this.$route.query.taskId; this.taskForm.taskId = this.$route.query && this.$route.query.taskId;
this.taskForm.procInsId = this.$route.query && this.$route.query.procInsId;
this.finished = this.$route.query && this.$route.query.finished this.finished = this.$route.query && this.$route.query.finished
// 流程任务重获取变量表单 // 流程任务重获取变量表单
if (this.taskForm.taskId) { if (this.taskForm.taskId) {

View File

@@ -210,14 +210,15 @@ export default {
}, },
/** 流程流转记录 */ /** 流程流转记录 */
handleFlowRecord(row){ handleFlowRecord(row){
this.$router.push({ path: '/work/detail', this.$router.push({
path: '/workflow/process/detail/' + row.procInsId,
query: { query: {
definitionId: row.procDefId, definitionId: row.procDefId,
procInsId: row.procInsId,
deployId: row.deployId, deployId: row.deployId,
taskId: row.taskId, taskId: row.taskId,
finished: false finished: false
}}) }
})
}, },
/** 撤回任务 */ /** 撤回任务 */
handleRevoke(row){ handleRevoke(row){

View File

@@ -155,10 +155,9 @@ export default {
}, },
handleStart(row) { handleStart(row) {
this.$router.push({ this.$router.push({
path: '/work/start', path: '/workflow/process/start/' + row.deploymentId,
query: { query: {
definitionId: row.definitionId, definitionId: row.definitionId,
deployId: row.deploymentId,
} }
}) })
}, },

View File

@@ -234,10 +234,9 @@ export default {
/** 流程流转记录 */ /** 流程流转记录 */
handleFlowRecord(row) { handleFlowRecord(row) {
this.$router.push({ this.$router.push({
path: '/work/detail', path: '/workflow/process/detail/' + row.procInsId,
query: { query: {
definitionId: row.procDefId, definitionId: row.procDefId,
procInsId: row.procInsId,
deployId: row.deployId, deployId: row.deployId,
taskId: row.taskId, taskId: row.taskId,
finished: false finished: false

View File

@@ -18,7 +18,7 @@ import { getProcessForm, startProcess } from '@/api/workflow/process'
import Parser from '@/utils/generator/parser' import Parser from '@/utils/generator/parser'
export default { export default {
name: 'Start', name: 'WorkStart',
components: { components: {
Parser Parser
}, },
@@ -30,15 +30,13 @@ export default {
formData: {}, formData: {},
} }
}, },
beforeRouteEnter(to, from, next) { created() {
next(vm => { this.initData();
vm.initData()
})
}, },
methods: { methods: {
initData() { initData() {
this.deployId = this.$route.params && this.$route.params.deployId;
this.definitionId = this.$route.query && this.$route.query.definitionId; this.definitionId = this.$route.query && this.$route.query.definitionId;
this.deployId = this.$route.query && this.$route.query.deployId;
getProcessForm({ getProcessForm({
definitionId: this.definitionId, definitionId: this.definitionId,
deployId: this.deployId deployId: this.deployId

View File

@@ -141,10 +141,9 @@ export default {
// 跳转到处理页面 // 跳转到处理页面
handleProcess(row) { handleProcess(row) {
this.$router.push({ this.$router.push({
path: '/work/detail', path: '/workflow/process/detail/' + row.procInsId,
query: { query: {
definitionId: row.procDefId, definitionId: row.procDefId,
procInsId: row.procInsId,
deployId: row.deployId, deployId: row.deployId,
taskId: row.taskId, taskId: row.taskId,
finished: true finished: true