From 0ec6168a4ac15b8dcfbe1f3df382242230329cc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=86=8A=E6=88=90=E5=BC=BA?= Date: Thu, 19 Nov 2020 09:34:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/common.js | 11 +++++++++++ src/views/kpi/workbench/home/index.vue | 8 ++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/utils/common.js b/src/utils/common.js index 9ac9b57..9e0c4f0 100644 --- a/src/utils/common.js +++ b/src/utils/common.js @@ -110,3 +110,14 @@ export function loadingClose () { this.$loading.service(opt).close() }, 100) } + +export function getUrlParams () { + var query = decodeURI(window.location.search.substring(1)) + var vars = query.split('&') + const obj = {} + for (var i = 0; i < vars.length; i++) { + var pair = vars[i].split('=') + obj[pair[0]] = pair[1] + } + return obj +} diff --git a/src/views/kpi/workbench/home/index.vue b/src/views/kpi/workbench/home/index.vue index c6fc0ad..9b85c60 100644 --- a/src/views/kpi/workbench/home/index.vue +++ b/src/views/kpi/workbench/home/index.vue @@ -38,7 +38,7 @@ import report from './report' import tableItem from '../todo/tableItem' import { apiGetWaitList } from '@/api/toDo' import performance from '../../assessment/performance' - +import { getUrlParams } from '@/utils/common' export default { data () { return { @@ -62,9 +62,9 @@ export default { computed: {}, beforeMount () {}, mounted () { - let search = window.location.search - if (search) { - const item = this.list.filter(i => '?' + i.tag === search.split('=')[0]) + let obj = getUrlParams() + if (obj.id) { + const item = this.list.filter(i => obj[i.tag]) if (item.length > 0) { this.$nextTick(() => { this.$router.replace({