[update] 流程处理后go(-1)不成功的话就跳转到流程中心

This commit is contained in:
lideqin
2024-09-20 18:21:43 +08:00
parent 4c7dd7bc58
commit 37dae2a1f5
2 changed files with 20 additions and 3 deletions
+20
View File
@@ -89,7 +89,18 @@ export const WorkCenterMixin = {
let timer = setTimeout(() => {
clearTimeout(timer)
timer = null
Vue.prototype.$isNavigating = true // 设置为正在跳转
this.$router.go(-1)
let timerTwo = setTimeout(() => {
clearTimeout(timerTwo)
timerTwo = null
if (Vue.prototype.$isNavigating) {
console.log('未成功完成跳转')
this.$router.replace('/workCenter/processCenter/processCenter')
} else {
console.log('成功完成跳转')
}
}, 100) // 设置合适的超时时间,确保在路由确实改变后执行
}, 700)
},
switchChange (value) {
@@ -103,6 +114,9 @@ export const WorkCenterMixin = {
* @param next
*/
beforeRouteEnter (to, from, next) {
console.log('***********beforeRouteEnter')
// 设置一个标志,表示即将跳转
Vue.prototype.$isNavigating = true
if (to.query.taskId) {
queryTaskNameByTaskId({taskId: to.query.taskId}).then(res => {
if (res.success) {
@@ -114,5 +128,11 @@ export const WorkCenterMixin = {
} else {
next()
}
},
beforeRouteLeave (to, from, next) {
console.log('*********beforeRouteLeave')
// 跳转结束后,清除标志
Vue.prototype.$isNavigating = false
next()
}
}
@@ -616,9 +616,6 @@ export default {
}
})
})
},
goBack () {
this.$router.go(-1)
}
}
}