From 76eb1bb3889a647e1cb59efc6dca0fe84425621b Mon Sep 17 00:00:00 2001 From: zhl Date: Mon, 31 May 2021 15:40:37 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=92=E8=89=B2=E4=BF=A1=E6=81=AF=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=90=8E,=20=E5=AE=9E=E6=97=B6=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E9=A1=B5=E9=9D=A2=E5=92=8C=E5=BA=97?= =?UTF-8?q?=E9=93=BA=E7=AE=A1=E7=90=86=E5=91=98=E9=A1=B5=E9=9D=A2=E7=9A=84?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/event-bus.ts | 5 +++++ src/views/shop/shop_admin.vue | 6 +++++- src/views/system/admin.vue | 6 +++++- src/views/system/role.vue | 2 ++ 4 files changed, 17 insertions(+), 2 deletions(-) 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) }