[update 流程返回] 如果没有上一个页面就跳转到首页

This commit is contained in:
danshihao
2024-08-12 17:39:24 +08:00
parent 8a4e64aa79
commit ad0afd3e96
+8 -2
View File
@@ -1,6 +1,7 @@
import { getProcessNodeList, queryTaskNameByTaskId } from '../api/workCenter'
import Vue from 'vue'
import { USER_INFO } from '../store/mutation-types'
import { findFirstRoute } from '@/utils/util'
export const WorkCenterMixin = {
data () {
@@ -89,7 +90,12 @@ export const WorkCenterMixin = {
let timer = setTimeout(() => {
clearTimeout(timer)
timer = null
this.$router.go(-1)
// 有上个页面就返回,否则就返回第一个页面
if (history.length > 1) {
this.$router.go(-1)
} else {
this.$router.replace({ path: findFirstRoute(this.$store.state.user.permissionList) })
}
}, 700)
},
switchChange (value) {
@@ -104,7 +110,7 @@ export const WorkCenterMixin = {
*/
beforeRouteEnter (to, from, next) {
if (to.query.taskId) {
queryTaskNameByTaskId({taskId: to.query.taskId}).then(res => {
queryTaskNameByTaskId({ taskId: to.query.taskId }).then(res => {
if (res.success) {
to.query.taskName = res.result.taskName
}