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) {
|
||||
// 如果当前路由就是目标路由 那么使用router.push页面不会刷新 这时候要使用事件方式
|
||||
row.callback && bus.$emit(row.callback, param)
|
||||
} else {
|
||||
this.$router.push({ name: row.router, params: param })
|
||||
}
|
||||
|
||||
row.status || this.setReaded(row.msgId)
|
||||
} else {
|
||||
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'))
|
||||
}
|
||||
},
|
||||
remove(row) {
|
||||
|
||||
},
|
||||
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() {
|
||||
const routerName = 'sys-msg-web-all'
|
||||
|
@ -129,6 +129,7 @@ export default {
|
||||
password_error: 'The password can not be less than 8 digits'
|
||||
},
|
||||
commons: {
|
||||
no_target_permission: 'No permission',
|
||||
success: 'Success',
|
||||
switch_lang: 'Switch Language Success',
|
||||
close: 'Close',
|
||||
|
@ -129,6 +129,7 @@ export default {
|
||||
password_error: '密碼不小於 8 位'
|
||||
},
|
||||
commons: {
|
||||
no_target_permission: '沒有權限',
|
||||
success: '成功',
|
||||
switch_lang: '切換語言成功',
|
||||
close: '關閉',
|
||||
|
@ -129,6 +129,7 @@ export default {
|
||||
password_error: '密码不小于 8 位'
|
||||
},
|
||||
commons: {
|
||||
no_target_permission: '没有权限',
|
||||
success: '成功',
|
||||
switch_lang: '切换语言成功',
|
||||
close: '关闭',
|
||||
|
@ -55,6 +55,7 @@ import { query, updateStatus } from '@/api/system/msg'
|
||||
import { msgTypes, getTypeName, loadMsgTypes } from '@/utils/webMsg'
|
||||
import bus from '@/utils/bus'
|
||||
import { addOrder, formatOrders } from '@/utils/index'
|
||||
import { mapGetters } from 'vuex'
|
||||
export default {
|
||||
components: {
|
||||
LayoutContent,
|
||||
@ -82,6 +83,11 @@ export default {
|
||||
orderConditions: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'permission_routes'
|
||||
])
|
||||
},
|
||||
mounted() {
|
||||
this.search()
|
||||
},
|
||||
@ -120,8 +126,21 @@ export default {
|
||||
},
|
||||
toDetail(row) {
|
||||
const param = { ...{ msgNotification: true, msgType: row.typeId, sourceParam: row.param }}
|
||||
if (this.hasPermissionRoute(row.router)) {
|
||||
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) {
|
||||
|
@ -60,6 +60,7 @@ import ComplexTable from '@/components/business/complex-table'
|
||||
import { query } from '@/api/system/msg'
|
||||
import { msgTypes, getTypeName, loadMsgTypes } from '@/utils/webMsg'
|
||||
import { addOrder, formatOrders } from '@/utils/index'
|
||||
import { mapGetters } from 'vuex'
|
||||
export default {
|
||||
components: {
|
||||
LayoutContent,
|
||||
@ -87,6 +88,11 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'permission_routes'
|
||||
])
|
||||
},
|
||||
mounted() {
|
||||
this.search()
|
||||
},
|
||||
@ -125,7 +131,21 @@ export default {
|
||||
},
|
||||
toDetail(row) {
|
||||
const param = { ...{ msgNotification: true, msgType: row.typeId, sourceParam: row.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 }) {
|
||||
this.orderConditions = []
|
||||
|
@ -65,7 +65,7 @@ import { query, updateStatus, batchRead } from '@/api/system/msg'
|
||||
import { msgTypes, getTypeName, loadMsgTypes } from '@/utils/webMsg'
|
||||
import bus from '@/utils/bus'
|
||||
import { addOrder, formatOrders } from '@/utils/index'
|
||||
|
||||
import { mapGetters } from 'vuex'
|
||||
export default {
|
||||
components: {
|
||||
LayoutContent,
|
||||
@ -98,6 +98,11 @@ export default {
|
||||
orderConditions: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'permission_routes'
|
||||
])
|
||||
},
|
||||
mounted() {
|
||||
this.search()
|
||||
},
|
||||
@ -136,8 +141,23 @@ export default {
|
||||
},
|
||||
toDetail(row) {
|
||||
const param = { ...{ msgNotification: true, msgType: row.typeId, sourceParam: row.param }}
|
||||
// this.$router.push({ name: row.router, params: param })
|
||||
// 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) {
|
||||
|
Loading…
Reference in New Issue
Block a user