diff --git a/src/App.vue b/src/App.vue
index fed5caa5f..8de84169c 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,12 +1,19 @@
-
+
diff --git a/src/store/modules/common.js b/src/store/modules/common.js
index e26944216..f3ac0e80e 100644
--- a/src/store/modules/common.js
+++ b/src/store/modules/common.js
@@ -2,7 +2,8 @@ import { optionUrlMeta } from '@/api/common'
const getDefaultState = () => {
return {
- metaMap: {}
+ metaMap: {},
+ isRouterAlive: true
}
}
@@ -11,6 +12,12 @@ const state = getDefaultState()
const mutations = {
SET_URL_META: (state, { url, meta }) => {
state.metaMap[url] = meta
+ },
+ reload: (state) => {
+ state.isRouterAlive = false
+ setTimeout(() => {
+ state.isRouterAlive = true
+ }, 0)
}
}
diff --git a/src/utils/org.js b/src/utils/org.js
index 6cd0a5d3d..ea18b8f77 100644
--- a/src/utils/org.js
+++ b/src/utils/org.js
@@ -30,7 +30,7 @@ async function changeOrg(org) {
if (index !== -1) {
location.href = path.substring(0, index)
}
- setTimeout(() => location.reload(), 400)
+ setTimeout(() => store.commit('common/reload'), 400)
}
}
diff --git a/src/views/accounts/ChangeAuthPlan/AppChangeAuthPlan/ChangeAuthPlanDetail/ChangeAuthPlanApp/index.vue b/src/views/accounts/ChangeAuthPlan/AppChangeAuthPlan/ChangeAuthPlanDetail/ChangeAuthPlanApp/index.vue
index 74ae7e95e..4d8ef9037 100644
--- a/src/views/accounts/ChangeAuthPlan/AppChangeAuthPlan/ChangeAuthPlanDetail/ChangeAuthPlanApp/index.vue
+++ b/src/views/accounts/ChangeAuthPlan/AppChangeAuthPlan/ChangeAuthPlanDetail/ChangeAuthPlanApp/index.vue
@@ -98,7 +98,7 @@ export default {
that.iHasObjects = [...that.iHasObjects, ...objects]
that.$refs.select2.clearSelected()
this.$message.success(this.$t('common.updateSuccessMsg'))
- window.location.reload()
+ this.$store.commit('common/reload')
this.$refs.listTable.$refs.ListTable.reloadTable()
}
}
diff --git a/src/views/accounts/ChangeAuthPlan/AssetChangeAuthPlan/ChangeAuthPlanDetail/ChangeAuthPlanAsset/index.vue b/src/views/accounts/ChangeAuthPlan/AssetChangeAuthPlan/ChangeAuthPlanDetail/ChangeAuthPlanAsset/index.vue
index ecca8a67e..e420c086a 100644
--- a/src/views/accounts/ChangeAuthPlan/AssetChangeAuthPlan/ChangeAuthPlanDetail/ChangeAuthPlanAsset/index.vue
+++ b/src/views/accounts/ChangeAuthPlan/AssetChangeAuthPlan/ChangeAuthPlanDetail/ChangeAuthPlanAsset/index.vue
@@ -93,7 +93,7 @@ export default {
onAddSuccess: (items, that) => {
this.$log.debug('AssetSelect value', that.assets)
this.$message.success(this.$t('common.updateSuccessMsg'))
- window.location.reload()
+ this.$store.commit('common/reload')
}
},
nodeRelationConfig: {
@@ -120,7 +120,7 @@ export default {
that.iHasObjects = [...that.iHasObjects, ...objects]
that.$refs.select2.clearSelected()
this.$message.success(this.$t('common.updateSuccessMsg'))
- window.location.reload()
+ this.$store.commit('common/reload')
},
performDelete: (item) => {
const data = {
diff --git a/src/views/perms/AssetPermission/AssetPermissionDetail/AssetPermissionAsset.vue b/src/views/perms/AssetPermission/AssetPermissionDetail/AssetPermissionAsset.vue
index 2e4fa30e8..526e73bc4 100644
--- a/src/views/perms/AssetPermission/AssetPermissionDetail/AssetPermissionAsset.vue
+++ b/src/views/perms/AssetPermission/AssetPermissionDetail/AssetPermissionAsset.vue
@@ -93,7 +93,7 @@ export default {
this.$message.success(this.$t('common.updateSuccessMsg'))
this.$refs.ListTable.reloadTable()
that.$refs.assetSelect.$refs.select2.clearSelected()
- window.location.reload()
+ this.$store.commit('common/reload')
}
},
nodeRelationConfig: {
diff --git a/src/views/sessions/SessionDetail/SessionDetailInfo.vue b/src/views/sessions/SessionDetail/SessionDetailInfo.vue
index 1bb503e75..4dc3315b8 100644
--- a/src/views/sessions/SessionDetail/SessionDetailInfo.vue
+++ b/src/views/sessions/SessionDetail/SessionDetailInfo.vue
@@ -49,7 +49,7 @@ export default {
const msg = vm.$t('sessions.TerminateTaskSendSuccessMsg')
vm.$message.success(msg)
window.setTimeout(function() {
- window.location.reload()
+ this.$store.commit('common/reload')
}, 50000)
})
}
diff --git a/src/views/settings/Interface.vue b/src/views/settings/Interface.vue
index b5b7b8800..2b1e7aeac 100644
--- a/src/views/settings/Interface.vue
+++ b/src/views/settings/Interface.vue
@@ -175,7 +175,7 @@ export default {
}).then(() => {
restoreInterface().then(res => {
this.$message.success(res.success)
- location.reload()
+ this.$store.commit('common/reload')
})
})
}.bind(this)
@@ -221,7 +221,7 @@ export default {
}
}
updateInterface(form).then(res => {
- location.reload()
+ this.$store.commit('common/reload')
})
}
}
diff --git a/src/views/settings/License.vue b/src/views/settings/License.vue
index d3d9c19a5..c485534a4 100644
--- a/src/views/settings/License.vue
+++ b/src/views/settings/License.vue
@@ -140,6 +140,7 @@ export default {
window.open(url, '_blank')
},
importLicense() {
+ const vm = this
if (this.licenseFile['file'] === undefined) {
return
}
@@ -148,7 +149,7 @@ export default {
importLicense(formData).then(res => {
if (res.status) {
this.$message.success(res.msg)
- setTimeout(() => location.reload(), 500)
+ setTimeout(() => vm.$store.commit('common/reload'), 500)
} else {
this.$message.error(res.msg)
}
diff --git a/src/views/tickets/RequestApplicationPerm/Detail/TicketDetail.vue b/src/views/tickets/RequestApplicationPerm/Detail/TicketDetail.vue
index c710e7625..d07cb7c4e 100644
--- a/src/views/tickets/RequestApplicationPerm/Detail/TicketDetail.vue
+++ b/src/views/tickets/RequestApplicationPerm/Detail/TicketDetail.vue
@@ -236,7 +236,7 @@ export default {
return toSafeLocalDateStr(dataStr)
},
reloadPage() {
- window.location.reload()
+ this.$store.commit('common/reload')
},
handleApprove() {
if (this.object.approval_step === this.object.process_map.length) {
diff --git a/src/views/tickets/RequestAssetPerm/Detail/TicketDetail.vue b/src/views/tickets/RequestAssetPerm/Detail/TicketDetail.vue
index 8665046e5..82f93b6c3 100644
--- a/src/views/tickets/RequestAssetPerm/Detail/TicketDetail.vue
+++ b/src/views/tickets/RequestAssetPerm/Detail/TicketDetail.vue
@@ -244,7 +244,7 @@ export default {
return toSafeLocalDateStr(dataStr)
},
reloadPage() {
- window.location.reload()
+ this.$store.commit('common/reload')
},
handleApprove() {
if (this.object.approval_step === this.object.process_map.length) {
diff --git a/src/views/tickets/TicketFlow/Detail/TicketDetail.vue b/src/views/tickets/TicketFlow/Detail/TicketDetail.vue
index c47920336..8d1db855d 100644
--- a/src/views/tickets/TicketFlow/Detail/TicketDetail.vue
+++ b/src/views/tickets/TicketFlow/Detail/TicketDetail.vue
@@ -88,7 +88,7 @@ export default {
return toSafeLocalDateStr(dataStr)
},
reloadPage() {
- window.location.reload()
+ this.$store.commit('common/reload')
}
}
}
diff --git a/src/views/tickets/components/Comments.vue b/src/views/tickets/components/Comments.vue
index 4e70e0bd6..ea9513bf3 100644
--- a/src/views/tickets/components/Comments.vue
+++ b/src/views/tickets/components/Comments.vue
@@ -199,7 +199,7 @@ export default {
)
},
reloadPage() {
- window.location.reload()
+ this.$store.commit('common/reload')
}
}