diff --git a/src/utils/event-bus.ts b/src/utils/event-bus.ts index d488e5e..4f77e80 100644 --- a/src/utils/event-bus.ts +++ b/src/utils/event-bus.ts @@ -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' diff --git a/src/views/shop/shop_admin.vue b/src/views/shop/shop_admin.vue index c62d61b..c5ab420 100644 --- a/src/views/shop/shop_admin.vue +++ b/src/views/shop/shop_admin.vue @@ -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() { diff --git a/src/views/system/admin.vue b/src/views/system/admin.vue index 4896062..c35fce4 100644 --- a/src/views/system/admin.vue +++ b/src/views/system/admin.vue @@ -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() { diff --git a/src/views/system/role.vue b/src/views/system/role.vue index 09e4849..4571480 100644 --- a/src/views/system/role.vue +++ b/src/views/system/role.vue @@ -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) }