角色信息更新后, 实时更新管理员页面和店铺管理员页面的角色列表
This commit is contained in:
parent
fab2137eb4
commit
76eb1bb388
@ -37,3 +37,8 @@ export const EVENT_PUZZLE_UPDATE = 'event_puzzle_update'
|
||||
* @type {string}
|
||||
*/
|
||||
export const EVENT_SHOP_UPDATE = 'event_shop_update'
|
||||
/**
|
||||
* 角色信息更新
|
||||
* @type {string}
|
||||
*/
|
||||
export const EVENT_ROLE_UPDATE = 'event_role_update'
|
||||
|
@ -295,7 +295,7 @@ import { IRole } from '@/views/system/role.vue'
|
||||
import { IShopData } from '@/api/types'
|
||||
import { UserModule } from '@/store/modules/user'
|
||||
import { getShops } from '@/api/shop'
|
||||
import { EVENT_SHOP_UPDATE, EventBus } from '@/utils/event-bus'
|
||||
import { EVENT_ROLE_UPDATE, EVENT_SHOP_UPDATE, EventBus } from '@/utils/event-bus'
|
||||
|
||||
@Component({
|
||||
name: 'ShopAdmin',
|
||||
@ -360,10 +360,14 @@ export default class extends Vue {
|
||||
EventBus.$on(EVENT_SHOP_UPDATE, () => {
|
||||
this.getRemoteDeptList()
|
||||
})
|
||||
EventBus.$on(EVENT_ROLE_UPDATE, () => {
|
||||
this.getAllRole()
|
||||
})
|
||||
}
|
||||
|
||||
beforeDestory() {
|
||||
EventBus.$off(EVENT_SHOP_UPDATE)
|
||||
EventBus.$off(EVENT_ROLE_UPDATE)
|
||||
}
|
||||
|
||||
private search() {
|
||||
|
@ -293,7 +293,7 @@ import {
|
||||
import { IRole } from '@/views/system/role.vue'
|
||||
import { getShops } from '@/api/shop'
|
||||
import { IShopData } from '@/api/types'
|
||||
import { EVENT_SHOP_UPDATE, EventBus } from '@/utils/event-bus'
|
||||
import { EVENT_ROLE_UPDATE, EVENT_SHOP_UPDATE, EventBus } from '@/utils/event-bus'
|
||||
import { UserModule } from '@/store/modules/user'
|
||||
|
||||
@Component({
|
||||
@ -355,10 +355,14 @@ export default class extends Vue {
|
||||
EventBus.$on(EVENT_SHOP_UPDATE, () => {
|
||||
this.getRemoteDeptList()
|
||||
})
|
||||
EventBus.$on(EVENT_ROLE_UPDATE, () => {
|
||||
this.getAllRole()
|
||||
})
|
||||
}
|
||||
|
||||
beforeDestory() {
|
||||
EventBus.$off(EVENT_SHOP_UPDATE)
|
||||
EventBus.$off(EVENT_ROLE_UPDATE)
|
||||
}
|
||||
|
||||
private search() {
|
||||
|
@ -156,6 +156,7 @@ import { Component, Vue } from 'vue-property-decorator'
|
||||
import { deleteRole, getRoles, saveRole } from '@/api/roles'
|
||||
import TagInput from '@/components/TagInput/index.vue'
|
||||
import { getPermissions } from '@/api/permissions'
|
||||
import { EVENT_ROLE_UPDATE, EVENT_SHOP_UPDATE, EventBus } from '@/utils/event-bus'
|
||||
|
||||
export interface IRole {
|
||||
key: string
|
||||
@ -292,6 +293,7 @@ export default class extends Vue {
|
||||
`,
|
||||
type: 'success'
|
||||
})
|
||||
EventBus.$emit(EVENT_ROLE_UPDATE, {})
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user