forked from github/dataease
fix: 消息跳转到无权限路由,显示空白
This commit is contained in:
parent
4a5f868090
commit
261d5fe574
@ -120,17 +120,30 @@ export default {
|
|||||||
if (this.$route && this.$route.name && this.$route.name === row.router) {
|
if (this.$route && this.$route.name && this.$route.name === row.router) {
|
||||||
// 如果当前路由就是目标路由 那么使用router.push页面不会刷新 这时候要使用事件方式
|
// 如果当前路由就是目标路由 那么使用router.push页面不会刷新 这时候要使用事件方式
|
||||||
row.callback && bus.$emit(row.callback, param)
|
row.callback && bus.$emit(row.callback, param)
|
||||||
|
row.status || this.setReaded(row.msgId)
|
||||||
} else {
|
} else {
|
||||||
this.$router.push({ name: row.router, params: param })
|
if (this.hasPermissionRoute(row.router)) {
|
||||||
|
this.$router.push({ name: row.router, params: param })
|
||||||
|
row.status || this.setReaded(row.msgId)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.$warning(this.$t('commons.no_target_permission'))
|
||||||
}
|
}
|
||||||
|
|
||||||
row.status || this.setReaded(row.msgId)
|
|
||||||
},
|
},
|
||||||
remove(row) {
|
remove(row) {
|
||||||
|
|
||||||
},
|
},
|
||||||
msgSetting() {
|
msgSetting() {
|
||||||
|
|
||||||
|
},
|
||||||
|
hasPermissionRoute(name, permission_routes) {
|
||||||
|
permission_routes = permission_routes || this.permission_routes
|
||||||
|
for (let index = 0; index < permission_routes.length; index++) {
|
||||||
|
const route = permission_routes[index]
|
||||||
|
if (route.name && route.name === name) return true
|
||||||
|
if (route.children && this.hasPermissionRoute(name, route.children)) return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
},
|
},
|
||||||
showMore() {
|
showMore() {
|
||||||
const routerName = 'sys-msg-web-all'
|
const routerName = 'sys-msg-web-all'
|
||||||
|
@ -129,6 +129,7 @@ export default {
|
|||||||
password_error: 'The password can not be less than 8 digits'
|
password_error: 'The password can not be less than 8 digits'
|
||||||
},
|
},
|
||||||
commons: {
|
commons: {
|
||||||
|
no_target_permission: 'No permission',
|
||||||
success: 'Success',
|
success: 'Success',
|
||||||
switch_lang: 'Switch Language Success',
|
switch_lang: 'Switch Language Success',
|
||||||
close: 'Close',
|
close: 'Close',
|
||||||
|
@ -129,6 +129,7 @@ export default {
|
|||||||
password_error: '密碼不小於 8 位'
|
password_error: '密碼不小於 8 位'
|
||||||
},
|
},
|
||||||
commons: {
|
commons: {
|
||||||
|
no_target_permission: '沒有權限',
|
||||||
success: '成功',
|
success: '成功',
|
||||||
switch_lang: '切換語言成功',
|
switch_lang: '切換語言成功',
|
||||||
close: '關閉',
|
close: '關閉',
|
||||||
|
@ -129,6 +129,7 @@ export default {
|
|||||||
password_error: '密码不小于 8 位'
|
password_error: '密码不小于 8 位'
|
||||||
},
|
},
|
||||||
commons: {
|
commons: {
|
||||||
|
no_target_permission: '没有权限',
|
||||||
success: '成功',
|
success: '成功',
|
||||||
switch_lang: '切换语言成功',
|
switch_lang: '切换语言成功',
|
||||||
close: '关闭',
|
close: '关闭',
|
||||||
|
@ -55,6 +55,7 @@ import { query, updateStatus } from '@/api/system/msg'
|
|||||||
import { msgTypes, getTypeName, loadMsgTypes } from '@/utils/webMsg'
|
import { msgTypes, getTypeName, loadMsgTypes } from '@/utils/webMsg'
|
||||||
import bus from '@/utils/bus'
|
import bus from '@/utils/bus'
|
||||||
import { addOrder, formatOrders } from '@/utils/index'
|
import { addOrder, formatOrders } from '@/utils/index'
|
||||||
|
import { mapGetters } from 'vuex'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
LayoutContent,
|
LayoutContent,
|
||||||
@ -82,6 +83,11 @@ export default {
|
|||||||
orderConditions: []
|
orderConditions: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters([
|
||||||
|
'permission_routes'
|
||||||
|
])
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.search()
|
this.search()
|
||||||
},
|
},
|
||||||
@ -120,8 +126,21 @@ export default {
|
|||||||
},
|
},
|
||||||
toDetail(row) {
|
toDetail(row) {
|
||||||
const param = { ...{ msgNotification: true, msgType: row.typeId, sourceParam: row.param }}
|
const param = { ...{ msgNotification: true, msgType: row.typeId, sourceParam: row.param }}
|
||||||
this.$router.push({ name: row.router, params: param })
|
if (this.hasPermissionRoute(row.router)) {
|
||||||
row.status || this.setReaded(row)
|
this.$router.push({ name: row.router, params: param })
|
||||||
|
row.status || this.setReaded(row)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.$warning(this.$t('commons.no_target_permission'))
|
||||||
|
},
|
||||||
|
hasPermissionRoute(name, permission_routes) {
|
||||||
|
permission_routes = permission_routes || this.permission_routes
|
||||||
|
for (let index = 0; index < permission_routes.length; index++) {
|
||||||
|
const route = permission_routes[index]
|
||||||
|
if (route.name && route.name === name) return true
|
||||||
|
if (route.children && this.hasPermissionRoute(name, route.children)) return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
},
|
},
|
||||||
// 设置已读
|
// 设置已读
|
||||||
setReaded(row) {
|
setReaded(row) {
|
||||||
|
@ -60,6 +60,7 @@ import ComplexTable from '@/components/business/complex-table'
|
|||||||
import { query } from '@/api/system/msg'
|
import { query } from '@/api/system/msg'
|
||||||
import { msgTypes, getTypeName, loadMsgTypes } from '@/utils/webMsg'
|
import { msgTypes, getTypeName, loadMsgTypes } from '@/utils/webMsg'
|
||||||
import { addOrder, formatOrders } from '@/utils/index'
|
import { addOrder, formatOrders } from '@/utils/index'
|
||||||
|
import { mapGetters } from 'vuex'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
LayoutContent,
|
LayoutContent,
|
||||||
@ -87,6 +88,11 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters([
|
||||||
|
'permission_routes'
|
||||||
|
])
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.search()
|
this.search()
|
||||||
},
|
},
|
||||||
@ -125,7 +131,21 @@ export default {
|
|||||||
},
|
},
|
||||||
toDetail(row) {
|
toDetail(row) {
|
||||||
const param = { ...{ msgNotification: true, msgType: row.typeId, sourceParam: row.param }}
|
const param = { ...{ msgNotification: true, msgType: row.typeId, sourceParam: row.param }}
|
||||||
this.$router.push({ name: row.router, params: param })
|
// this.$router.push({ name: row.router, params: param })
|
||||||
|
if (this.hasPermissionRoute(row.router)) {
|
||||||
|
this.$router.push({ name: row.router, params: param })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.$warning(this.$t('commons.no_target_permission'))
|
||||||
|
},
|
||||||
|
hasPermissionRoute(name, permission_routes) {
|
||||||
|
permission_routes = permission_routes || this.permission_routes
|
||||||
|
for (let index = 0; index < permission_routes.length; index++) {
|
||||||
|
const route = permission_routes[index]
|
||||||
|
if (route.name && route.name === name) return true
|
||||||
|
if (route.children && this.hasPermissionRoute(name, route.children)) return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
},
|
},
|
||||||
sortChange({ column, prop, order }) {
|
sortChange({ column, prop, order }) {
|
||||||
this.orderConditions = []
|
this.orderConditions = []
|
||||||
|
@ -65,7 +65,7 @@ import { query, updateStatus, batchRead } from '@/api/system/msg'
|
|||||||
import { msgTypes, getTypeName, loadMsgTypes } from '@/utils/webMsg'
|
import { msgTypes, getTypeName, loadMsgTypes } from '@/utils/webMsg'
|
||||||
import bus from '@/utils/bus'
|
import bus from '@/utils/bus'
|
||||||
import { addOrder, formatOrders } from '@/utils/index'
|
import { addOrder, formatOrders } from '@/utils/index'
|
||||||
|
import { mapGetters } from 'vuex'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
LayoutContent,
|
LayoutContent,
|
||||||
@ -98,6 +98,11 @@ export default {
|
|||||||
orderConditions: []
|
orderConditions: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters([
|
||||||
|
'permission_routes'
|
||||||
|
])
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.search()
|
this.search()
|
||||||
},
|
},
|
||||||
@ -136,8 +141,23 @@ export default {
|
|||||||
},
|
},
|
||||||
toDetail(row) {
|
toDetail(row) {
|
||||||
const param = { ...{ msgNotification: true, msgType: row.typeId, sourceParam: row.param }}
|
const param = { ...{ msgNotification: true, msgType: row.typeId, sourceParam: row.param }}
|
||||||
this.$router.push({ name: row.router, params: param })
|
// this.$router.push({ name: row.router, params: param })
|
||||||
this.setReaded(row)
|
// this.setReaded(row)
|
||||||
|
if (this.hasPermissionRoute(row.router)) {
|
||||||
|
this.$router.push({ name: row.router, params: param })
|
||||||
|
this.setReaded(row)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.$warning(this.$t('commons.no_target_permission'))
|
||||||
|
},
|
||||||
|
hasPermissionRoute(name, permission_routes) {
|
||||||
|
permission_routes = permission_routes || this.permission_routes
|
||||||
|
for (let index = 0; index < permission_routes.length; index++) {
|
||||||
|
const route = permission_routes[index]
|
||||||
|
if (route.name && route.name === name) return true
|
||||||
|
if (route.children && this.hasPermissionRoute(name, route.children)) return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
},
|
},
|
||||||
// 设置已读
|
// 设置已读
|
||||||
setReaded(row) {
|
setReaded(row) {
|
||||||
|
Loading…
Reference in New Issue
Block a user