From ad0afd3e967b59ea430e5f00e04d9847ed719437 Mon Sep 17 00:00:00 2001 From: danshihao Date: Mon, 12 Aug 2024 17:39:24 +0800 Subject: [PATCH] =?UTF-8?q?[update=20=E6=B5=81=E7=A8=8B=E8=BF=94=E5=9B=9E]?= =?UTF-8?q?=20=E5=A6=82=E6=9E=9C=E6=B2=A1=E6=9C=89=E4=B8=8A=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E9=A1=B5=E9=9D=A2=E5=B0=B1=E8=B7=B3=E8=BD=AC=E5=88=B0?= =?UTF-8?q?=E9=A6=96=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mixins/WorkCenterMixin.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mixins/WorkCenterMixin.js b/src/mixins/WorkCenterMixin.js index 6b2896c..f78f5e3 100644 --- a/src/mixins/WorkCenterMixin.js +++ b/src/mixins/WorkCenterMixin.js @@ -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 }